/* =========================================================
   MALERPLUS • PROJEKT BAUTAGEBUCH & REGIEBERICHTE (MP-20260920-037)
   Striktes Zero-Emoji-Gebot: Ausschließlich saubere MalerPlus SVGs

   MP-20260921-002 (Jonas Falk, nach Design-Spezifikation Ida Neumann):
   Auf den Token-Vertrag umgestellt — vorher 117 hartkodierte Hex-Farben
   gegen 4 Token-Aufrufe, keine einzige Dunkelmodus-Regel (Modul kam in
   css/mp-dark-contract.css an keiner Stelle vor). Alle Farben laufen jetzt
   über var(--mp-...) aus css/mp-dark-contract.css / css/design-system.css —
   dadurch Dunkelmodus ohne eine einzige komponentenspezifische Dark-Regel
   in dieser Datei (Vertrag: css/mp-dark-contract.css).

   Bewusst NICHT geändert (siehe Handoff docs/ai-company/handoffs/
   2026-09-21-MP-20260921-002-jonas-stufe1-umsetzung.md):
     - Radius 999px an Pills/Badges: entspricht dem app-weiten Bestand
       (.mp-badge, .mp-record-filter-pill) — Koordinator-Entscheidung K-719,
       nicht in diesem Vorgang geändert.
     - KPI-Karten, Suchfeld-Zeile: Markup in projekt-bautagebuch.js nutzt
       jetzt .mp-kpi-tile (css/mp-kpi-standard.css); die alten
       .mp-btb-kpi-card-Regeln sind deshalb entfernt.
     - .mp-btb-actions-wrap/.mp-btb-toolbtn sind entfernt: die Aktionen
       "Vortag übernehmen"/"PDF Export"/"Tagesbericht erfassen" sitzen jetzt
       ausschließlich im Kartenkopf (projekte.html #projBautagebuchCard
       .mp-header-actions), P2-4 doppeltes Knopfdeck behoben.
   ========================================================= */

.mp-bautagebuch-card {
  position: relative;
}

.mp-btb-body {
  padding: 16px;
  background: var(--mp-bg);
  border-radius: 0 0 14px 14px;
  min-height: 220px;
}

.mp-btb-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mp-btb-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--mp-muted);
  font-size: 14px;
  line-height: 1.6;
}

/* ─── 1. KPI-ZEILE — Haus-Standard .mp-kpi-tile (css/mp-kpi-standard.css) ───
   Diese Datei regelt nur das Raster, die Kachel-Optik kommt vollständig aus
   dem KPI-Standard. Die drei Zustandsfarben (Gesamtstunden/Behinderungen)
   sind eine kleine Modul-Regel, weil mp-kpi-standard.css bewusst KEINE
   Bedeutungsfarbe vorschreibt (`[class*="mp-kpi--"]` nimmt die Kachel nur
   von der neutralen Farbe aus). */
.mp-btb-kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

/* MP-20261004-023: Wortumbruch-Fragmente (z.B. FOTODOKUMENTATIO / N) dauerhaft unterbinden */
.mp-btb-kpis-grid .mp-kpi-label {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  letter-spacing: .05em !important;
}

#projBautagebuchBody .mp-kpi-tile.mp-kpi--info .mp-kpi-value {
  color: var(--mp-accent);
}

#projBautagebuchBody .mp-kpi-tile.mp-kpi--danger .mp-kpi-value {
  color: var(--mp-danger);
}

#projBautagebuchBody .mp-kpi-tile.mp-kpi--success .mp-kpi-value {
  color: var(--mp-success);
}

/* ─── 2. TOOLBAR (nur Suche + Filter) ─── */
.mp-btb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--mp-card);
  border: 1px solid var(--mp-border);
  border-radius: 10px;
  padding: 8px 12px;
}

.mp-btb-search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 360px;
  display: flex;
  align-items: center;
}

.mp-btb-search-icon {
  position: absolute !important;
  left: 12px !important;
  color: var(--mp-text-muted, #94a3b8) !important;
  display: flex !important;
  align-items: center !important;
  pointer-events: none !important;
  z-index: 2 !important;
}

.mp-btb-search-icon svg {
  width: 15px !important;
  height: 15px !important;
  display: block !important;
}

/* MP-20261004-023: Spezifitaet gegen #view-projekte input[type="text"] (padding: 10px 12px !important) haerten */
#view-projekte input#mpBtbSearchInput,
#view-projekte input.mp-btb-search-input,
.mp-btb-search-wrap input.mp-btb-search-input,
.mp-btb-search-input {
  width: 100% !important;
  height: 36px !important;
  padding: 0 28px 0 38px !important;
  border: 1px solid var(--mp-input-border, #e2e8f0) !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  background: var(--mp-surface-4, #ffffff) !important;
  color: var(--mp-text, #0f172a) !important;
  outline: none !important;
  box-sizing: border-box !important;
  transition: border-color 0.15s ease, background 0.15s ease !important;
}

#view-projekte input#mpBtbSearchInput:focus,
#view-projekte input.mp-btb-search-input:focus,
.mp-btb-search-input:focus {
  border-color: var(--mp-accent, #2bb0ff) !important;
  background: var(--mp-card, #ffffff) !important;
  box-shadow: 0 0 0 3px var(--mp-accent-ring, rgba(43,176,255,0.18)) !important;
}

.mp-btb-search-clear {
  /* A11y-Hinweis (Ida Neumann, Abschnitt 11): 44px-Touch-Ziel passt nicht in
     die 34px hohe Such-Zeile ohne das Layout zu sprengen — Kompromiss:
     volle Zeilenhoehe als Klickflaeche, etwas breiter als vorher (24px). */
  position: absolute;
  right: 0;
  background: none;
  border: none;
  font-size: 16px;
  line-height: 1;
  color: var(--mp-text-muted);
  cursor: pointer;
  min-width: 32px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mp-btb-search-clear:hover {
  color: var(--mp-text);
}

.mp-btb-filter-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mp-btb-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--mp-border);
  background: var(--mp-card);
  color: var(--mp-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.mp-btb-pill:hover {
  background: var(--mp-surface-3);
  border-color: var(--mp-border-strong);
}

.mp-btb-pill.active {
  background: var(--mp-accent-soft);
  color: var(--mp-accent-text);
  border-color: var(--mp-accent-ring);
}

/* ─── 3. TAGEBUCH LISTE & TAGESKARTEN ─── */
.mp-btb-timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mp-btb-day-card {
  background: var(--mp-card);
  border: 1px solid var(--mp-border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--mp-shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mp-btb-day-card:hover {
  border-color: var(--mp-border-strong);
  box-shadow: var(--mp-shadow-md);
}

.mp-btb-day-card.has-behinderung {
  border-left: 4px solid var(--mp-danger);
}

.mp-btb-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--mp-divider);
  margin-bottom: 12px;
  cursor: pointer;
  user-select: none;
}

.mp-btb-day-body {
  display: block;
}

.mp-btb-day-card.is-collapsed .mp-btb-day-body {
  display: none !important;
}

.mp-btb-day-card.is-collapsed .mp-btb-day-header {
  border-bottom: none !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

.mp-btb-day-card.is-collapsed {
  padding: 12px 16px;
}

.mp-btb-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--mp-border);
  background: var(--mp-surface-2);
  color: var(--mp-text-secondary);
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  transition: transform 0.2s ease, background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.mp-btb-toggle-btn:hover {
  background: var(--mp-surface-3);
  color: var(--mp-text);
}

.mp-btb-day-card.is-open .mp-btb-toggle-btn svg {
  transform: rotate(180deg);
}

.mp-btb-day-card.is-collapsed .mp-btb-toggle-btn svg {
  transform: rotate(0deg);
}

.mp-btb-toggle-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--mp-surface-2);
  border: 1px solid var(--mp-border);
  color: var(--mp-text-secondary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  transition: all 0.15s ease;
}

.mp-btb-toggle-all-btn:hover {
  background: var(--mp-surface-3);
  color: var(--mp-text);
}

.mp-btb-badge-photos {
  background: var(--mp-surface-3);
  color: var(--mp-text-secondary);
}

.mp-btb-day-date-group {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.mp-btb-day-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--mp-text);
}

.mp-btb-day-date-iso {
  font-size: 12px;
  color: var(--mp-text-muted);
  font-family: monospace;
}

.mp-btb-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mp-btb-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--mp-surface-3);
  color: var(--mp-text-secondary);
  border: 1px solid var(--mp-border);
}

.mp-btb-badge-hours {
  background: var(--mp-accent-soft);
  color: var(--mp-accent-text);
  border-color: var(--mp-accent-ring);
}

.mp-btb-badge-weather {
  background: var(--mp-warning-soft);
  color: var(--mp-warning);
  border-color: var(--mp-warning-soft);
}

.mp-btb-badge-behinderung {
  background: var(--mp-danger-soft);
  color: var(--mp-danger);
  border-color: var(--mp-danger-soft);
  font-weight: 700;
}

.mp-btb-badge-sig {
  background: var(--mp-success-soft);
  color: var(--mp-success);
  border-color: var(--mp-success-soft);
}

/* MP-20260921-002 Stufe 4b Teil 2 (Lena Berger E-2, Ida Neumann Punkt 6):
   Marke fuer einen Tag mit mindestens einem noch nicht serverbestaetigten
   Faktum (metadata.hasPendingWrites). Eigener Ton (--mp-info statt
   --mp-warning) -- .mp-btb-badge-weather nutzt bereits --mp-warning, zwei
   Badges mit derselben Farbe waeren auf einer Karte kaum unterscheidbar. */
.mp-btb-badge-pending {
  background: var(--mp-info-soft);
  color: var(--mp-info);
  border-color: var(--mp-info-soft);
}

.mp-btb-day-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mp-btb-btn-sm {
  font-size: 12px;
  padding: 5px 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 6px;
}

/* ─── Sektionen & Strukturierte Tabellen ─── */
.mp-btb-section {
  margin-bottom: 12px;
}

.mp-btb-section:last-child {
  margin-bottom: 0;
}

.mp-btb-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mp-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mp-btb-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--mp-border);
  border-radius: 8px;
  background: var(--mp-card);
}

.mp-btb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
}

.mp-btb-table th {
  background: var(--mp-surface-4);
  color: var(--mp-text-secondary);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 7px 10px;
  border-bottom: 1px solid var(--mp-border);
}

.mp-btb-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--mp-divider);
  color: var(--mp-text);
}

.mp-btb-table tr:last-child td {
  border-bottom: none;
}

.mp-btb-table tr:hover td {
  background: var(--mp-surface-hover);
}

/* Mitarbeiter-Zeilen */
.mp-btb-workers-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mp-btb-worker-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  padding: 5px 8px;
  background: var(--mp-surface-4);
  border-radius: 6px;
  border: 1px solid var(--mp-divider);
}

.mp-btb-worker-name {
  font-weight: 600;
  color: var(--mp-text);
  min-width: 140px;
}

.mp-btb-worker-task {
  flex: 1;
  color: var(--mp-text-secondary);
}

.mp-btb-worker-hours {
  font-weight: 700;
  color: var(--mp-accent-text);
  white-space: nowrap;
}

/* Notizen & VOB-Behinderungen */
.mp-btb-note-box {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  background: var(--mp-surface-4);
  border: 1px solid var(--mp-border);
  margin-top: 4px;
}

.mp-btb-note-box.is-behinderung {
  background: var(--mp-danger-soft);
  border-color: var(--mp-danger-soft);
  color: var(--mp-danger);
}

.mp-btb-note-author {
  font-size: 11px;
  font-weight: 700;
  color: var(--mp-muted);
  margin-bottom: 2px;
}

.mp-btb-note-box.is-behinderung .mp-btb-note-author {
  color: var(--mp-danger);
}

/* Fotogalerie */
.mp-btb-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.mp-btb-photo-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--mp-border-strong);
  background: var(--mp-surface-3);
  cursor: pointer;
}

.mp-btb-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mp-btb-photo-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 3px 5px;
  background: var(--mp-overlay);
  color: var(--mp-text-on-accent);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Signatur-Anzeige */
.mp-btb-sig-display {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--mp-success-soft);
  border: 1px solid var(--mp-success-soft);
  border-radius: 8px;
}

.mp-btb-sig-img-preview {
  height: 38px;
  background: var(--mp-card);
  border-radius: 4px;
  padding: 2px;
  border: 1px solid var(--mp-success-soft);
}

.mp-btb-sig-info {
  font-size: 12px;
  color: var(--mp-success);
  line-height: 1.4;
}

/* ─── 4. MODALE (Erfassung & Signatur) — mp-ust-Stil ───
   Radius 18px, Scrim OHNE Blur, Schatten über --mp-shadow-lg (Ida Neumann,
   Abschnitt 4.5: css/mp-modal-standard.css untersagt Blur-Scrims
   ausdrücklich). MP_SHEET wurde als Ersatz geprüft (Konrad Steiner/Ida
   Neumann); die Erfassungsmaske hat dynamische Zeilen und ein
   Canvas-Signaturfeld, die dort nicht ohne eigene Nacharbeit unterzubringen
   sind — deshalb der Ersatzweg: eigene Klassenfamilie bleibt, aber ohne
   einen einzigen Hex-Wert und ohne Abweichung von Radius/Scrim/Schatten. */
.mp-btb-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--mp-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 16px;
  box-sizing: border-box;
}

.mp-btb-modal {
  background: var(--mp-card);
  border-radius: 18px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--mp-shadow-lg);
  overflow: hidden;
  animation: mpBtbFadeUp 0.15s ease-out;
}

.mp-btb-modal-lg {
  max-width: 760px;
}

@keyframes mpBtbFadeUp {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.mp-btb-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--mp-border);
  background: var(--mp-surface-4);
}

.mp-btb-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--mp-text);
}

.mp-btb-modal-close {
  background: none;
  border: none;
  color: var(--mp-muted);
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.mp-btb-modal-close:hover {
  background: var(--mp-surface-3);
  color: var(--mp-text);
}

.mp-btb-modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mp-btb-modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--mp-border);
  background: var(--mp-surface-4);
}

.mp-btb-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 12px;
}

.mp-btb-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mp-btb-field-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mp-text-secondary);
}

.mp-btb-field-input {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--mp-input-border);
  border-radius: 7px;
  font-size: 13px;
  color: var(--mp-text);
  background: var(--mp-card);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}

.mp-btb-field-input:focus {
  border-color: var(--mp-accent);
  box-shadow: 0 0 0 3px var(--mp-accent-ring);
}

.mp-btb-field-textarea {
  padding: 8px 10px;
  border: 1px solid var(--mp-input-border);
  border-radius: 7px;
  font-size: 13px;
  color: var(--mp-text);
  background: var(--mp-card);
  outline: none;
  box-sizing: border-box;
  resize: vertical;
}

.mp-btb-field-textarea:focus {
  border-color: var(--mp-accent);
  box-shadow: 0 0 0 3px var(--mp-accent-ring);
}

/* Dynamische Zeilen für Arbeiten & Materialien */
.mp-btb-dynamic-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mp-btb-dynamic-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mp-btb-dynamic-row .mp-btb-field-input {
  flex: 1;
}

.mp-btb-row-del {
  background: none;
  border: 1px solid var(--mp-border);
  border-radius: 6px;
  color: var(--mp-text-muted);
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.mp-btb-row-del:hover {
  background: var(--mp-danger-soft);
  color: var(--mp-danger);
  border-color: var(--mp-danger);
}

/* Sichtbarer Fokusring für reine Icon-Buttons (A11y-Befund Ida Neumann,
   Abschnitt 11) — dasselbe Muster wie mp-kartenkopf-standard.css:711-714. */
.mp-btb-search-clear:focus-visible,
.mp-btb-row-del:focus-visible,
.mp-btb-modal-close:focus-visible {
  outline: 2px solid rgba(43, 176, 255, .55);
  outline-offset: 2px;
}

/* VOB-Box im Editor */
.mp-btb-vob-box {
  background: var(--mp-warning-soft);
  border: 1px solid var(--mp-warning-soft);
  border-radius: 8px;
  padding: 12px;
}

.mp-btb-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--mp-warning);
  cursor: pointer;
}

.mp-btb-checkbox-row input[type="checkbox"] {
  width: 17px;
  height: 17px;
  cursor: pointer;
}

/* Signature Pad */
.mp-btb-sig-box {
  position: relative;
  width: 100%;
  height: 140px;
  border: 1.5px dashed var(--mp-border-strong);
  border-radius: 8px;
  background: var(--mp-card);
  overflow: hidden;
  touch-action: none;
}

.mp-btb-sig-box canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.mp-btb-sig-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--mp-text-muted);
  pointer-events: none;
}

/* Responsive Anpassungen (Mobile / Tablet) */
@media (max-width: 768px) {
  .mp-btb-kpis-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .mp-btb-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .mp-btb-search-wrap {
    max-width: none;
  }
  .mp-btb-grid-2 {
    grid-template-columns: 1fr;
  }
  .mp-btb-dynamic-row {
    flex-wrap: wrap;
  }
  .mp-btb-dynamic-row .mp-btb-field-input {
    min-width: calc(50% - 6px);
  }
}

@media (max-width: 480px) {
  .mp-btb-kpis-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── 5. INTERVIEW (MP-20260922-003) — ersetzt die alte Erfassungsmaske ───
   Laeuft in MP_SHEET (core/mp-sheet-system.js), dieser Block traegt nur den
   INHALT (Fortschrittsbalken, Schritt-Kopf, Bestaetigungskarten, Chips,
   Uebersicht) — Container/Header/Footer/Radius/Dark-Umschaltung liefert
   MP_SHEET bereits selbst. Ausschliesslich Dark-Contract-Tokens, kein
   eigener @media(prefers-color-scheme)- oder .dark-Zweig (Ida Neumann,
   Design-Spezifikation Abschnitt 8). Dynamische Zeilen/Felder/VOB-Box nutzen
   bewusst die bestehenden .mp-btb-field-*/.mp-btb-dynamic-row/.mp-btb-vob-box
   -Klassen weiter oben in dieser Datei — keine zweite Feld-Optik. */
.mp-btbi-host {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mp-btbi-progress {
  height: 4px;
  /* Kein 999px (harte UI-Regel) — 4px Radius auf einem 4px hohen Balken
     rundet identisch vollstaendig, ohne den verbotenen Wert zu nutzen. */
  border-radius: 4px;
  background: var(--mp-border);
  overflow: hidden;
  margin-bottom: 4px;
}

.mp-btbi-progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--mp-accent), #ff8a3d);
  transition: width 0.38s cubic-bezier(.16, 1, .3, 1);
}

.mp-btbi-stepcount {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mp-text-secondary);
  margin-bottom: 10px;
}

.mp-btbi-step {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mp-btbi-h {
  font-size: 18px;
  font-weight: 700;
  color: var(--mp-text);
  margin: 0;
}

.mp-btbi-hint {
  font-size: 13px;
  line-height: 1.5;
  color: var(--mp-text-secondary);
  margin: -6px 0 0;
}

.mp-btbi-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Vorschlags-Chips (E2) — wiederverwendet bewusst die bestehende
   .mp-badge-Pille (K-719: bestehende 999px-Bausteine wiederverwenden statt
   neu erfinden), nur mit interaktivem Zustand ergaenzt. */
.mp-btbi-chips-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--mp-text-secondary);
  margin-top: 2px;
}

.mp-btbi-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mp-btbi-chip {
  background: var(--mp-accent-soft);
  color: var(--mp-accent-text, var(--mp-accent));
  border: 1px solid var(--mp-accent-ring);
  cursor: pointer;
  min-height: 32px;
}

.mp-btbi-chip:hover {
  background: var(--mp-accent-ring);
}

.mp-btbi-chip:focus-visible {
  outline: 2px solid rgba(43, 176, 255, .55);
  outline-offset: 2px;
}

.mp-btbi-vortag-hint {
  font-size: 12px;
  color: var(--mp-warning, #b45309);
  background: var(--mp-warning-soft);
  border-radius: 7px;
  padding: 6px 10px;
}

.mp-btbi-addrow {
  align-self: flex-start;
  font-size: 12px;
  color: var(--mp-accent);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Schritt 1: Bestätigungskarten (read-only, keine Eingabe) */
.mp-btbi-empty-hint {
  font-size: 13px;
  color: var(--mp-text-secondary);
  background: var(--mp-surface-4);
  border-radius: 8px;
  padding: 10px 12px;
}

.mp-btbi-confirm-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mp-btbi-confirm-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mp-text-secondary);
}

.mp-btbi-confirm-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--mp-surface-4);
  font-size: 13px;
}

.mp-btbi-confirm-name {
  font-weight: 700;
  color: var(--mp-text);
  flex-shrink: 0;
}

.mp-btbi-confirm-task {
  color: var(--mp-text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mp-btbi-confirm-task--empty {
  opacity: .5;
}

.mp-btbi-confirm-hours {
  font-weight: 700;
  color: var(--mp-accent);
  flex-shrink: 0;
}

.mp-btbi-photo-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.mp-btbi-photo-strip img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  border: 1px solid var(--mp-border);
}

/* Schritt 6: Übersicht */
.mp-btbi-summary-block {
  border: 1px solid var(--mp-border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mp-btbi-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mp-btbi-summary-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--mp-text-secondary);
}

.mp-btbi-summary-edit {
  background: none;
  border: none;
  color: var(--mp-accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 0 4px;
}

.mp-btbi-summary-val {
  font-size: 13px;
  line-height: 1.5;
  color: var(--mp-text);
}

.mp-btbi-summary-empty {
  color: var(--mp-text-muted);
  font-style: italic;
}

@media (max-width: 480px) {
  .mp-btbi-confirm-row {
    flex-wrap: wrap;
  }
}

/* ─── Kartenkopf-Kebab "Weitere Aktionen" (MP-20260921-002 Stufe 4b, Ida
   Neumann P1-4, 23.09.2026) ───────────────────────────────────────────────
   Ersetzt den dritten, dauerhaft sichtbaren Aktions-Knopf "Vortag
   uebernehmen" im Kartenkopf — bei <=520px ueberlappte sein Text mit "PDF
   Export" (Beleg lena-stufe3/s3-04-karte-390.png). Eigene, kleine Klassen
   (kein .btn-*-Override, App-Regel) — Farb-/Randtoken von .btn-secondary
   uebernommen (var(--btn-secondary-*)) fuer optische Konsistenz zu den
   Nachbarknoepfen. border-radius 12px (Hausstandard, KEIN 999px). Kein
   width:100% auf .mp-btb-kebab-item — die Fluechtigkeit auf volle Menue-
   breite kommt aus dem Flex-Column-Elternelement (display:flex,
   Kreuzachsen-Default "stretch"), nicht aus einer width-Deklaration, exakt
   wie im Haus-Vorbild core/mp-action-menu.js. Dark-Mode ausschliesslich
   ueber Token-Vererbung (css/mp-dark-contract.css) — keine eigene
   html.dark-Regel hier noetig. JS-Bindung (Oeffnen/Schliessen/
   Aussenklick/Escape) folgt in Teil 2 — bis dahin bleibt #btbKebabMenu
   bewusst [hidden].
   ACHTUNG: Touch-Ziel-Regel (44px) fuer .mp-btb-kebab-btn/-item steht BEWUSST NICHT
   in einem eigenen @media-Block hier, sondern unten IM BESTEHENDEN letzten
   @media (max-width: 768px)-Block — die Datei hat sonst wieder drei statt
   zwei solcher Bloecke, und tools/test-mp20260920-037-bautagebuch-premium.cjs
   (Abschnitt M12) prueft ausdrücklich per `lastIndexOf` GENAU den letzten. */
.mp-btb-kebab {
  position: relative;
  display: inline-flex;
}
.mp-btb-kebab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--btn-secondary-border, var(--mp-border));
  border-radius: 12px;
  background: var(--btn-secondary-bg, var(--mp-card));
  color: var(--mp-text-secondary, var(--mp-muted));
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.mp-btb-kebab-btn:hover {
  background: var(--btn-secondary-bg-hover, var(--mp-bg));
  border-color: var(--btn-secondary-border-hover, var(--mp-border));
}
.mp-btb-kebab-btn:focus-visible {
  outline: 2px solid #1f9eef;
  outline-offset: 2px;
}
.mp-btb-kebab-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-width: 220px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--mp-border);
  background: var(--mp-card);
  box-shadow: var(--mp-shadow-md, 0 8px 24px rgba(15, 23, 42, .14));
}
.mp-btb-kebab-menu[hidden] { display: none; }
.mp-btb-kebab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--mp-text);
  font: 600 13.5px/1.3 inherit;
  text-align: left;
  cursor: pointer;
}
.mp-btb-kebab-item:hover { background: var(--mp-accent-soft, rgba(43, 176, 255, .1)); }
.mp-btb-kebab-item:focus-visible {
  outline: 2px solid #1f9eef;
  outline-offset: -2px;
}

/* Ida-Punkt-3 (Stufe 4b Teil 2, Koordinator-Auflage 23.09.2026): ab 521px
   bleiben alle drei Aktionen nebeneinander sichtbar wie vor dem Kebab-Umbau
   (Idas Spezifikation, s3-01-karte-1440.png zeigte auf dieser Breite keinen
   Fehler) — NUR auf <=520px wandert "Vortag uebernehmen" ins Menue. Rein
   CSS-basiert (kein zweites Markup, keine JS-Verzweigung noetig): der
   Kebab-Knopf wird ausgeblendet, das Menue verliert seine Popover-Optik und
   erscheint stattdessen als normale Knopfreihe. Der bestehende JS-Zustand
   ([hidden]-Toggle durch _wireHeaderButtons) bleibt unangetastet — diese
   Regel gewinnt gegen [hidden] rein durch Reihenfolge im Stylesheet
   (identische Selektor-Spezifitaet .mp-btb-kebab-menu[hidden], diese Regel
   steht spaeter in der Datei), nicht durch !important. */
@media (min-width: 521px) {
  .mp-btb-kebab-btn { display: none; }
  .mp-btb-kebab-menu,
  .mp-btb-kebab-menu[hidden] {
    display: flex;
    flex-direction: row;
    position: static;
    min-width: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
  }
  .mp-btb-kebab-item {
    border: 1px solid var(--btn-secondary-border, var(--mp-border));
    border-radius: 12px;
    background: var(--btn-secondary-bg, var(--mp-card));
    font-size: 13px;
    padding: 8px 14px;
  }
}

/* P2-Fix (Lena Berger, QA-Bewertung MP-20260922-003): Tippziele unter 44px
   auf Touch/Handy (Chips 32px, "Ändern" 32×65, Eingabefelder ~40px) — NUR
   unter 768px angehoben, Desktop bleibt unverändert (Koordinator-Auflage).
   Ergänzt Stufe 4b (Ida Neumann P1-4): Kartenkopf-Kebab-Knopf/-Eintrag
   ebenfalls ≥44px unter 768px — bewusst in DIESEM (dem letzten) Block, s.
   Begründung oben. */
@media (max-width: 768px) {
  .mp-btbi-chip {
    min-height: 44px;
  }
  .mp-btbi-summary-edit {
    min-height: 44px;
    min-width: 44px;
    padding: 0 10px;
  }
  .mp-btb-field-input {
    height: 44px;
  }
  .mp-btb-field-textarea {
    min-height: 44px;
  }
  .mp-btb-kebab-btn { width: 44px; height: 44px; }
  .mp-btb-kebab-item { min-height: 44px; }
}

/* ─── MP-20261004-019: Tageskarten Controls & 3-Punkte Kebab-Menü ─── */
.mp-btb-day-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.mp-btb-day-controls .mp-btb-toggle-btn {
  margin-left: 0 !important;
}

.mp-btb-day-kebab {
  position: relative;
  display: inline-flex;
}

.mp-btb-day-kebab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--mp-border, rgba(148, 163, 184, 0.25));
  background: var(--mp-surface-2, #ffffff);
  color: var(--mp-text-secondary, #64748b);
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.mp-btb-day-kebab-btn:hover {
  background: var(--mp-surface-3, #f1f5f9);
  color: var(--mp-text, #0f172a);
  border-color: var(--mp-primary, #2bb0ff);
}

.mp-btb-day-kebab-btn:focus-visible {
  outline: 2px solid #1f9eef;
  outline-offset: 2px;
}

.mp-btb-day-kebab-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  min-width: 220px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--mp-border, rgba(148, 163, 184, 0.25));
  background: var(--mp-card, #ffffff);
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.2), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
}

.mp-btb-day-kebab-menu[hidden] {
  display: none !important;
}

.mp-btb-day-kebab-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--mp-text, #1e293b);
  font: 600 13.5px/1.3 inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.mp-btb-day-kebab-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--mp-primary, #2bb0ff);
}

.mp-btb-day-kebab-item:hover {
  background: var(--mp-accent-soft, rgba(43, 176, 255, 0.1));
  color: var(--mp-primary, #0284c7);
}

/* Dark Mode */
html.dark .mp-btb-day-kebab-btn {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}
html.dark .mp-btb-day-kebab-btn:hover {
  background: #334155;
  color: #f8fafc;
}
html.dark .mp-btb-day-kebab-menu {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
html.dark .mp-btb-day-kebab-item {
  color: #e2e8f0;
}
html.dark .mp-btb-day-kebab-item:hover {
  background: rgba(43, 176, 255, 0.15);
  color: #38bdf8;
}

@media (min-width: 641px) {
  .mp-btb-day-kebab {
    display: none !important;
  }
}

/* MP-20261004-008 & MP-20261004-019 & MP-20261004-023: Mobile Optimierung Bautagebuch KPI & Akkordeon */
@media (max-width: 640px) {
  .mp-btb-kpis-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .mp-btb-kpis-grid .mp-kpi-tile {
    padding: 10px 10px 10px !important;
    min-width: 0 !important;
  }
  .mp-btb-kpis-grid .mp-kpi-label {
    font-size: 10px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    letter-spacing: .04em !important;
  }
  .mp-btb-kpis-grid .mp-kpi-value {
    font-size: 18px !important;
  }
  .mp-btb-kpis-grid .mp-kpi-hint {
    font-size: 11px !important;
    line-height: 1.25 !important;
  }
  .mp-btb-day-card.is-collapsed {
    padding: 10px 12px !important;
  }
  /* MP-20261004-019: Keine breiten Knopfreihen außerhalb des Handys; 3-Punkte Kebab Menü */
  .mp-btb-day-head-actions,
  .mp-btb-day-card.is-collapsed .mp-btb-day-head-actions,
  .mp-btb-day-card.is-open .mp-btb-day-head-actions {
    display: none !important;
  }
  .mp-btb-day-kebab {
    display: inline-flex !important;
  }
  .mp-btb-day-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .mp-btb-day-title-wrap {
    flex: 1 1 auto !important;
  }
  .mp-btb-day-controls {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin-left: auto !important;
  }
  .mp-btb-day-badges {
    width: 100% !important;
    margin-top: 4px !important;
  }
  .mp-btb-day-title {
    font-size: 14.5px !important;
  }
  #projBautagebuchCard {
    margin-top: 14px !important;
    border-radius: 16px !important;
  }
}
