/* =========================================================
   MALERPLUS • MAIL CENTER
   MP-20260915-027 · Postausgang, Leser, Composer im MalerPlus-Design
   MP-20260916-003 · Angleichung an #view-kva / #view-rechnung:
     - KEINE eigenen Regeln fuer .mp-record-row, Monatsgruppen, Master-Rail,
       View-Geometrie oder Kartenkoepfe: das kommt aus css/mp-list-workspaces-
       golden.css, css/mp-aufmass-layout-contract.css, css/mp-ui-final-
       hardwall.css und css/mp-kartenkopf-standard.css (Selektoren dort um
       #view-mail erweitert).
     - Runde 7 (Spezifikation Ida Neumann, 16.09.): KEIN `#view-mail.view
       {position:relative}` mehr — das hob den App-Standard (layout.css
       `.view{position:absolute;inset:0;overflow:auto}`) auf, die Ansicht
       wuchs auf Inhaltshoehe und konnte nicht scrollen. Keine
       `border-radius:999px`, keine `.btn-*`-Overrides (Hausregeln):
       Knoepfe sind reine .btn-primary/.btn-secondary, Pillen sind
       .mp-record-filter-pill (12 px Radius), Formular ist .form-grid/.form-group.
     - Keine Emojis: Symbole sind Inline-SVG (.mp-mail-btn-ico).
   ========================================================= */

/* ── Symbol in Knoepfen und Pillen ── */
#view-mail .mp-mail-btn-ico,
.mp-mail-pdf-modal .mp-mail-btn-ico {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  vertical-align: -2px;
}

#view-mail .btn-primary,
#view-mail .btn-secondary,
#view-mail .mp-mail-meta-book-tag,
#view-mail .mp-record-filter-pill,
.mp-mail-pdf-modal .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

/* Modulkopf: der Basis-.view-header (layout.css) stapelt in Spalten;
   Angebote/Rechnungen fuehren Titel und Aktionen in einer Zeile mit Umbruch. */
#view-mail .view-header.mp-module-view-header {
  flex-direction: row;
  flex-wrap: wrap;
}
#view-mail .view-header.mp-module-view-header > .mp-module-header-title {
  /* Basis 260 px mit Einheit: `flex: 1 1 0` verwirft Chrome; bei 768 px
     Hochformat brechen die Aktionen so unter den Titel (wie Rechnungen),
     ab 1024 bleibt der Kopf einzeilig 120 px. */
  flex: 1 1 260px !important;
  min-width: 0;
}

/* ══════════════════════════════════════════════════════════
   CARD 2: NACHRICHT (Leser)
   Kopf und Karte: Kartenkopf-Standard + Golden-Kartenlook.
   Body: .form-grid mit .mp-document-form-section-Abschnitten (Hardwall-
   Kontrakt), jeder Inhaltsblock spannt die volle Rasterbreite.
   ══════════════════════════════════════════════════════════ */
#view-mail .mail-reader-card {
  display: flex;
  flex-direction: column;
}

#view-mail .mp-mail-reader-subject {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Aktionsgruppe im Kartenkopf: Deckel, damit die Auto-Spalte des Kopf-
   Rasters die Betreffspalte nicht auf 2 px drueckt (4 Knoepfe = 553 px). */
#view-mail .mp-mail-reader-actions {
  max-width: 380px;
}

#view-mail .mp-mail-block {
  grid-column: 1 / -1;
  min-width: 0;
}

/* Leerzustand: keine Nachricht ausgewaehlt */
#view-mail .mp-mail-reader-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 36px 20px 40px;
  text-align: center;
}
#view-mail .mp-mail-reader-empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 4px;
  border-radius: 16px;
  background: rgba(2, 132, 199, .1);
  color: #0369a1;
}
#view-mail .mp-mail-reader-empty-icon svg {
  width: 24px;
  height: 24px;
}
#view-mail .mp-mail-reader-empty strong {
  color: rgb(var(--mp-t1-172033, 15, 23, 42));
  font-size: 15px;
  font-weight: 750;
}
#view-mail .mp-mail-reader-empty > span {
  color: rgb(var(--mp-t3-718095, 100, 116, 139));
  font-size: 13px;
  max-width: 360px;
}
#view-mail .mp-mail-reader-empty .btn-secondary {
  margin-top: 10px;
}

/* 1 · Umschlag */
#view-mail .mp-mail-envelope-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}

#view-mail .mp-mail-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .02em;
  flex-shrink: 0;
}

#view-mail .mp-mail-meta-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

#view-mail .mp-mail-meta-from-to {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  flex-wrap: wrap;
}

#view-mail .mp-mail-meta-sender {
  color: rgb(var(--mp-t3-718095, 100, 116, 139));
  font-weight: 500;
}

#view-mail .mp-mail-meta-arrow {
  display: inline-grid;
  place-items: center;
  color: rgba(100, 116, 139, .55);
}
#view-mail .mp-mail-meta-arrow svg {
  width: 13px;
  height: 13px;
}

#view-mail .mp-mail-meta-recipient {
  color: rgb(var(--mp-t1-172033, 15, 23, 42));
  font-weight: 750;
}

#view-mail .mp-mail-meta-email {
  color: rgb(var(--mp-t3-718095, 100, 116, 139));
  font-size: 12.5px;
  font-weight: 400;
}

#view-mail .mp-mail-meta-book-tag {
  background: rgba(15, 23, 42, .04);
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 8px;
  padding: 2px 8px;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: rgb(var(--mp-t2-253247, 51, 65, 85));
  cursor: pointer;
  margin-left: 4px;
}
#view-mail .mp-mail-meta-book-tag .mp-mail-btn-ico {
  width: 12px;
  height: 12px;
  flex-basis: 12px;
}
#view-mail .mp-mail-meta-book-tag:hover {
  background: rgba(15, 23, 42, .08);
}

#view-mail .mp-mail-meta-subline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgb(var(--mp-t3-718095, 100, 116, 139));
  flex-wrap: wrap;
}

#view-mail .mp-mail-meta-dot {
  color: rgba(100, 116, 139, .5);
}

#view-mail .mp-mail-status-badge-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* 2 · Zustellung & Angebotsradar */
#view-mail .mp-mail-radar-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(2, 132, 199, .05);
  border: 1px solid rgba(2, 132, 199, .15);
  border-radius: 12px;
  font-size: 12.5px;
  flex-wrap: wrap;
}

#view-mail .mp-mail-radar-strip-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: rgba(2, 132, 199, .12);
  color: #0369a1;
  flex-shrink: 0;
}
#view-mail .mp-mail-radar-strip-icon svg {
  width: 16px;
  height: 16px;
}

#view-mail .mp-mail-radar-strip-content {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: #0369a1;
  min-width: 200px;
  flex-wrap: wrap;
}

#view-mail .mp-mail-radar-stats-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

#view-mail .mp-mail-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgb(var(--mp-flaeche-rgb, 255, 255, 255));
  border: 1px solid rgba(2, 132, 199, .2);
  font-size: 11px;
  font-weight: 700;
  color: #0284c7;
}
#view-mail .mp-mail-stat-pill svg {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
}

/* 3 · Nachricht */
#view-mail .mp-mail-letter-paper {
  background: rgb(var(--mp-flaeche-rgb, 255, 255, 255));
  padding: 20px 22px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, .06);
}

#view-mail .mp-mail-message-content {
  font-size: 14.5px;
  line-height: 1.65;
  color: rgb(var(--mp-t1-172033, 15, 23, 42));
  white-space: pre-wrap;
  word-break: break-word;
}

/* 4 · Anhang */
#view-mail .mp-mail-attach-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  background: rgb(var(--mp-f2-f5f7fa, 248, 250, 252));
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 12px;
  flex-wrap: wrap;
}

#view-mail .mp-mail-attach-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(2, 132, 199, .1);
  color: #0369a1;
  flex-shrink: 0;
}
#view-mail .mp-mail-attach-icon svg {
  width: 20px;
  height: 20px;
}

#view-mail .mp-mail-attach-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 180px;
}

#view-mail .mp-mail-attach-title {
  font-size: 13.5px;
  font-weight: 750;
  color: rgb(var(--mp-t1-172033, 15, 23, 42));
}

#view-mail .mp-mail-attach-sub {
  font-size: 12px;
  color: rgb(var(--mp-t3-718095, 100, 116, 139));
}

#view-mail .mp-mail-attach-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════
   CARD 3: VERFASSEN (Composer) — App-Formular
   ══════════════════════════════════════════════════════════ */
#view-mail .mail-composer-card {
  display: flex;
  flex-direction: column;
}

#view-mail .mp-mail-composer-head-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Jedes Feld ist eine volle Zeile (An/Betreff/Text sind nie zweispaltig). */
#view-mail #mailComposerForm .mp-mail-form-full {
  grid-column: 1 / -1;
  min-width: 0;
}

/* Touch-Ziele 44 px (der Hardwall-Dichtevertrag ist an KVA/Rechnung gebunden). */
#view-mail #mailComposerForm input:not([type="checkbox"]):not([type="radio"]),
#view-mail #mailComposerForm select {
  min-height: 44px;
}
#view-mail #mailComposerForm textarea {
  min-height: 180px;
  resize: vertical;
}

/* An-Zeile: Eingabe + Telefonbuch nebeneinander */
#view-mail .mp-mail-to-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}
#view-mail .mp-mail-to-row .btn-secondary {
  flex-shrink: 0;
}

#view-mail .mp-composer-recipient-box {
  flex: 1;
  position: relative;
  min-width: 0;
}
#view-mail .mp-composer-recipient-box input {
  width: 100%;
  box-sizing: border-box;
}

/* Autocomplete */
#view-mail .mp-composer-autocomplete {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 100;
  background: rgb(var(--mp-flaeche-rgb, 255, 255, 255));
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, .12);
  box-shadow: 0 10px 30px rgba(15, 23, 42, .15);
  max-height: 240px;
  overflow-y: auto;
}

#view-mail .mp-autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(15, 23, 42, .05);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#view-mail .mp-autocomplete-item:hover {
  background: rgb(var(--mp-f2-f5f7fa, 248, 250, 252));
}
#view-mail .mp-autocomplete-name {
  font-weight: 700;
  font-size: 13px;
  color: rgb(var(--mp-t1-172033, 15, 23, 42));
}
#view-mail .mp-autocomplete-contact {
  font-size: 12px;
  color: rgb(var(--mp-t3-718095, 100, 116, 139));
}

/* Details-Chips nach Auswahl (12 px Radius, keine Pille) */
#view-mail .mp-composer-meta-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

#view-mail .mp-composer-chip {
  padding: 4px 10px;
  background: rgba(2, 132, 199, .08);
  border: 1px solid rgba(2, 132, 199, .2);
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 650;
  color: #0369a1;
}

#view-mail .mp-composer-chip-clear {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgb(var(--mp-t3-718095, 100, 116, 139));
  padding: 0;
  border-radius: 8px;
}
#view-mail .mp-composer-chip-clear svg {
  width: 12px;
  height: 12px;
}
#view-mail .mp-composer-chip-clear:hover {
  background: rgba(15, 23, 42, .08);
}

/* Kanal- und Vorlagen-Pillen: .mp-record-filter-pill (App-Standard) */
#view-mail .mp-mail-pill-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Anhang */
#view-mail .mp-composer-attach-area {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

#view-mail .mp-composer-attach-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgb(var(--mp-f2-f5f7fa, 248, 250, 252));
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 650;
  color: rgb(var(--mp-t1-172033, 15, 23, 42));
}

#view-mail .mp-attach-remove {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgb(var(--mp-t3-718095, 100, 116, 139));
  padding: 0;
  border-radius: 6px;
}
#view-mail .mp-attach-remove svg {
  width: 11px;
  height: 11px;
}
#view-mail .mp-attach-remove:hover {
  color: #dc2626;
}

/* Fußleiste: Anordnung; die Knoepfe selbst sind reine Standardknoepfe. */
#view-mail .mp-mail-composer-footer {
  padding: 16px 26px;
  background: rgb(var(--mp-f2-f5f7fa, 248, 250, 252));
  border-top: 1px solid rgba(15, 23, 42, .06);
  border-radius: inherit;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

#view-mail .mp-composer-footer-left,
#view-mail .mp-composer-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* WhatsApp-Akzent nur als Symbol-/Textfarbe auf Standardknoepfen */
#view-mail .btn-whatsapp-subtle,
#view-mail .btn-whatsapp-send {
  color: #059669;
}
#view-mail .btn-followup-subtle {
  color: #c2410c;
}

/* Schmale Breiten */
@media (max-width: 767px) {
  #view-mail .mp-mail-to-row {
    flex-wrap: wrap;
  }
  #view-mail .mp-mail-to-row .mp-composer-recipient-box {
    flex-basis: 100%;
  }
  #view-mail .mp-mail-letter-paper {
    padding: 16px;
  }
  #view-mail .mp-mail-composer-footer {
    padding: 14px 16px;
  }
}

/* ══════════════════════════════════════════════════════════
   PDF-VORSCHAU (Modal)
   ══════════════════════════════════════════════════════════ */
.mp-mail-pdf-modal {
  position: fixed;
  inset: 0;
  /* Lena Berger F-1 (16.09.): die Master-Leiste des Golden-Layouts liegt auf
     z-index 4680, das Dock auf 4690 (Z-Skala in mp-list-workspaces-golden.css).
     Ein Modul-Overlay muss darueber liegen, sonst verdeckt die Leiste
     150 px der Vorschau. Rueckfragen (100000) bleiben darueber. */
  z-index: 4700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.mp-mail-pdf-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.mp-mail-pdf-modal-content {
  position: relative;
  z-index: 1;
  width: min(900px, 94vw);
  height: min(85vh, 850px);
  background: rgb(var(--mp-flaeche-rgb, 255, 255, 255));
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mp-mail-pdf-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(15, 23, 42, .08);
  background: rgb(var(--mp-f2-f5f7fa, 245, 247, 250));
}

.mp-mail-pdf-modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  color: rgb(var(--mp-t1-172033, 15, 23, 42));
}

.mp-mail-pdf-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mp-mail-pdf-modal-close {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--mp-muted, #64748b);
  padding: 0;
  border-radius: 8px;
}
.mp-mail-pdf-modal-close svg {
  width: 14px;
  height: 14px;
}
.mp-mail-pdf-modal-close:hover {
  background: rgba(15, 23, 42, .06);
  color: rgb(var(--mp-t1-172033, 15, 23, 42));
}

.mp-mail-pdf-modal-body {
  flex: 1;
  min-height: 0;
  position: relative;
}

.mp-mail-pdf-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* MP-20260917-006: Canvas-Fallback (pdf.js) für Geräte ohne eingebauten
   PDF-Betrachter im iframe (z. B. Android Chrome). */
.mp-mail-pdf-canvas-view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: rgb(var(--mp-f2-f5f7fa, 245, 247, 250));
}
.mp-mail-pdf-canvas-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font: 500 13px/1.4 var(--mp-font, inherit);
  color: var(--mp-muted, #64748b);
}
.mp-mail-pdf-canvas-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(15, 23, 42, .14);
  border-top-color: #2bb0ff;
  border-radius: 50%;
  animation: mp-usheet-spin .7s linear infinite;
}
.mp-mail-pdf-canvas-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  overflow: auto;
  padding: 12px;
  box-sizing: border-box;
}
.mp-mail-pdf-canvas-wrap canvas {
  max-width: 100%;
  height: auto;
  /* MP-20260917-041, Lenas Befund R-1 (ROT): Der Behälter darüber ist ein
     Flex-Kasten ohne `align-items` — das ist `normal`, wirkt hier wie
     `stretch` und zieht das Canvas auf die volle Behälterhöhe. `height:auto`
     kommt dagegen nicht an, weil stretch genau dann greift, wenn die
     Kreuzachsen-Größe `auto` ist.
     Solange das Canvas KEINE Inline-Breite hatte, fiel das nicht auf: der
     Browser leitete die Breite aus der gestreckten Höhe und dem inneren
     Seitenverhältnis ab, das Bild blieb proportional (nur eben zu klein
     gerastert). Seit die Breite per `style.width` festgenagelt wird, folgt
     die Höhe weiter dem Behälter — und das Dokument wird verzerrt.
     Gemessen (Lena): 1440/dpr1 876x607 statt 876x1238 = +104 % zu breit,
     1024/dpr2 +78,8 %. Mit `align-self:flex-start` sind es 876x1238.
     Der Fehler war der Anlage nach schon vorher da (390/dpr3 -17,6 %) und
     wird hiermit zugleich mitbehoben. */
  align-self: flex-start;
  box-shadow: 0 4px 18px rgba(15, 23, 42, .16);
  background: #fff;
}
.mp-mail-pdf-canvas-nav {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 16px;
  border-top: 1px solid rgba(15, 23, 42, .08);
  background: rgb(var(--mp-flaeche-rgb, 255, 255, 255));
}
.mp-mail-pdf-canvas-navbtn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: rgb(var(--mp-f2-f5f7fa, 245, 247, 250));
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: 8px;
  cursor: pointer;
  color: rgb(var(--mp-t1-172033, 15, 23, 42));
  padding: 0;
}
.mp-mail-pdf-canvas-navbtn svg { width: 16px; height: 16px; }
.mp-mail-pdf-canvas-navbtn:disabled {
  opacity: .35;
  cursor: default;
}
.mp-mail-pdf-canvas-navbtn:not(:disabled):hover {
  background: rgba(43, 176, 255, .12);
  border-color: rgba(43, 176, 255, .4);
}
.mp-mail-pdf-canvas-pageinfo {
  font: 600 13px/1 var(--mp-font, inherit);
  color: rgb(var(--mp-t1-172033, 15, 23, 42));
  min-width: 76px;
  text-align: center;
}
.mp-mail-pdf-canvas-error {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  font: 500 13px/1.5 var(--mp-font, inherit);
  color: var(--mp-muted, #64748b);
}

/* ---------------------------------------------------------------------
   MP-20260916-003 Runde 12 · Suchfeld in der Master-Rail wie Angebote.
   Marcel 16.09.: "hier haben wir irgendwie 2 Rahmen". Ursache: Angebote
   bekommen ihr Suchfeld aus css/mp-views-premium.css:1491
   (#view-kva input[type="search"]: Rand #E5E7EB, Radius 12px), das genau
   auf dem 14px-Zeilenrahmen aus mp-list-workspaces-golden.css:406 liegt.
   Im Mail Center gewann stattdessen die 999px-Pille aus mp-app-shell-v2.css,
   die sich an den Ecken sichtbar vom Zeilenrahmen loest. Gleiche Werte wie
   Angebote, gleiche Wirkung: ein Rahmen.
   --------------------------------------------------------------------- */
#view-mail .mp-workspace-list-master .mp-list-search-input {
  border: 1px solid #E5E7EB !important;
  border-radius: 12px !important;
  background: rgb(var(--mp-flaeche-rgb)) !important;
  box-shadow: 0 1px 2px rgba(15,23,42,.03);
  transition: border-color .15s ease, box-shadow .15s ease;
}
#view-mail .mp-workspace-list-master .mp-list-search-input:focus {
  outline: none !important;
  border-color: #1f9eef !important;
  box-shadow: 0 0 0 3px rgba(31,158,239,.18) !important;
}
/* MP-20260916-018 (Lena, Runde 12): Dunkelmodus wie #view-kva (dark-mode.css gibt
   dem Angebots-Suchfeld dort Rand rgba(255,255,255,.1) auf Grund rgba(0,0,0,.22)). */
html.dark #view-mail .mp-workspace-list-master .mp-list-search-input {
  border-color: rgba(255,255,255,.1) !important;
  background: rgba(0,0,0,.22) !important;
  box-shadow: none;
}

/* ---------------------------------------------------------------------
   MP-20260916-053 · Die Liste nutzt die volle Höhe der Leiste.
   Marcel 16.09.: „Der Inhalt, wo die Briefe stehen, nutzt nicht das ganze
   Seitenfenster … beim Aufmaß haben wir es hinbekommen, dass der Inhalt bis
   unten hingeht."

   Gemessen (Staging, 1440, 40 Nachrichten): Das Mail Center rendert die Liste
   zweistufig — der Wirt `#mailGroupedList` trägt selbst die Klasse
   `.mp-record-list--v2` und darin liegt nochmals eine `.mp-record-list`.
   Die Regel `css/mp-list-workspaces-golden.css:567` gibt jeder dieser Ebenen
   `padding: 0 2px 120px`, das Polster zählt also DOPPELT. Bei Angeboten trägt
   der Wirt keine Klasse, dort greift es nur einmal.
   Folge: der scrollende Bereich war 449 statt 569 px hoch, vier statt fünf
   Zeilen sichtbar, darunter leerer Raum.

   Nur das doppelte Polster wird zurückgenommen; die innere Liste behält ihre
   120 px Luft unter der letzten Zeile (Dock), genau wie bei Angeboten.
   --------------------------------------------------------------------- */
#view-mail #mailGroupedList.mp-record-list--v2:has(> .mp-record-list) {
  padding-bottom: 0 !important;
}

/* ---------------------------------------------------------------------
   MP-20260916-065 · Vorlagen- und Kanalwahl als echte Pillen.
   Marcel 16.09. (Bild aus dem Composer): „Diesem Bereich hier müssen wir
   auf jeden Fall noch optisch ein bisschen geiler gestalten." Die fünf
   Textbausteine trugen zwar die Klasse .mp-record-filter-pill, aber im
   Composer gab es dafür keine Regel — sie sahen aus wie nackte Links.
   Jetzt dieselbe Sprache wie die Status-Filter der Listen, nur eine Spur
   größer, weil hier bewusst gewählt wird.
   --------------------------------------------------------------------- */
#view-mail .mp-mail-pill-row {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  margin-top: 2px;
}

#view-mail .mp-mail-pill-row > .mp-record-filter-pill {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  min-height: 38px !important;
  padding: 8px 15px !important;
  border: 1px solid rgba(15, 23, 42, .1) !important;
  border-radius: 999px !important;
  background: linear-gradient(180deg, rgba(255,255,255,.96) 0%, rgba(248,250,252,.82) 100%) !important;
  color: rgb(var(--mp-t2-334155)) !important;
  font-family: inherit !important;
  font-size: 13.5px !important;
  font-weight: 620 !important;
  letter-spacing: -.005em !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04) !important;
  transition: background .14s ease, border-color .14s ease, color .14s ease, transform .1s ease, box-shadow .14s ease !important;
  -webkit-tap-highlight-color: transparent;
}

#view-mail .mp-mail-pill-row > .mp-record-filter-pill:hover {
  border-color: rgba(43, 176, 255, .42) !important;
  background: rgba(43, 176, 255, .07) !important;
  color: rgb(var(--mp-t1-172033)) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 10px -3px rgba(43, 176, 255, .3) !important;
}
#view-mail .mp-mail-pill-row > .mp-record-filter-pill:active { transform: translateY(0) !important; }

/* Gewählt: gefüllt wie der aktive Listen-Filter, damit auf einen Blick
   erkennbar ist, welcher Textbaustein im Betreff und im Text steht. */
#view-mail .mp-mail-pill-row > .mp-record-filter-pill.is-active,
#view-mail .mp-mail-pill-row > .mp-record-filter-pill[aria-pressed="true"] {
  border-color: transparent !important;
  background: linear-gradient(135deg, #2bb0ff 0%, #1d8de0 100%) !important;
  color: #fff !important;
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 6px 16px -5px rgba(43, 176, 255, .55) !important;
}
#view-mail .mp-mail-pill-row > .mp-record-filter-pill.is-active:hover,
#view-mail .mp-mail-pill-row > .mp-record-filter-pill[aria-pressed="true"]:hover {
  filter: brightness(1.04);
  transform: translateY(-1px) !important;
}
#view-mail .mp-mail-pill-row > .mp-record-filter-pill:focus-visible {
  outline: 2px solid #2bb0ff !important;
  outline-offset: 2px !important;
}

/* Die Beschriftung darüber ruhiger und klar als Gruppentitel lesbar. */
#view-mail #mailComposerForm .mp-mail-form-full > label {
  display: block;
  margin-bottom: 8px;
  color: rgb(var(--mp-t3-64748b));
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

html.dark body #view-mail .mp-mail-pill-row > .mp-record-filter-pill {
  border-color: rgba(255, 255, 255, .1) !important;
  background: linear-gradient(180deg, rgba(30,41,59,.78) 0%, rgba(15,23,42,.62) 100%) !important;
  color: #cbd5e1 !important;
}
html.dark body #view-mail .mp-mail-pill-row > .mp-record-filter-pill:hover {
  border-color: rgba(61, 180, 245, .4) !important;
  background: rgba(61, 180, 245, .16) !important;
  color: #f1f5f9 !important;
}
html.dark body #view-mail .mp-mail-pill-row > .mp-record-filter-pill.is-active,
html.dark body #view-mail .mp-mail-pill-row > .mp-record-filter-pill[aria-pressed="true"] {
  background: linear-gradient(135deg, #3db4f5, #5dc4f9) !important;
  color: #fff !important;
}

/* ---------------------------------------------------------------------
   MP-20260917-040 · Auf dem Handy nur EIN Polster unter der Liste, und
   ein kleines.

   Marcel hat denselben Zustand zweimal gemeldet — 17.09. („Da wird der
   Content nicht bis ganz unten hingefuellt.") und 19:13 („Immer noch die
   Liste nicht korrekt."). Lena hatte ihn als MP-20260916-061 notiert.

   ZWEI URSACHEN UEBEREINANDER:
   1. Doppeltes Polster. Die Handy-Regel in css/mp-list-workspaces-golden.css
      gibt dem Wirt #mailGroupedList 140 px. Bei Angeboten und Rechnungen
      ist das richtig, weil der Wirt dort die EINZIGE Listenebene ist. Im
      Mail Center liegt darin nochmals eine .mp-record-list mit eigenen
      120 px — macht 260 px.
   2. Das Polster selbst war zu gross. Gemessen auf Staging (390x844,
      Liste eingeblendet, ans Ende gescrollt): das Dock beginnt bei y=720,
      der Scroller endet bei y=719. Der Scroller liegt also BEREITS
      vollstaendig ueber dem Dock; die Kartenraender (card-body 16 px +
      wrapper 6 px + Karte-zu-Dock 8 px) halten ihn dort. Die 140 px waren
      reine Leerflaeche unter der letzten Zeile.

   WIRKNACHWEIS (Lena Berger, unabhaengig nachgemessen, A/B mit
   Rueckstellung): 162,8 px -> 12,4 px im Scroller, sichtbar 56,4 px statt
   rund 207 px. Letzte Zeile 14,4 px ueber dem Dock und an 3 von 3
   Pruefpunkten antippbar. 360x800, 390x844 und 430x932 identisch.

   WARUM KEIN :has() MEHR (Lenas Befund B-3): die fruehere Fassung setzte
   das Wirt-Polster nur bei :has(> .mp-record-list) auf 0. Ohne
   :has()-Unterstuetzung blieben 140 px stehen — und im Leerzustand griff
   die Regel gar nicht. Der Wirt traegt hier nie selbst Zeilen, also
   bekommt er das Polster unbedingt abgenommen.

   :last-child UND :last-of-type (Lenas Befund F-1): kaeme spaeter ein
   Ladeknopf oder ein Sentinel hinter die letzte Jahresgruppe, fiele
   :last-child wortlos aus. Zwei Schreibweisen decken beide Faelle.

   ENTFERNT (Lenas Befund B-2): der Vorgaengerblock setzte auf DENSELBEN
   Selektor 140 px und wurde eine Zeile spaeter ueberschrieben — eine tote
   Regel, die beim Lesen in die Irre fuehrt. Und sein Kommentar sagte
   24 px, waehrend im Code 12 px standen.
   --------------------------------------------------------------------- */
@media (max-width: 767px) {
  html body #view-mail.view.active > .mp-workspace-list-master #mailGroupedList {
    padding-bottom: 0 !important;
  }
  html body #view-mail.view.active > .mp-workspace-list-master #mailGroupedList > .mp-record-list {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
  }
  /* Die LETZTE Gruppe braucht keine Untermarge — darunter kommt nichts.
     Gemessen: 8 px (Jahr) + 14 px (Monat) = 22 px reine Leerflaeche. */
  html body #view-mail.view.active > .mp-workspace-list-master #mailGroupedList > .mp-record-list > .mp-record-year:last-child,
  html body #view-mail.view.active > .mp-workspace-list-master #mailGroupedList > .mp-record-list > .mp-record-year:last-of-type {
    margin-bottom: 0 !important;
  }
  html body #view-mail.view.active > .mp-workspace-list-master #mailGroupedList > .mp-record-list > .mp-record-year:last-child > .mp-record-month:last-child,
  html body #view-mail.view.active > .mp-workspace-list-master #mailGroupedList > .mp-record-list > .mp-record-year:last-of-type > .mp-record-month:last-of-type {
    margin-bottom: 0 !important;
  }
}
