:root {
    --bp-primary: #1e3a8a;
    --bp-accent: #d97706;
    --bp-text: #1f2937;
    --bp-muted: #6b7280;
    --bp-bg: #f9fafb;
    --bp-border: #e5e7eb;
    --bp-success: #16a34a;
    --bp-warning: #d97706;
    --bp-danger: #dc2626;
    --bp-inactive: #6b7280;
}

* { box-sizing: border-box; }
body.baier-portal { background: var(--bp-bg); color: var(--bp-text); font-family: system-ui, sans-serif; margin: 0; }
.bp-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; background: #fff; border-bottom: 1px solid var(--bp-border); }
.bp-logo img { max-height: 40px; }
.bp-nav a { margin-left: 16px; color: var(--bp-primary); text-decoration: none; }
.bp-main { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
.bp-card { background: #fff; border: 1px solid var(--bp-border); border-radius: 8px; padding: 24px; }
.bp-card--error { border-left: 4px solid var(--bp-danger); }
.bp-footer { text-align: center; padding: 24px; color: var(--bp-muted); }
.bp-footer a { color: var(--bp-muted); }

.bp-card--narrow { max-width: 480px; margin: 32px auto; }
.bp-alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; }
.bp-alert--danger { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.bp-alert--info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.bp-alert--success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.bp-card form label { display: block; margin-bottom: 16px; font-weight: 500; }
.bp-card form input[type="text"],
.bp-card form input[type="email"],
.bp-card form input[type="password"] { display: block; width: 100%; padding: 10px 12px; border: 1px solid var(--bp-border); border-radius: 6px; font-size: 16px; margin-top: 6px; }
.bp-btn { display: inline-block; padding: 12px 24px; border-radius: 6px; border: none; font-size: 16px; cursor: pointer; text-decoration: none; }
.bp-btn--primary { background: var(--bp-primary); color: #fff; }
.bp-btn--primary:hover { filter: brightness(1.1); }
.bp-btn--secondary { background: #fff; color: var(--bp-primary); border: 1px solid var(--bp-primary); }
.bp-muted { color: var(--bp-muted); font-size: 14px; }
.bp-muted a { color: var(--bp-primary); }

/* --- Dashboard --- */
.bp-dashboard__intro h1 { margin: 0 0 4px; font-size: 26px; }
.bp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 16px 0; }
.bp-stat { background: #fff; border: 1px solid var(--bp-border); border-radius: 8px; padding: 16px; text-decoration: none; color: var(--bp-text); display: block; transition: transform .1s; }
.bp-stat:hover { transform: translateY(-2px); }
.bp-stat__value { font-size: 32px; font-weight: 700; line-height: 1; }
.bp-stat__label { color: var(--bp-muted); font-size: 13px; margin-top: 4px; }
.bp-stat--ok { border-left: 4px solid var(--bp-success); }
.bp-stat--warn { border-left: 4px solid var(--bp-warning); }
.bp-stat--danger { border-left: 4px solid var(--bp-danger); }
.bp-stat--hint { border-left: 4px solid #f59e0b; }
.bp-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .bp-charts { grid-template-columns: 1fr; } }
.bp-list-toolbar { display: flex; gap: 12px; margin-bottom: 16px; }
.bp-search { flex: 1; padding: 10px; border: 1px solid var(--bp-border); border-radius: 6px; }
.bp-filter-status { padding: 10px; border: 1px solid var(--bp-border); border-radius: 6px; }
.bp-device-table { width: 100%; border-collapse: collapse; }
.bp-device-table th, .bp-device-table td { padding: 10px; border-bottom: 1px solid var(--bp-border); text-align: left; }
.bp-device-table th { background: #f9fafb; font-size: 13px; text-transform: uppercase; color: var(--bp-muted); }
.bp-status-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.bp-status-dot--current { background: var(--bp-success); }
.bp-status-dot--due_soon { background: var(--bp-warning); }
.bp-status-dot--overdue { background: var(--bp-danger); }
.bp-status-dot--inactive { background: var(--bp-inactive); }
.bp-hint-icon { color: #d97706; font-weight: bold; margin-left: 4px; }
@media (max-width: 640px) {
  .bp-device-table thead { display: none; }
  .bp-device-table tr { display: grid; grid-template-columns: auto 1fr; gap: 4px; padding: 12px; border-bottom: 1px solid var(--bp-border); }
  .bp-device-table td { border: none; padding: 4px; }
}

/* --- Geräte-Detail --- */

/* ============================================================ */
/* Geräte-Detail-Seite — neues kompaktes Layout                 */
/* ============================================================ */

.bp-device-detail { max-width: 1100px; margin: 0 auto; }
.bp-backlink { margin-bottom: 8px; }
.bp-backlink a { color: var(--bp-primary); text-decoration: none; font-size: 14px; }
.bp-backlink a:hover { text-decoration: underline; }

/* Haupt-Geräte-Karte */
.bp-device-card {
  background: #fff;
  border: 1px solid var(--bp-border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.bp-device-card__title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border-bottom: 1px solid var(--bp-border);
  flex-wrap: wrap;
  gap: 12px;
}
.bp-device-card__name h1 { margin: 0; font-size: 24px; line-height: 1.2; }
.bp-device-card__id { display: block; color: var(--bp-muted); font-size: 13px; margin-top: 4px; }
.bp-device-card__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.bp-device-card__col { padding: 20px 24px; }
.bp-device-card__col + .bp-device-card__col { border-left: 1px solid var(--bp-border); }
@media (max-width: 720px) {
  .bp-device-card__body { grid-template-columns: 1fr; }
  .bp-device-card__col + .bp-device-card__col { border-left: none; border-top: 1px solid var(--bp-border); }
}

.bp-section-title {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bp-muted);
}

/* Generische Info-Tabelle (Key-Value-Style) */
.bp-info-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.bp-info-table th {
  text-align: left;
  font-weight: 500;
  color: var(--bp-muted);
  padding: 8px 12px 8px 0;
  width: 40%;
  vertical-align: top;
  border-bottom: 1px solid #f3f4f6;
}
.bp-info-table td {
  padding: 8px 0;
  vertical-align: top;
  border-bottom: 1px solid #f3f4f6;
}
.bp-info-table tr:last-child th, .bp-info-table tr:last-child td { border-bottom: none; }
.bp-info-table code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.bp-info-table--status td strong { font-size: 15px; }
.bp-info-table--compact th, .bp-info-table--compact td { padding: 6px 12px 6px 0; font-size: 13px; }
.bp-info-table--compact { background: #f9fafb; border-radius: 6px; padding: 12px 16px; margin: 12px 0; border: 1px solid var(--bp-border); }

/* Badges + Status-Pills */
.bp-status-pill {
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}
.bp-status-pill--current  { background: #dcfce7; color: #166534; }
.bp-status-pill--due_soon { background: #fef3c7; color: #92400e; }
.bp-status-pill--overdue  { background: #fee2e2; color: #991b1b; }
.bp-status-pill--inactive { background: #f3f4f6; color: #4b5563; }

.bp-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; margin-left: 8px; }
.bp-badge--pass { background: #dcfce7; color: #166534; }
.bp-badge--fail { background: #fee2e2; color: #991b1b; }
.bp-badge--unknown { background: #f3f4f6; color: #6b7280; }

.bp-days { display: inline-block; margin-left: 8px; font-size: 13px; }
.bp-days--ok { color: var(--bp-muted); }
.bp-days--soon { color: var(--bp-warning); font-weight: 500; }
.bp-days--overdue { color: var(--bp-danger); font-weight: 600; }

/* Notiz zum Gerät */
.bp-device-card__note {
  background: #fefce8;
  border-top: 1px solid var(--bp-border);
  padding: 14px 24px;
  font-size: 14px;
  color: #713f12;
}
.bp-note-label { font-weight: 600; margin-right: 8px; color: #854d0e; }

/* Hinweis-Banner */
.bp-hint-banner {
  display: flex;
  gap: 16px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid var(--bp-warning);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 0 0 20px;
}
.bp-hint-banner__icon { font-size: 24px; line-height: 1; color: var(--bp-warning); }
.bp-hint-banner__content { flex: 1; }
.bp-hint-banner__content strong { display: block; margin-bottom: 6px; color: #92400e; }
.bp-hint-banner blockquote {
  margin: 6px 0;
  padding: 8px 12px;
  border-left: 3px solid #fbbf24;
  background: rgba(255,255,255,0.6);
  font-style: italic;
  font-size: 15px;
}
.bp-hint-banner small { color: #92400e; }

/* Sektions-Überschrift */
.bp-section-heading {
  margin: 24px 0 12px;
  font-size: 18px;
  border-bottom: 2px solid var(--bp-primary);
  padding-bottom: 4px;
  display: inline-block;
}

/* Prüfhistorie */
.bp-history { list-style: none; padding: 0; margin: 0; }
.bp-empty { color: var(--bp-muted); font-style: italic; padding: 16px; background: #f9fafb; border-radius: 6px; }

.bp-history-item {
  background: #fff;
  border: 1px solid var(--bp-border);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.bp-history-item--expanded { border-color: var(--bp-primary); }

.bp-history-item__toggle {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 14px 18px;
  cursor: pointer;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 14px;
  transition: background 0.1s;
}
.bp-history-item__toggle:hover { background: #f8fafc; }
.bp-history-item__chevron {
  color: var(--bp-muted);
  transition: transform 0.15s;
  font-size: 12px;
}
.bp-history-item--expanded .bp-history-item__chevron { transform: rotate(90deg); }
.bp-history-item__date { font-weight: 600; min-width: 100px; }
.bp-history-item__verdict { font-weight: 500; min-width: 130px; }
.bp-history-item__pruefer { color: var(--bp-muted); flex: 1; }
.bp-history-item__hint {
  background: #fffbeb;
  color: #92400e;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.bp-history-item__body { display: none; padding: 0 18px 18px; border-top: 1px solid var(--bp-border); }
.bp-history-item--expanded .bp-history-item__body { display: block; }

.bp-alert--warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
  border-left: 4px solid var(--bp-warning);
  border-radius: 6px;
  padding: 12px 16px;
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.5;
}

/* Summary-Flags */
.bp-summary-flags { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.bp-flag { display: inline-block; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.bp-flag--pass { background: #dcfce7; color: #166534; }
.bp-flag--fail { background: #fee2e2; color: #991b1b; }

/* Detail-Überschrift in History-Body */
.bp-detail-heading {
  margin: 18px 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--bp-text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bp-detail-count { font-weight: 400; color: var(--bp-muted); font-size: 13px; text-transform: none; letter-spacing: normal; }

/* Sichtprüfungs-Liste */
.bp-visual-list { list-style: none; padding: 0; margin: 0 0 16px; border: 1px solid var(--bp-border); border-radius: 6px; overflow: hidden; }
.bp-visual-item { display: flex; align-items: flex-start; gap: 12px; padding: 10px 14px; border-bottom: 1px solid #f3f4f6; font-size: 14px; }
.bp-visual-item:last-child { border-bottom: none; }
.bp-visual-item--ok { background: #f0fdf4; }
.bp-visual-item--bad { background: #fef2f2; }
.bp-visual-icon { font-weight: bold; font-size: 16px; line-height: 1.4; }
.bp-visual-item--ok .bp-visual-icon { color: var(--bp-success); }
.bp-visual-item--bad .bp-visual-icon { color: var(--bp-danger); }
.bp-visual-text { flex: 1; }

/* Procedure-Cards (HT-Multi V2) */
.bp-procedures { display: grid; gap: 12px; margin: 0 0 16px; }
@media (min-width: 900px) {
  .bp-procedures { grid-template-columns: 1fr 1fr; }
}
.bp-procedure { border: 1px solid var(--bp-border); border-radius: 8px; overflow: hidden; background: #fff; }
.bp-procedure__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: #f9fafb;
  border-bottom: 1px solid var(--bp-border);
  flex-wrap: wrap;
  gap: 8px;
}
.bp-procedure__name { font-weight: 600; font-size: 14px; }
.bp-procedure__status { font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.bp-procedure__status--pass { background: #dcfce7; color: #166534; }
.bp-procedure__status--fail { background: #fee2e2; color: #991b1b; }

.bp-procvalues { width: 100%; border-collapse: collapse; }
.bp-procvalues th {
  text-align: left;
  font-weight: 400;
  color: var(--bp-muted);
  padding: 8px 14px;
  font-size: 13px;
  width: 60%;
  border-top: 1px solid #f3f4f6;
}
.bp-procvalues td {
  padding: 8px 14px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 13px;
  font-weight: 500;
  text-align: right;
  border-top: 1px solid #f3f4f6;
}
.bp-procvalues tr:first-child th, .bp-procvalues tr:first-child td { border-top: none; }
.bp-procvalue--invalid { opacity: 0.5; }
.bp-procvalue--invalid td::after { content: ' (ungültig)'; color: var(--bp-warning); font-style: italic; font-weight: normal; }

/* Buttons */
.bp-btn { display: inline-block; padding: 10px 18px; border-radius: 6px; border: none; font-size: 14px; cursor: pointer; text-decoration: none; }
.bp-btn--primary { background: var(--bp-primary); color: #fff; }
.bp-btn--primary:hover { filter: brightness(1.1); }
.bp-btn--secondary { background: #fff; color: var(--bp-primary); border: 1px solid var(--bp-primary); }
.bp-btn--secondary:hover { background: #f0f7ff; }
.bp-print-row { margin-top: 16px; }

/* ============================================================ */
/* Print-Elemente — auf Bildschirm verstecken                    */
/* ============================================================ */
.bp-print-page, .bp-print-footer { display: none; }

/* ============================================================ */
/* Druck-Layout — Geräte-Prüfbericht im Baier-Stil               */
/* ============================================================ */
@media print {
  @page { size: A4; margin: 12mm 14mm 18mm 14mm; }

  /* Verstecke alle Bildschirm-Elemente */
  body, html { background: #fff; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #1a1a1a; }
  .bp-header, .bp-footer, .no-print, .bp-history-item__toggle, .bp-backlink,
  .bp-device-card, .bp-section-heading,
  .bp-print-row { display: none !important; }

  /* Print-Container sichtbar machen */
  .bp-print-page, .bp-print-footer { display: block; }
  .bp-device-detail { max-width: none; margin: 0; }

  /* === Header (dunkelblauer Balken mit Titel + Logo) === */
  .bp-print-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, #0c1e3e 0%, #1a2f5e 100%);
    color: #fff;
    padding: 12px 18px;
    margin-bottom: 14px;
    border-radius: 0;
  }
  .bp-print-header__title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .bp-print-header__logo img { height: 56px; display: block; }

  /* === Zwei Boxen: Kunde + Geräte-Daten === */
  .bp-print-boxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
  }
  .bp-print-box {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
    page-break-inside: avoid;
  }
  .bp-print-box__head {
    background: linear-gradient(180deg, #e5e7eb 0%, #f3f4f6 100%);
    border-bottom: 1px solid #d1d5db;
    padding: 6px 12px;
    font-weight: 700;
    text-align: center;
    font-size: 13px;
  }
  .bp-print-box__body { padding: 10px 14px; font-size: 12px; }
  .bp-print-box__body p { margin: 2px 0; }
  .bp-print-box__name { font-weight: 700; font-size: 14px; margin-bottom: 6px !important; }
  .bp-print-box__small { color: #6b7280; font-size: 11px; margin-top: 6px !important; }
  .bp-print-kv { width: 100%; border-collapse: collapse; font-size: 12px; }
  .bp-print-kv th { text-align: left; font-weight: 500; color: #4b5563; padding: 2px 8px 2px 0; width: 40%; }
  .bp-print-kv td { padding: 2px 0; }

  /* === Hinweis-Banner (gelb) === */
  .bp-hint-banner {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 3px solid #f59e0b;
    padding: 8px 12px;
    margin: 10px 0;
    font-size: 12px;
    border-radius: 4px;
    page-break-inside: avoid;
  }
  .bp-hint-banner__icon { display: none; }
  .bp-hint-banner blockquote { margin: 4px 0; padding: 4px 8px; font-size: 12px; }

  /* === Prüfhistorie === */
  .bp-history { list-style: none; padding: 0; margin: 0; }
  .bp-history-item {
    border: 1px solid #d1d5db;
    border-radius: 4px;
    margin-bottom: 10px;
    background: #fff;
    overflow: hidden;
    page-break-inside: avoid;
  }
  .bp-history-item__body { display: block !important; padding: 10px 14px !important; border: none; }

  /* === Info-Tabelle (Prüfdaten) === */
  .bp-info-table--compact {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 8px 12px;
    margin: 8px 0;
  }
  .bp-info-table { font-size: 11px; }
  .bp-info-table th, .bp-info-table td { padding: 2px 4px 2px 0; }

  /* === Pass/Fail-Flags === */
  .bp-summary-flags { display: flex; gap: 8px; margin: 6px 0 10px; }
  .bp-flag { font-size: 11px; padding: 3px 10px; border-radius: 999px; font-weight: 600; }
  .bp-flag--pass { background: #dcfce7 !important; color: #166534 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .bp-flag--fail { background: #fee2e2 !important; color: #991b1b !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* === Sektion-Überschriften im Print === */
  .bp-detail-heading {
    margin: 12px 0 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #0c1e3e;
    border-bottom: 1px solid #d1d5db;
    padding-bottom: 2px;
  }
  .bp-detail-count { font-weight: 400; color: #6b7280; font-size: 11px; text-transform: none; letter-spacing: normal; }

  /* === Sichtprüfungs-Liste === */
  .bp-visual-list { border: 1px solid #e5e7eb; border-radius: 4px; padding: 0; margin: 4px 0 10px; list-style: none; }
  .bp-visual-item { padding: 4px 10px; font-size: 11px; border-bottom: 1px solid #f3f4f6; }
  .bp-visual-item:last-child { border-bottom: none; }
  .bp-visual-item--ok { background: #f0fdf4 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .bp-visual-item--bad { background: #fef2f2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* === Procedure-Karten === */
  .bp-procedures { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
  .bp-procedure {
    border: 1px solid #d1d5db;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    page-break-inside: avoid;
  }
  .bp-procedure__head {
    background: #f3f4f6 !important;
    padding: 5px 10px;
    border-bottom: 1px solid #d1d5db;
    display: flex;
    justify-content: space-between;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .bp-procedure__name { font-weight: 600; font-size: 11px; }
  .bp-procedure__status { font-size: 10px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
  .bp-procedure__status--pass { background: #dcfce7 !important; color: #166534 !important; }
  .bp-procedure__status--fail { background: #fee2e2 !important; color: #991b1b !important; }
  .bp-procvalues { width: 100%; border-collapse: collapse; }
  .bp-procvalues th { text-align: left; color: #6b7280; padding: 3px 10px; font-size: 10px; font-weight: 400; border-top: 1px solid #f3f4f6; }
  .bp-procvalues td { padding: 3px 10px; font-size: 10px; text-align: right; font-family: ui-monospace, monospace; font-weight: 500; border-top: 1px solid #f3f4f6; }

  /* Mehrseitiger Druck: pro Prüfung Seitenumbruch erlauben aber nicht zwingen */
  .bp-history-item:not(:first-child) { page-break-before: auto; }

  /* === Footer === */
  .bp-print-footer {
    background: linear-gradient(180deg, #0c1e3e 0%, #1a2f5e 100%) !important;
    color: #fff !important;
    padding: 12px 16px;
    margin-top: 20px;
    font-size: 9px;
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    border-radius: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    page-break-inside: avoid;
  }
  .bp-print-footer__col { line-height: 1.5; }
  .bp-print-footer__col strong { font-size: 10px; }
  .bp-print-footer__label { font-weight: 700; }
}

/* Abteilungs-Kacheln */
.bp-departments { margin-top: 28px; }
.bp-departments .bp-section-heading { margin-bottom: 12px; }
.bp-dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.bp-dept-card {
  background: #fff;
  border: 1px solid var(--bp-border);
  border-radius: 8px;
  padding: 16px;
  text-decoration: none;
  color: var(--bp-text);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
  position: relative;
}
.bp-dept-card:hover { transform: translateY(-2px); border-color: var(--bp-primary); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.bp-dept-card--active { border-color: var(--bp-primary); background: #eff6ff; }
.bp-dept-card--active::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--bp-primary);
  border-radius: 8px 8px 0 0;
}
.bp-dept-card--all {
  background: linear-gradient(135deg, #f8fafc 0%, #fff 100%);
  border-style: dashed;
}
.bp-dept-card__count { font-size: 28px; font-weight: 700; line-height: 1; color: var(--bp-primary); }
.bp-dept-card__name { font-weight: 500; font-size: 14px; color: var(--bp-text); }
.bp-dept-card__bars {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: #f3f4f6;
  margin-top: 4px;
}
.bp-dept-bar { display: block; min-width: 2px; }
.bp-dept-bar--ok { background: var(--bp-success); }
.bp-dept-bar--warn { background: var(--bp-warning); }
.bp-dept-bar--danger { background: var(--bp-danger); }
.bp-dept-bar--inactive { background: var(--bp-inactive); }
.bp-dept-card__hint {
  font-size: 12px;
  color: #92400e;
  margin-top: 4px;
}

/* Filter-Status-Bar (zeigt welche Filter aktiv sind) */
.bp-filter-status-bar[hidden] { display: none !important; }
.bp-filter-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  margin: 10px 0;
  font-size: 13px;
  color: #1e40af;
}
.bp-filter-reset {
  background: none;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.bp-filter-reset:hover { background: #dbeafe; }

.bp-list-toolbar .bp-filter-dept { padding: 10px; border: 1px solid var(--bp-border); border-radius: 6px; }
.bp-list-toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }

/* ============================================================ */
/* MOBILE (≤ 640 px) — aufgeräumtes Smartphone-Layout            */
/* ============================================================ */
@media (max-width: 640px) {
  .bp-main { padding: 0 12px; margin: 12px auto; }
  .bp-header { padding: 12px 14px; }
  .bp-logo img { max-height: 32px; }
  .bp-nav { font-size: 13px; }
  .bp-nav a { margin-left: 8px; }
  .bp-user { display: none; }  /* Kundennummer einsparen auf Smartphone, schon im Dashboard sichtbar */

  /* Dashboard-Intro */
  .bp-dashboard__intro h1 { font-size: 20px; }

  /* Stat-Cards — 2 Spalten statt 3-5 */
  .bp-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .bp-stat { padding: 12px; }
  .bp-stat__value { font-size: 24px; }
  .bp-stat__label { font-size: 12px; }

  /* Charts untereinander */
  .bp-charts { grid-template-columns: 1fr; gap: 12px; }
  .bp-card { padding: 16px; }
  .bp-card h3 { font-size: 15px; }

  /* Abteilungs-Kacheln — 2 Spalten */
  .bp-dept-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .bp-dept-card { padding: 12px; }
  .bp-dept-card__count { font-size: 22px; }
  .bp-dept-card__name { font-size: 13px; }

  /* Toolbar untereinander */
  .bp-list-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .bp-list-toolbar input, .bp-list-toolbar select { width: 100%; }

  /* Geräte-Tabelle → Cards-View */
  .bp-device-table { background: transparent; }
  .bp-device-table thead { display: none; }
  .bp-device-table tbody tr {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 14px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid var(--bp-border);
    border-radius: 8px;
  }
  .bp-device-table tbody td {
    border: none;
    padding: 0;
    font-size: 14px;
  }
  /* Erste Zelle (Status-Dot) prominent, zweite (ID) klein */
  .bp-device-table tbody td:nth-child(1) { display: flex; align-items: center; gap: 8px; }
  .bp-device-table tbody td:nth-child(2) { font-size: 12px; color: var(--bp-muted); }
  .bp-device-table tbody td:nth-child(3) { font-weight: 600; font-size: 16px; margin: 4px 0; }
  .bp-device-table tbody td:nth-child(4)::before { content: 'Hersteller: '; color: var(--bp-muted); font-size: 12px; }
  .bp-device-table tbody td:nth-child(5)::before { content: 'Abteilung: '; color: var(--bp-muted); font-size: 12px; }
  .bp-device-table tbody td:last-child { margin-top: 6px; padding-top: 6px; border-top: 1px solid #f3f4f6; }
  .bp-device-table tbody td:last-child::before { content: 'Nächste Prüfung: '; color: var(--bp-muted); font-size: 12px; display: block; margin-bottom: 2px; }

  /* Geräte-Detail-Header */
  .bp-device-card__title { padding: 14px 16px; }
  .bp-device-card__name h1 { font-size: 19px; }
  .bp-device-card__col { padding: 14px 16px; }
  .bp-status-pill { font-size: 12px; padding: 4px 10px; }

  /* Stammdaten/Prüfungs-Tabelle */
  .bp-info-table { font-size: 13px; }
  .bp-info-table th { width: 45%; padding: 6px 8px 6px 0; font-size: 13px; }
  .bp-info-table td { padding: 6px 0; }

  /* Hinweis-Banner */
  .bp-hint-banner { padding: 12px 14px; gap: 10px; }
  .bp-hint-banner__icon { font-size: 20px; }
  .bp-hint-banner blockquote { padding: 6px 10px; font-size: 14px; }

  /* Section-Heading kleiner */
  .bp-section-heading { font-size: 16px; margin: 18px 0 10px; }

  /* Prüfhistorie-Toggle — vertikal */
  .bp-history-item__toggle {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 12px 14px;
  }
  .bp-history-item__chevron { position: absolute; top: 14px; right: 14px; }
  .bp-history-item { position: relative; }
  .bp-history-item__date { font-size: 15px; }
  .bp-history-item__verdict { font-size: 13px; min-width: 0; }
  .bp-history-item__pruefer { font-size: 13px; }
  .bp-history-item__hint { align-self: flex-start; }
  .bp-history-item__body { padding: 0 14px 14px; }

  /* Sichtprüfungs-Liste kompakter */
  .bp-visual-item { padding: 8px 12px; font-size: 13px; }

  /* Procedures-Karten — full width */
  .bp-procedures { grid-template-columns: 1fr; gap: 10px; }
  .bp-procedure__head { padding: 10px 12px; }
  .bp-procedure__name { font-size: 13px; }
  .bp-procedure__status { font-size: 11px; padding: 2px 8px; }
  .bp-procvalues th, .bp-procvalues td { padding: 6px 12px; font-size: 12px; }

  /* Summary-Flags untereinander */
  .bp-summary-flags { flex-direction: column; gap: 6px; }
  .bp-flag { font-size: 12px; padding: 5px 10px; }

  /* Buttons full-width */
  .bp-btn { width: 100%; padding: 12px; }
  .bp-print-row { margin-top: 12px; }

  /* Card-Form (Login etc.) Padding kleiner */
  .bp-card--narrow { margin: 16px 12px; padding: 20px; }
  .bp-card form input { font-size: 16px; }  /* 16px verhindert iOS-Zoom */

  /* Filter-Statusbar kompakter */
  .bp-filter-status-bar { flex-direction: column; align-items: stretch; gap: 6px; font-size: 12px; padding: 8px 10px; }
  .bp-filter-reset { align-self: stretch; }
}

/* Sehr kleine Geräte (≤ 360 px) — Stats in 1 Spalte */
@media (max-width: 360px) {
  .bp-stats, .bp-dept-grid { grid-template-columns: 1fr; }
}
