/* Seite "Kunde" (mobile-customer.js): ein Kunde, ein Bildschirm. Nur im
   mobilen Modus; der Desktop kennt diese Seite nicht. Farben aus den Tokens
   in styles.css; die vier Werte unten stammen aus dem Entwurf (Claude
   Design, Kunde-Ueberblick/-Verlauf) und haben dort keinen Token. */
html.rl-mobile-mode :is(.mcp, .mcp-menu) {
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 15px;
  --text-lg: 17px;
  --mcp-line: #e3e3e1;          /* Kartenrand, leise (keine Bedienfläche) */
  --mcp-grip: #c9ccd0;
  --mcp-danger-line: #d9666d;   /* 3,5:1 auf Weiss, Rand von "Termin absagen" */
  --mcp-fresh: #fffaf0;         /* eben gespeichert */
  --mcp-track: #f0f0ef;         /* Spur der HU-Balken (V2) */
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
}

/* Ohne Gewicht: jede Klasse unten (Knopf, Reiter, Chip) setzt ihr eigenes. */
:where(html.rl-mobile-mode) :where(.mcp, .mcp-menu) :where(button, a, input, select) {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
:where(html.rl-mobile-mode) :where(.mcp, .mcp-menu) button { cursor: pointer; }
/* Nur die eigenen Symbole; die Monatsgrafik bringt ihre Farben mit. */
:where(html.rl-mobile-mode) .mcp-ico {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
html.rl-mobile-mode :is(.mcp, .mcp-menu) :focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* Was verborgen ist, bleibt verborgen, auch wenn eine Klasse display setzt
   (Repp-Historie, "Mehr anzeigen" der Pruefungen). */
html.rl-mobile-mode :is(.mcp, .mcp-menu) [hidden] { display: none !important; }

/* --- Seite ---------------------------------------------------------------- */
html.rl-mobile-mode .mcp[open] {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  /* clip statt hidden: Ein Fokus oder scrollIntoView tief in der Seite darf
     nur den Inhalt scrollen, nie den Rahmen samt Kopf und Daumenleiste. */
  overflow: hidden;
  overflow: clip;
  border: 0;
  border-radius: 0;
  background: var(--mist);
  box-shadow: none;
  animation: mcp-in 220ms cubic-bezier(.2, .8, .2, 1);
}
html.rl-mobile-mode .mcp::backdrop { background: var(--mist); }
@keyframes mcp-in { from { transform: translateX(28px); opacity: .5; } }

.mcp-bar {
  position: relative;
  z-index: 3;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: calc(44px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 8px 0;
  background: var(--paper);
}
.mcp-back {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 44px;
  min-height: 44px;
  max-width: 38%;
  padding: 0 8px 0 4px;
  border: 0;
  background: none;
  color: var(--blue);
  font-size: 16px;
  font-weight: 600;
}
.mcp-back span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-bar-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 16px;
  font-weight: 800;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 150ms ease;
}
.mcp.is-condensed .mcp-bar-title { opacity: 1; }
.mcp-icon-button {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
}

.mcp-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}
.mcp-head { padding: 2px 16px 12px; background: var(--paper); }
.mcp-head h2 {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
  outline: none;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
/* Runde 2: Fahnen und "KE · Ort" in einer Zeile, die bei Bedarf umbricht. */
.mcp-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; }
.mcp-sub { margin: 0; color: var(--ink-50); font-size: 14px; }
.mcp-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.mcp-chip:has(.mcp-ico) { padding-left: 8px; }
/* Rot gefuellt nur fuer das Risiko (weiss auf #d5222d 5,13:1). */
.mcp-chip.is-red { background: var(--red-action); color: var(--paper); }
.mcp-chip.is-red .mcp-ico { stroke-width: 2.4; }
.mcp-chip.is-blue { background: var(--blue-soft); color: var(--blue); }
.mcp-chip.is-green { background: var(--green-soft); color: var(--green); }
.mcp-chip.is-gray { background: var(--border-soft); color: var(--ink-70); }

/* Die Reiter bleiben oben stehen, wenn der Name weggescrollt ist. */
.mcp-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 2px;
  /* 2px oben: Die Trefferflaeche (44) der 40px-Reiter wird nicht beschnitten.
     Links buendig mit dem Namen (V2). */
  padding: 2px 16px 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--mcp-line);
  background: var(--paper);
  scrollbar-width: none;
}
.mcp-tabs::-webkit-scrollbar { display: none; }
.mcp-tabs button {
  position: relative;
  flex: none;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-70);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.mcp-tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.mcp-tabs button::after { content: ""; position: absolute; inset: -2px 0; }
/* Die Zahl haelt ihren Platz, bis der Verlauf geladen ist. */
.mcp-tab-count { display: inline-block; min-width: 2ch; font-size: 13px; font-weight: 600; opacity: .8; text-align: left; }

.mcp-panel { display: flex; flex-direction: column; gap: 12px; min-height: var(--mcp-panel-min, 0px); padding: 12px 12px 28px; }
.mcp-panel[hidden] { display: none; }

/* --- Bausteine ------------------------------------------------------------ */
.mcp-card {
  overflow: hidden;
  border: 1px solid var(--mcp-line);
  border-radius: 14px;
  background: var(--paper);
}
.mcp-pad { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.mcp-list { padding: 14px 16px 4px; }
.mcp-sect {
  margin: 0;
  color: var(--ink-50);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.mcp-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; margin: -12px 0 -4px; }
.mcp-line { margin: 0; font-size: 15px; }
.mcp-line.is-muted,
.mcp :is(.is-muted) { color: var(--ink-50); }
.mcp-line.is-overdue { color: var(--red-deep); font-weight: 700; }
.mcp-list > .mcp-line { padding: 10px 0; }
/* Text-Knopf (V2): 32px sichtbar, 44px Treffer. Die 6px Innenabstand stehen
   ueber den Rand, damit der Text buendig bleibt. */
.mcp-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 32px;
  margin: 0 -6px;
  padding: 0 6px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
}
.mcp-link::after { content: ""; position: absolute; inset: -6px 0; }
.mcp-link:disabled { color: var(--ink-50); }
/* Knopf (V2): 40px sichtbar, 44px Treffer ueber ::after. Gefuellt rot ist
   nur "Besuch planen", die zentrale Aktion (Entscheidung PO 02.10.); alles
   andere bleibt ruhig, damit Risiko-Rot und Geplant-Blau herauskommen. */
.mcp-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border-control);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
}
.mcp-btn::after { content: ""; position: absolute; inset: -3px 0; }
.mcp-btn.is-wide { width: 100%; }
.mcp-btn.is-danger { border-color: var(--mcp-danger-line); color: var(--red-deep); }
/* "Besuch planen": rot gefuellt (weiss auf #d5222d 5,13:1). */
.mcp-btn.is-plan { border-color: var(--red-action); background: var(--red-action); color: var(--paper); }
/* "Termin": geplant ist blau (#0a5ba8 auf #edf5fc 6,20:1). */
.mcp-btn.is-termin { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.mcp-btn.is-two { flex-direction: column; gap: 1px; }
.mcp-btn.is-two small { max-width: 100%; overflow: hidden; font-size: 12px; font-weight: 600; opacity: .9; text-overflow: ellipsis; white-space: nowrap; }
.mcp-btn:disabled { cursor: not-allowed; opacity: .5; }
.mcp-btn:active:not(:disabled),
.mcp-choice:active { transform: scale(.98); }
.mcp-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
/* Uebereinander mindestens 6px, damit sich die Trefferflaechen nicht decken. */
.mcp-pad > .mcp-btn + .mcp-btn { margin-top: -4px; }
.mcp-tile {
  flex: none;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--mist);
  color: var(--ink-70);
}
.mcp-tile.is-large { width: 40px; height: 40px; border-radius: 10px; }
.mcp-tile.is-blue { background: var(--blue-soft); color: var(--blue); }

/* Warum jetzt (Runde 2, V2-Kunde-*): ein Band mit dem Grund, darunter Umsatz
   je Monat und HU je 28 Tage. Rot nur auf einer roten Seite: Band gefuellt,
   Karte mit 1,5px rotem Rand. */
.mcp-why { overflow: hidden; border: 1px solid var(--mcp-line); border-radius: 14px; background: var(--paper); }
.mcp-why.is-urgent { border: 1.5px solid var(--red-action); }
.mcp-why-band { padding: 11px 16px 12px; border-bottom: 1px solid var(--border-soft); }
.mcp-why-band .mcp-sect { display: flex; align-items: center; gap: 6px; }
.mcp-why.is-urgent .mcp-why-band { border-bottom: 0; background: var(--red-action); color: var(--paper); }
.mcp-why.is-urgent .mcp-why-band :is(.mcp-sect, .mcp-why-reason, .mcp-why-evidence) { color: var(--paper); }
.mcp-why.is-urgent .mcp-why-band .mcp-ico { stroke-width: 2.4; }
.mcp-why-reason { margin: 3px 0 0; font-size: 19px; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; }
.mcp-why-evidence { margin: 2px 0 0; color: var(--ink-70); font-size: 14px; }
.mcp-why-evidence.is-warning { font-weight: 600; }
/* Lost oder zurueckgestellt: ein Stand, kein Alarm (F-A4). */
.mcp-why.is-parked .mcp-why-band { background: var(--mist-2); }
.mcp-why-evidence.is-muted { color: var(--ink-50); }
.mcp-why-body { padding: 10px 16px 14px; }
.mcp-ch-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mcp-ch-head h4,
.mcp-hu-head h4 { margin: 0; font-size: 15px; font-weight: 800; }
.mcp-ch-head .mcp-link { margin: 0 -6px 0 0; }
.mcp-ch-sub { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 2px 0 10px; color: var(--ink-70); font-size: 14px; }
.mcp-ch-sub b { color: var(--ink); font-variant-numeric: tabular-nums; }
.mcp-ch-sub b.is-red { color: var(--red-deep); }
.mcp-legend-avg { display: inline-flex; flex: none; align-items: center; gap: 6px; color: var(--ink-70); font-size: 13px; white-space: nowrap; }
.mcp-legend-avg i { width: 18px; border-top: 2px dashed var(--ink); }
.mcp-trend { margin: 0; }
/* Sieben Spalten, rechtsbuendig: der laufende Monat ist immer die letzte. */
.mcp-plot {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  align-items: end;
  height: 104px;
  border-bottom: 1px solid var(--border-control);
}
.mcp-col { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
/* Werte mit 3px weissem Rand, die Ø-Linie laeuft dahinter. */
.mcp-v {
  position: relative;
  z-index: 2;
  margin-bottom: 2px;
  padding: 0 3px;
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mcp-v.is-red { color: var(--red-deep); }
.mcp-v.is-run { color: var(--blue); font-weight: 700; }
.mcp-b { width: 28px; max-width: 100%; border-radius: 4px 4px 0 0; background: var(--border-control); }
.mcp-b.is-red { background: var(--red-action); }
.mcp-b.is-run { background: var(--blue); }
.mcp-b.is-ghost { position: relative; border: 1.5px dashed var(--border-control); border-bottom: 0; background: transparent; }
.mcp-b-fill { position: absolute; right: -1.5px; bottom: 0; left: -1.5px; border-radius: 4px 4px 0 0; background: var(--blue); }
.mcp-avg { position: absolute; z-index: 1; right: -2px; left: -2px; height: 0; border-top: 2px dashed var(--ink); pointer-events: none; }
.mcp-tip {
  position: absolute;
  z-index: 3;
  top: -6px;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}
.mcp-months { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 5px; color: var(--ink-70); font-size: 12px; text-align: center; }
.mcp-months .is-run { color: var(--blue); font-weight: 800; }
.mcp-ch-note { margin: 8px 0 0; color: var(--ink-50); font-size: 13px; }
.mcp-hu { display: flex; flex-direction: column; gap: 5px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border-soft); }
.mcp-hu-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mcp-hu-st { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-70); font-size: 13px; font-weight: 700; text-align: right; }
.mcp-hu-st.is-red { color: var(--red-deep); }
.mcp-hu-st.is-green { color: var(--green); }
.mcp-hu-st.is-green .mcp-ico { stroke-width: 2.5; }
.mcp-hu-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) 30px; gap: 8px; align-items: center; color: var(--ink-70); font-size: 13px; }
.mcp-hu-t { height: 10px; overflow: hidden; border-radius: 0 4px 4px 0; background: var(--mcp-track); }
.mcp-hu-t i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--ink); }
.mcp-hu-t i.is-red { background: var(--red-action); }
.mcp-hu-t i.is-usual { background: var(--border-control); }
.mcp-hu-row b { color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; text-align: right; }

/* Heute erledigt: unter dem Stand der Grund, wie auf der Karte (F-A5c). Die
   Liste selbst gestaltet mobile.css. */
html.rl-mobile-mode .mobile-touched small.is-reason { color: var(--ink-70); font-weight: 500; }

.mcp-next-row { display: flex; align-items: center; gap: 12px; }
/* Offene Aufgabe unter dem Termin: eine Verlaufszeile mit Trennlinie. */
.mcp-next-task {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}
.mcp-next-task .mcp-row-sub { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.mcp-next-task.is-overdue strong { color: var(--red-deep); }
.mcp-next-row strong { font-size: 16px; }
.mcp-next-row p { margin: 0; color: var(--ink-50); font-size: 14px; }
.mcp-next-row.is-button {
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
}
.mcp-next-row.is-button > .mcp-ico:last-child { margin-left: auto; color: var(--ink-50); }
.mcp-next-text { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; }
.mcp-next-text span { color: var(--ink-50); font-size: 14px; }

/* Zeilen: Verlauf, Zuletzt, Geplant, Ansprechpartner. */
.mcp-rows { display: flex; flex-direction: column; }
.mcp-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border-soft);
  color: inherit;
  text-align: left;
}
.mcp-card:not(.mcp-recent) > .mcp-rows > .mcp-row:first-child,
.mcp-card:not(.mcp-recent) > .mcp-rows > .mcp-nested:first-child > .mcp-row:first-child { border-top: 0; }
.mcp-row.is-button {
  width: 100%;
  margin: 0;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  background: transparent;
}
.mcp-row-text { min-width: 0; }
.mcp-row-text strong { display: block; font-size: 15px; line-height: 1.3; }
.mcp-row-sub,
.mcp-row-meta { display: block; color: var(--ink-50); font-size: 13px; }
.mcp-row-sub { color: var(--ink-70); font-size: 14px; }
.mcp-row-text p { margin: 4px 0 0; font-size: 15px; overflow-wrap: anywhere; white-space: pre-line; }
.mcp-row-text p.is-clamped { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.mcp-row-text p.is-short { -webkit-line-clamp: 2; }
.mcp-row.is-overdue strong { color: var(--red-deep); }
.mcp-row.is-fresh {
  margin: 0 -16px;
  padding: 12px 16px;
  background: var(--mcp-fresh);
  animation: mcp-fresh 2.6s ease-out;
}
.mcp-row.is-fresh .mcp-tile { background: var(--amber-soft); color: var(--amber); }
@keyframes mcp-fresh { from { background: var(--amber-soft); } }
.mcp-nested { margin-left: 48px; }
.mcp-nested .mcp-row { padding: 10px 0; }
.mcp-calls-hint { margin-bottom: 4px; }
/* Der Verlauf beginnt wie im Entwurf 16px unter der Kartenkante (vorher 26). */
.mcp-list.mcp-history { padding: 4px 16px; }
/* "Anrufe zeigen": ein Text-Knopf unter der Zeile, buendig mit dem Text. */
.mcp-call-group .mcp-link { margin: 2px -6px -4px; }

.mcp-person { grid-template-columns: 36px minmax(0, 1fr) 40px; align-items: center; }
.mcp-call {
  position: relative;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-control);
  border-radius: 10px;
  color: var(--ink);
}
.mcp-call::after { content: ""; position: absolute; inset: -3px; }

.mcp-stat { padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: 12px; }
.mcp-stat span { display: block; color: var(--ink-50); font-size: 13px; font-weight: 700; }
.mcp-stat strong { display: block; font-size: 22px; letter-spacing: -.01em; }
.mcp-stat small { color: var(--ink-50); font-size: 13px; }

/* --- Verlauf -------------------------------------------------------------- */
.mcp-planned { padding: 12px 16px 4px; border-radius: 14px; background: var(--blue-soft); }
.mcp-planned .mcp-sect { color: var(--blue); }
.mcp-planned .mcp-row { border-top-color: var(--paper); }
.mcp-planned .mcp-tile { background: var(--paper); color: var(--blue); }
.mcp-filters {
  display: flex;
  gap: 8px;
  margin: -4px -12px;
  padding: 4px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.mcp-filters::-webkit-scrollbar { display: none; }
.mcp-choice {
  position: relative;
  flex: none;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-pill);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
/* ::after misst ab der Innenkante (1px Rand): -5px ergibt 44px Treffer. */
.mcp-choice::after { content: ""; position: absolute; inset: -5px 0; }
.mcp-choice[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.mcp-notice {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--amber-soft);
  color: var(--ink-70);
  font-size: 14px;
}
.mcp-list > .mcp-notice { margin: 10px 0 4px; }
.mcp-stamp {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 0 4px;
  color: var(--ink-50);
  font-size: 13px;
}

/* Laden: graue Zeilen statt "leer", nie ein leerer Zustand waehrend HubSpot
   noch antwortet. */
.mcp-rows.is-skeleton .mcp-tile { background: var(--border-soft); }
.mcp-rows.is-skeleton i {
  display: block;
  width: 55%;
  height: 12px;
  margin: 5px 0 9px;
  border-radius: 6px;
  background: var(--border-soft);
  animation: mcp-pulse 1.2s ease-in-out infinite;
}
.mcp-rows.is-skeleton i + i { width: 88%; }
@keyframes mcp-pulse { 50% { opacity: .45; } }

/* --- Ausbau (Ersatz, solange window.rlAusbau fehlt) ------------------------ */
.mcp-facts { display: flex; flex-direction: column; margin: 0; }
.mcp-facts div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border-soft); }
.mcp-facts div:first-child { border-top: 0; }
.mcp-facts dt { color: var(--ink-70); }
.mcp-facts dd { margin: 0; font-weight: 600; text-align: right; }
.mcp-ausbau { display: flex; flex-direction: column; gap: 12px; }

/* --- Berichte ------------------------------------------------------------- */
.mcp-legend { display: flex; flex-wrap: wrap; gap: 12px; color: var(--ink-50); font-size: 13px; }
/* DS-8: die Grafik in Bildschirmbreite (die letzten sechs Monate), die
   Euro-Achse links sichtbar, ohne zweiten Rahmen in der Karte. */
html.rl-mobile-mode .mcp .mcp-chart { min-height: 0; overflow: visible; border: 0; border-radius: 0; background: none; }
html.rl-mobile-mode .mcp .mcp-chart svg { width: 100%; min-width: 0; height: auto; }
html.rl-mobile-mode .mcp .mcp-chart text { font-size: 12px; }
html.rl-mobile-mode .mcp .mcp-chart .chart-bar.is-current { fill: var(--blue); }
.mcp-types { display: flex; flex-direction: column; gap: 6px; }
.mcp-types p { margin: 0; font-size: 14px; font-weight: 700; }
.mcp-types small { color: var(--ink-50); font-weight: 500; }
html.rl-mobile-mode .mcp .inspection-type-list { justify-content: flex-start; }
html.rl-mobile-mode .mcp .inspection-type-list strong { font-size: 12px; }
html.rl-mobile-mode .mcp .inspection-type-list small { font-size: 14px; }

/* Die Pruefungshistorie aus der Kundenakte, je Pruefung eine Karte statt
   einer 1120px breiten Tabelle. */
html.rl-mobile-mode .mcp .mcp-inspections { width: 100%; min-width: 0; border-collapse: separate; }
html.rl-mobile-mode .mcp .mcp-inspections thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
html.rl-mobile-mode .mcp .mcp-inspections :is(tbody, tr, td) { display: block; }
html.rl-mobile-mode .mcp .mcp-inspections tr {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "date type net"
    "result result report"
    "defects defects defects"
    "station station inspector";
  align-items: center;
  gap: 4px 10px;
  padding: 12px 0;
  border-top: 1px solid var(--border-soft);
}
html.rl-mobile-mode .mcp .mcp-inspections tr:first-child { border-top: 0; }
html.rl-mobile-mode .mcp .mcp-inspections td {
  min-width: 0;
  max-width: none;
  height: auto;
  padding: 0;
  border: 0;
  font-size: 14px;
}
html.rl-mobile-mode .mcp .mcp-inspections td:nth-child(1) { grid-area: date; font-weight: 700; }
html.rl-mobile-mode .mcp .mcp-inspections td:nth-child(2) { grid-area: report; justify-self: end; }
html.rl-mobile-mode .mcp .mcp-inspections td:nth-child(3) { grid-area: type; }
html.rl-mobile-mode .mcp .mcp-inspections td:nth-child(4) { grid-area: result; color: var(--ink-70); }
html.rl-mobile-mode .mcp .mcp-inspections td:nth-child(5) { grid-area: defects; }
html.rl-mobile-mode .mcp .mcp-inspections td:nth-child(5)::before { content: "Mängel: "; color: var(--ink-50); }
html.rl-mobile-mode .mcp .mcp-inspections td:nth-child(6) { grid-area: net; font-weight: 700; text-align: right; }
html.rl-mobile-mode .mcp .mcp-inspections td:nth-child(7) { grid-area: station; color: var(--ink-50); font-size: 13px; }
html.rl-mobile-mode .mcp .mcp-inspections td:nth-child(8) { grid-area: inspector; color: var(--ink-50); font-size: 13px; text-align: right; }
html.rl-mobile-mode .mcp .mcp-inspections td[colspan] { grid-column: 1 / -1; grid-row: 1; font-weight: 400; }
html.rl-mobile-mode .mcp .mcp-inspections .report-number--link {
  height: auto;
  min-height: 40px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--border-control);
  border-radius: 10px;
  background: var(--paper);
  font-size: 13px;
}
html.rl-mobile-mode .mcp .mcp-inspections .report-number--link::after { content: "\00a0· PDF"; }

/* --- Daumenleiste (Runde 2, V2-Bar, Entscheidung PO 02.10.) -------------- */
/* Navi und Anrufen als Symbol (44x44), Platz 3 plant (Besuch planen rot,
   Termin blau), Platz 4 Meeting. Die Spalten stehen fest: Kommt ein Termin
   erst aus HubSpot, wechselt Platz 3 an Ort und Stelle. */
.mcp-thumb {
  flex: none;
  display: grid;
  grid-template-columns: 44px 44px minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 12px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--mcp-line);
  background: var(--paper);
}
.mcp-thumb .mcp-btn { min-width: 0; min-height: 44px; padding: 0 12px; font-size: 15px; }
.mcp-thumb .mcp-btn::after { inset: 0; }
.mcp-thumb .mcp-btn.is-two { padding: 0 8px; line-height: 1.05; }
.mcp-ib {
  position: relative;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border-control);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
}
.mcp-ib.is-off { border-color: var(--border); background: var(--mist); color: var(--ink-off); cursor: not-allowed; }
html.rl-keyboard-open .mcp-thumb { display: none; }

/* --- Weitere Aktionen (Blatt von unten, in Daumenreichweite) -------------- */
html.rl-mobile-mode .mcp-menu[open] {
  width: min(100%, 620px);
  max-width: none;
  max-height: 88dvh;
  margin: auto auto 0;
  padding: 0 16px max(16px, env(safe-area-inset-bottom));
  overflow-y: auto;
  border: 0;
  border-radius: 20px 20px 0 0;
  background: var(--paper);
  box-shadow: 0 -10px 30px rgba(20, 30, 40, .18);
  animation: mcp-up 180ms cubic-bezier(.2, .8, .2, 1);
}
html.rl-mobile-mode .mcp-menu::backdrop { background: rgba(20, 30, 40, .48); }
@keyframes mcp-up { from { transform: translateY(24px); opacity: .6; } }
.mcp-grip { width: 40px; height: 5px; margin: 8px auto 4px; border-radius: 3px; background: var(--mcp-grip); }
.mcp-menu-title { margin: 6px 0 8px; color: var(--ink-50); font-size: 14px; font-weight: 700; text-align: center; }
.mcp-menu-list { display: flex; flex-direction: column; }
.mcp-menu-list > :is(button, a) {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 4px;
  border: 0;
  border-top: 1px solid var(--border-soft);
  background: none;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
}
.mcp-menu-list > :first-child { border-top: 0; }
.mcp-menu-close { margin-top: 10px; }
.mcp-termin[open] { display: flex; flex-direction: column; gap: 12px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.mcp-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mcp-sheet-head h2 { margin: 0; font-size: 20px; line-height: 1.2; letter-spacing: -.015em; outline: none; }
.mcp-sheet-head p { margin: 0; color: var(--ink-50); font-size: 14px; }
.mcp-sheet-close {
  flex: none;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--mist);
  color: var(--ink);
}
.mcp-termin .mcp-next-row strong { font-size: 15px; }
.mcp-termin-doc { align-self: center; margin-top: 2px; }

@media (prefers-reduced-motion: reduce) {
  html.rl-mobile-mode :is(.mcp, .mcp-menu)[open],
  .mcp-row.is-fresh,
  .mcp-rows.is-skeleton i { animation: none; }
  .mcp-bar-title { transition: none; }
}
