/* =============================================================================
   wp_app.css – Paket app (Eigentum WP3): Termine-Popover der Kopfleiste, Kalender, Installationsseite,
   früheres Dashboard. Die Inbox steht in wp_inbox.css; die Erinnerungsleiste (B.4) und die Toasts in app.css.
   Farben nur aus den Tokens (SPEC_UI_CLOSE_1ZU1 A) – kein Petrol, kein Mint.
   ============================================================================= */

/* ---------- Merker „neue Version“ (app.js zeigt ihn als Toast und im Hilfe-Menü, B.6.11) ---------- */
.app-banner { display: none; }

/* ---------- Termine-Popover am Kalender-Knopf (C-20) ---------- */
.termine-popover { width: 320px; max-width: calc(100vw - 16px); padding: 0; overflow: hidden; }
.termine-head { padding: 12px 16px 6px; font: 400 12px/16px var(--font-sans); text-transform: uppercase; color: var(--text-light); }
.termine-body { max-height: min(60vh, 520px); overflow: auto; }
.termine-group { padding: 8px 16px 4px; font: 600 12px/16px var(--font-sans); color: var(--text-default); }
.termine-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) minmax(0, auto); align-items: center; column-gap: 8px; height: 40px; padding: 0 16px; }
.termine-row:hover { background: var(--menu-item-hover); }
.termine-time { font-size: 13px; line-height: 18px; color: var(--text-medium); font-variant-numeric: tabular-nums; }
.termine-title { min-width: 0; color: var(--text-default); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.termine-lead { max-width: 120px; font-size: 13px; line-height: 18px; color: var(--link); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.termine-more { margin: 0; padding: 6px 16px 10px; font-size: 13px; color: var(--text-light); }
.termine-foot { padding: 10px 16px; border-top: 1px solid var(--gray-5); background: var(--gray-1); font-size: 13px; line-height: 18px; }
.termine-foot a { display: inline-flex; align-items: center; gap: 4px; color: var(--link); }
.termine-foot .icon { color: var(--link); }
.termine-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 24px 24px; text-align: center; color: var(--text-medium); }
.termine-empty p { margin: 0; }
.termine-empty__icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--purple-10); color: var(--purple-50); }
.termine-popover:has(.termine-empty) .termine-foot { display: none; }

/* ---------- Kalender (C-20): der Kopf steht, nur das Raster scrollt (B.1) ---------- */
.cal-page { display: flex; flex-direction: column; height: 100%; min-height: 0; min-width: 0; background: var(--surface); }
.cal-bar { gap: 12px; }
.cal-bar .page-head__title { margin-right: 4px; flex: none; }
.cal-views { flex: none; }
.cal-views .btn.is-on { background: var(--gray-5); font-weight: 600; }
.cal-nav { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.cal-title { min-width: 0; margin: 0; font: 600 16px/24px var(--font-sans); color: var(--text-default); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-user-label { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.cal-user-menu { width: 260px; }
.cal-user-menu .avatar { width: 16px; height: 16px; font-size: 8px; }
.cal-layer-menu { width: 200px; }
.cal-layer { gap: 8px; cursor: pointer; }
.cal-swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--cal-bg); border-left: 3px solid var(--cal-color); flex: none; }

.cal-meeting, .cal-layer-meetings { --cal-color: var(--purple-50); --cal-bg: var(--purple-10); --cal-text: var(--purple-80); }
.cal-task, .cal-layer-tasks { --cal-color: var(--orange-40); --cal-bg: var(--orange-5); --cal-text: var(--orange-80); }
.cal-ai, .cal-layer-ai { --cal-color: var(--teal-50); --cal-bg: var(--teal-10); --cal-text: var(--teal-80); }
/* Dunkelmodus: Uhrzeit und Randstrich der Termine in der hellen Stufe 70 (auf der dunklen Stufe 10 ≥ 4,5 : 1) */
:root[data-theme="dark"] :is(.cal-meeting, .cal-layer-meetings) { --cal-color: var(--purple-70); }
:root[data-theme="dark"] :is(.cal-ai, .cal-layer-ai) { --cal-color: var(--teal-70); }

.cal-grid { --cal-hour: 48px; flex: 1; min-height: 0; min-width: 0; overflow: auto; background: var(--surface); }
.cal-head, .cal-body { display: grid; grid-template-columns: 56px repeat(var(--cal-cols), minmax(110px, 1fr)); min-width: calc(56px + var(--cal-cols) * 110px); }
.cal-view-day .cal-head, .cal-view-day .cal-body { grid-template-columns: 56px minmax(240px, 1fr); min-width: 0; }
.cal-head { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--border-default); }
.cal-gutter { border-right: 1px solid var(--gray-5); }
.cal-day-head {
  display: flex; gap: 6px; align-items: center; justify-content: center; height: 40px; padding: 0 4px; color: var(--text-light);
  border-right: 1px solid var(--gray-5); font-size: 13px; line-height: 18px; text-decoration: none;
}
.cal-day-head:last-child { border-right: 0; }
.cal-day-head strong { padding: 1px 6px; border-radius: 4px; color: var(--text-default); font: 600 14px/20px var(--font-sans); }
.cal-day-head:hover { background: var(--gray-1); text-decoration: none; }
.cal-day-head.is-today strong { background: var(--bg-active); color: #fff; }
.cal-hours { border-right: 1px solid var(--gray-5); }
.cal-hour-label { height: var(--cal-hour); padding: 0 8px; font-size: 12px; line-height: 16px; color: var(--text-light); text-align: right; transform: translateY(-8px); }
.cal-hour-label:first-child { transform: none; }
.cal-col { position: relative; height: calc(var(--cal-rows) * var(--cal-hour)); border-right: 1px solid var(--gray-5); }
.cal-col:last-child { border-right: 0; }
.cal-col.is-weekend { background: var(--gray-1); }
.cal-col.is-today { background: var(--blue-2); }
.cal-slot {
  display: block; width: 100%; height: calc(var(--cal-hour) / 2); margin: 0; padding: 0; border: 0; border-top: 1px solid transparent;
  background: transparent; cursor: pointer;
}
.cal-slot:nth-child(odd) { border-top-color: var(--gray-5); }
.cal-slot:hover { background: rgba(43, 108, 240, .06); }
.cal-slot:hover::after { content: "+ Meeting"; display: block; padding: 2px 6px; font-size: 12px; line-height: 16px; color: var(--link); text-align: left; }
.cal-events { position: absolute; inset: 0; pointer-events: none; }
.cal-event {
  position: absolute; display: flex; flex-direction: column; padding: 2px 6px; overflow: hidden; pointer-events: auto;
  border-radius: 4px; border-left: 3px solid var(--cal-color); background: var(--cal-bg); color: var(--cal-text);
  font-size: 12px; line-height: 16px; text-decoration: none; box-shadow: 0 0 0 1px var(--surface);
}
.cal-event:hover { text-decoration: none; z-index: 2; color: var(--cal-text); filter: brightness(.97); }
.cal-event-time { font-weight: 600; color: var(--cal-color); white-space: nowrap; }
.cal-event-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event-lead { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Besitzer als Nutzer-Avatar 16 px (crm_tags.avatar_html): dieselbe Farbe wie überall, nicht die Farbe der Terminart */
.cal-event-owner { position: absolute; top: 2px; right: 4px; display: inline-flex; border-radius: 50%; }
.cal-event-owner .avatar { box-shadow: 0 0 0 1.5px var(--surface); }
.cal-event.is-short { flex-direction: row; gap: 4px; align-items: center; padding-top: 0; padding-bottom: 0; }
.cal-event.is-short .cal-event-lead { display: none; }
.cal-event.is-done .cal-event-title { text-decoration: line-through; color: var(--text-light); }
.cal-now { position: absolute; left: 0; right: 0; height: 1px; background: var(--red-50); z-index: 2; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 7px; height: 7px; border-radius: 50%; background: var(--red-50); }

.cal-month { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: auto; background: var(--surface); }
.cal-month-head, .cal-month-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-month-head { position: sticky; top: 0; z-index: 3; background: var(--surface-medium); flex: none; }
.cal-month-head div { height: 40px; display: flex; align-items: center; padding: 0 12px; font: 600 14px/20px var(--font-sans); color: var(--text-default); border-bottom: 1px solid var(--border-default); border-right: 1px solid var(--border-default); }
.cal-month-head div:last-child { border-right: 0; }
.cal-month-row { flex: 1 0 auto; }
.cal-month-cell { position: relative; min-height: 112px; padding: 4px 6px 6px; border-right: 1px solid var(--gray-5); border-bottom: 1px solid var(--gray-5); min-width: 0; }
.cal-month-cell:nth-child(7n) { border-right: 0; }
.cal-month-cell:nth-child(7n), .cal-month-cell:nth-child(7n - 1) { background: var(--gray-1); }
.cal-month-cell.is-outside .cal-month-date { color: var(--gray-40); }
.cal-month-cell.is-today { background: var(--blue-2); }
.cal-month-date { display: inline-flex; min-width: 24px; height: 22px; align-items: center; justify-content: center; padding: 0 4px; border-radius: 4px; font: 600 13px/18px var(--font-sans); color: var(--text-default); }
.cal-month-date:hover { background: var(--bg-hover); text-decoration: none; }
.cal-month-cell.is-today .cal-month-date { background: var(--bg-active); color: #fff; }
.cal-month-add {
  position: absolute; top: 4px; right: 6px; width: 22px; height: 22px; border: 0; border-radius: 6px; background: transparent;
  color: var(--gray-40); cursor: pointer; font-size: 16px; line-height: 1; opacity: 0;
}
.cal-month-cell:hover .cal-month-add, .cal-month-add:focus-visible { opacity: 1; }
.cal-month-add:hover { background: var(--bg-hover); color: var(--link); }
.cal-month-items { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cal-chip {
  display: block; padding: 1px 6px; border-radius: 4px; border-left: 3px solid var(--cal-color); background: var(--cal-bg); color: var(--cal-text);
  font-size: 12px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none;
}
.cal-chip:hover { text-decoration: none; color: var(--cal-text); filter: brightness(.97); }
.cal-chip.is-done { text-decoration: line-through; color: var(--text-light); }
.cal-chip-time { font-weight: 600; color: var(--cal-color); }
.cal-more { padding-left: 6px; font-size: 12px; color: var(--text-light); }

/* Dialog „Neues Meeting“: Titel und Datumszeile untereinander (.modal-header selbst ist eine Flex-Zeile) */
.cal-new-head { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-new-when { margin: 0; font: 400 13px/18px var(--font-sans); color: var(--text-light); }
.cal-lead-results { margin-top: 10px; min-height: 60px; }
.cal-lead-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cal-lead-option {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; padding: 0 8px;
  border: 0; border-radius: 6px; background: none; font: inherit; color: var(--text-default); text-align: left; cursor: pointer;
}
.cal-lead-option:hover, .cal-lead-option:focus-visible { background: var(--menu-item-hover); }
.cal-lead-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--link); }
.cal-feed-steps { padding-left: 20px; margin: 0 0 12px; }
.cal-feed-steps li { margin-bottom: 6px; }
.cal-feed .input-group .input { font-size: 12px; }

/* ---------- Installationsseite ---------- */
.install { max-width: 920px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.install-hero { display: flex; gap: 20px; align-items: center; }
.install-logo { width: 88px; height: 88px; border-radius: 20px; flex-shrink: 0; }
.install-hero h1 { margin-bottom: 4px; font: 700 24px/32px var(--font-sans); }
.install-hero p { max-width: 640px; margin: 0; color: var(--text-medium); }
.install-action { padding: 16px; border: 1px solid var(--gray-5); border-radius: 8px; background: var(--gray-1); }
.install-action p { margin: 0 0 8px; } .install-action p:last-child { margin-bottom: 0; }
.install-button { margin-bottom: 8px; }
.install-ok { display: flex; align-items: center; gap: 8px; color: var(--text-default); }
.install-ok .icon { color: var(--green-40); }
.install-detected { margin: 8px 0 0; }
.install-guides h2, .install-faq h2, .install-after h2 { margin-bottom: 8px; font: 700 16px/24px var(--font-sans); }
.install-tabs { margin-bottom: 16px; }
.install-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.install-steps > li {
  counter-increment: step; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 20px; align-items: center;
  padding: 16px; border: 1px solid var(--border-default); border-radius: 8px; background: var(--surface);
}
.install-step-text { position: relative; padding-left: 36px; }
.install-step-text::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%;
  background: var(--gray-10); color: var(--text-default); font: 600 13px/24px var(--font-sans); text-align: center;
}
.install-step-text h3 { margin-bottom: 4px; font: 600 14px/20px var(--font-sans); }
.install-step-text p { margin: 0; color: var(--text-medium); }
.install-steps > li:not(:has(.illus)) { grid-template-columns: 1fr; }
.illus { width: 100%; max-width: 360px; height: auto; display: block; justify-self: end; }
.illus-narrow { max-width: 220px; }
.illus-t { font-family: var(--font-sans); font-size: 11px; fill: #2e2e2e; }
.illus-b { font-weight: 700; font-size: 12px; }
.illus-s { font-size: 9px; }
.illus-muted { fill: #767676; }
.illus-inv { fill: #fff; font-weight: 600; }
.illus-pulse { animation: illus-pulse 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
/* Dunkelmodus: die Bilder zeigen den Browser dunkel wie Chrome/Edge im dunklen Design – Helligkeit umgekehrt, Farbton bleibt */
:root[data-theme="dark"] .illus { filter: invert(.88) hue-rotate(180deg); }
@keyframes illus-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .72; } }
@media (prefers-reduced-motion: reduce) { .illus-pulse { animation: none; } }
.install-after-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.install-faq details { padding: 10px 12px; border-bottom: 1px solid var(--border-default); }
.install-faq details:first-of-type { border-top: 1px solid var(--border-default); }
.install-faq summary { cursor: pointer; font-weight: 600; }
.install-faq details p { margin: 8px 0 0; color: var(--text-medium); }
.install-share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-bottom: 24px; }
.install-link { padding: 2px 8px; border-radius: 4px; background: var(--gray-5); }

/* ---------- Mobil ---------- */
@media (max-width: 767.98px) {
  .cal-bar { flex-wrap: wrap; height: auto; padding-top: 8px; padding-bottom: 8px; row-gap: 8px; }
  .cal-month-cell { min-height: 72px; padding: 2px 3px; }
  .cal-chip-title { display: none; }
  .install-hero { flex-direction: column; text-align: center; }
  .install-steps > li { grid-template-columns: 1fr; }
  .illus { justify-self: center; }
}

@media print {
  .cal-slot, .cal-month-add, .cal-bar .btn { display: none !important; }
}

/* ---- übernommen aus completion.css (WP0, einmalig verschoben; Eigentum WP3): früheres Dashboard /heute/ ---- */
.dashboard-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.dashboard-grid .card{min-width:0}.task-row{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 0;border-bottom:1px solid var(--border-default)}.task-row:last-child{border-bottom:0}
@media(max-width:760px){.dashboard-grid{grid-template-columns:1fr}}
