/* Betriebsplanung, Buchungsbericht und Bestandsabgleich – gleiche Farben, Formen und Schriften wie die übrige App. */
.bp-dialog, .bm-dialog {
    --bp-bg: var(--bg-card, #fff);
    --bp-surface: var(--bg-surface, #f8fafc);
    --bp-line: var(--border-subtle, #e2e8f0);
    --bp-line-strong: var(--border-strong, #cbd5e1);
    --bp-text: var(--text-primary, #0f172a);
    --bp-text-2: var(--text-secondary, #334155);
    --bp-muted: var(--text-tertiary, #64748b);
    --bp-accent: var(--primary, #0284c7);
    --bp-accent-hover: var(--primary-hover, #0369a1);
    --bp-accent-soft: var(--primary-light, #e0f2fe);
    --bp-warn: #9a3412;
    --bp-warn-bg: var(--accent-light, #ffedd5);
    --bp-danger: #b42318;
    --bp-danger-bg: var(--danger-bg, #fef2f2);
    box-sizing: border-box;
    padding: 0;
    border: 1px solid var(--bp-line);
    border-radius: var(--radius-xl, 20px);
    background: var(--bp-bg);
    color: var(--bp-text);
    font-family: var(--font-body, Inter, system-ui, sans-serif);
    box-shadow: var(--shadow-float, 0 20px 35px -6px rgba(15, 23, 42, .1), 0 10px 15px -4px rgba(15, 23, 42, .04));
}
.bp-dialog *, .bm-dialog * { box-sizing: border-box; }
.bp-dialog::backdrop, .bm-dialog::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(4px); }
.bp-dialog:focus, .bp-dialog:focus-visible { outline: none; }
.bp-dialog[aria-busy=true] { cursor: progress; }

/* Großes Fenster: immer gleich groß wie E-Mail und Kalender. Kopf und Bereichsmenü bleiben stehen, nur der Inhalt scrollt. */
.bp-dialog { width: min(1440px, calc(100vw - 40px)); max-width: none; height: min(940px, calc(100dvh - 40px)); max-height: none; overflow: hidden; margin: auto; }
.bp-dialog[open] { display: flex; flex-direction: column; }
.bp-dialog > header, .bp-dialog > nav, .bp-dialog > .bp-error { flex-shrink: 0; }
.bp-dialog > main { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.bp-dialog > .bp-loading { margin: auto; padding: 50px; color: var(--bp-muted); }

/* Kopfzeile */
.bp-dialog header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 26px 32px 18px; }
.bp-dialog h2 { font-family: var(--font-heading, 'Plus Jakarta Sans', Inter, sans-serif); font-size: 26px; letter-spacing: -.6px; margin: 6px 0 0; }
.bp-dialog header p { margin: 6px 0 0; color: var(--bp-muted); font-size: 13px; line-height: 1.6; }
.bp-eyebrow { font-size: 10px; font-weight: 800; letter-spacing: 1.6px; color: var(--bp-accent); }

/* Bereichsmenü */
.bp-dialog nav { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 24px 16px; border-bottom: 1px solid var(--bp-line); }

/* Bedienelemente */
.bp-dialog button, .bm-dialog button {
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    min-height: 40px;
    border: 1px solid var(--bp-line-strong);
    background: var(--bp-bg, #fff);
    color: var(--bp-text-2);
    padding: 9px 14px;
    border-radius: var(--radius-md, 10px);
    cursor: pointer;
    line-height: 1.3;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.bp-dialog button:hover:not(:disabled) { background: var(--bp-surface); border-color: var(--bp-muted); color: var(--bp-text); }
.bp-dialog button:disabled { opacity: .5; cursor: wait; }
.bp-dialog button:focus-visible, .bp-dialog input:focus-visible, .bp-dialog select:focus-visible, .bp-dialog textarea:focus-visible, .bp-dialog summary:focus-visible { outline: 3px solid var(--primary-glow, rgba(2, 132, 199, .22)); outline-offset: 2px; border-color: var(--bp-accent); }
.bp-dialog button.bp-primary, .bp-dialog nav [aria-current] { background: var(--bp-accent); border-color: var(--bp-accent); color: #fff; }
.bp-dialog button.bp-primary:hover:not(:disabled), .bp-dialog nav [aria-current]:hover:not(:disabled) { background: var(--bp-accent-hover); border-color: var(--bp-accent-hover); color: #fff; }
.bp-dialog button.bp-quiet { border-color: transparent; background: transparent; color: var(--bp-muted); }
.bp-dialog button.bp-quiet:hover:not(:disabled) { background: var(--bp-surface); color: var(--bp-text); }
.bp-dialog .bp-close { font-size: 22px; line-height: 1; padding: 6px 14px; border-color: transparent; color: var(--bp-muted); }
.bp-dialog main { padding: 24px 32px 32px; }
.bp-dialog h3 { font-family: var(--font-heading, 'Plus Jakarta Sans', Inter, sans-serif); font-size: 17px; margin: 16px 0; }
.bp-dialog h4 { font-size: 13px; color: var(--bp-muted); margin: 22px 0 8px; }
.bp-dialog small { display: block; font-size: 11px; color: var(--bp-muted); margin-top: 5px; }
.bp-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin: 0 0 20px; }
.bp-toolbar h3, .bp-toolbar h4 { margin-right: auto; }

/* Startseite: nur die wichtigsten Funktionen, alles Weitere im aufklappbaren Bereich darunter. */
.bp-start { margin-bottom: 22px; }
.bp-panel { border: 1px solid var(--bp-line); border-radius: var(--radius-lg, 14px); background: var(--bp-bg); padding: 4px 20px 20px; box-shadow: var(--shadow-xs, 0 1px 2px rgba(15, 23, 42, .04)); }
.bp-panel > h3 { display: flex; align-items: center; gap: 10px; }
.bp-panel > h3:first-child { margin-top: 18px; }
.bp-dialog nav .bp-quiet { background: var(--bp-surface); }
.bp-next .bp-event button { background: var(--bp-bg); border-color: var(--bp-line); border-left-color: var(--bp-line-strong); }
.bp-next .bp-event button:hover:not(:disabled) { background: var(--bp-surface); border-color: var(--bp-line-strong); }
.bp-count { font-size: 12px; font-weight: 700; color: var(--bp-accent); background: var(--bp-accent-soft); border-radius: var(--radius-full, 9999px); padding: 3px 10px; }
.bp-dialog .bp-areas { margin-top: 24px; border: 1px solid var(--bp-line); border-radius: var(--radius-lg, 14px); background: var(--bp-surface); padding: 6px 18px; }
.bp-dialog .bp-areas summary { padding: 12px 0; font-size: 14px; font-weight: 700; color: var(--bp-text-2); }
.bp-dialog .bp-areas[open] summary { border-bottom: 1px solid var(--bp-line); margin-bottom: 16px; }
.bp-dialog .bp-areas .bp-toolbar { margin: 0 0 12px; }
.bp-dialog .bp-areas button { background: var(--bp-bg); }

/* Kennzahlen und Karten */
.bp-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 20px 0; }
.bp-stat { border: 1px solid var(--bp-line); border-radius: var(--radius-lg, 14px); padding: 20px; background: var(--bp-bg); box-shadow: var(--shadow-xs, 0 1px 2px rgba(15, 23, 42, .04)); }
.bp-stat span, .bp-stat small { display: block; font-size: 12px; color: var(--bp-muted); }
.bp-stat strong { display: block; font-family: var(--font-heading, 'Plus Jakarta Sans', Inter, sans-serif); font-size: 28px; margin: 12px 0; letter-spacing: -1px; }
.bp-two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.bp-two > section > .bp-muted { margin: 14px 0 0; }
.bp-empty { border: 1px dashed var(--bp-line-strong); border-radius: var(--radius-lg, 14px); text-align: center; padding: 32px 24px; color: var(--bp-muted); }
.bp-empty strong { color: var(--bp-text); }
.bp-empty p { font-size: 13px; line-height: 1.6; max-width: 440px; margin: 10px auto 0; }
.bp-muted, .bp-help { color: var(--bp-muted); font-size: 12px; line-height: 1.7; }
.bp-record { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--bp-line); padding: 14px 0; }
.bp-record:last-child { border-bottom: 0; }
.bp-order-grid, .bp-integration-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 22px; }
.bp-order-grid article, .bp-integration-grid section, .bp-section { border: 1px solid var(--bp-line); border-radius: var(--radius-lg, 14px); padding: 20px; margin-bottom: 20px; background: var(--bp-bg); }
.bp-order-grid button { display: block; margin-top: 18px; }
.bp-integration-grid button { margin: 8px 4px 0 0; }
.bp-badge { display: inline-block; border-radius: var(--radius-sm, 6px); background: var(--bp-accent-soft); color: var(--bp-accent-hover); font-size: 11px; font-weight: 600; padding: 5px 8px; white-space: nowrap; }
.bp-warn { background: var(--bp-warn-bg); color: var(--bp-warn); }
.bp-bank { margin-top: 22px; }

/* Einsätze und Kalender */
.bp-calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--bp-line); border-radius: var(--radius-lg, 14px); overflow: hidden; }
.bp-calendar > section { min-height: 280px; border-right: 1px solid var(--bp-line); padding: 10px; }
.bp-calendar > section:last-child { border-right: 0; }
.bp-calendar h3 { font-size: 12px; text-align: center; margin: 6px 0 16px; }
.bp-calendar .bp-today { background: var(--primary-soft, rgba(2, 132, 199, .06)); }
.bp-day { grid-template-columns: 1fr; }
.bp-event { margin: 8px 0; }
.bp-event button { display: flex; flex-direction: column; width: 100%; text-align: left; background: var(--bp-accent-soft); border: 1px solid transparent; border-left: 3px solid var(--bp-accent); color: var(--bp-text); padding: 11px 10px; gap: 5px; }
.bp-event button:hover:not(:disabled) { background: var(--bp-accent-soft); border-color: var(--bp-accent); }
.bp-event strong, .bp-event span, .bp-event small { overflow-wrap: anywhere; }
.bp-event span { font-size: 11px; color: var(--bp-text-2); }
.bp-event small { font-size: 10px; font-weight: 400; margin-top: 0; }
.bp-absence button { border-left-color: var(--text-muted, #94a3b8); background: var(--bp-surface); }
.bp-absence button:hover:not(:disabled) { border-color: var(--bp-line-strong); background: var(--bp-surface); }

/* Formulare */
.bp-dialog label { font-size: 12px; font-weight: 600; display: flex; flex-direction: column; gap: 7px; color: var(--bp-text-2); }
.bp-dialog input, .bp-dialog select, .bp-dialog textarea { font: inherit; font-size: 14px; font-weight: 400; border: 1px solid var(--bp-line-strong); border-radius: var(--radius-md, 10px); padding: 10px 12px; min-height: 42px; color: var(--bp-text); background: var(--bg-input, #fff); width: 100%; }
.bp-dialog textarea { resize: vertical; }
.bp-dialog fieldset { border: 1px solid var(--bp-line); border-radius: var(--radius-md, 10px); padding: 14px; }
.bp-dialog legend { font-size: 12px; font-weight: 600; color: var(--bp-text-2); }
.bp-dialog input[type=checkbox] { width: 18px; min-height: 18px; accent-color: var(--bp-accent); }
.bp-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 1000px; }
.bp-wide { grid-column: 1 / -1; }
.bp-team, .bp-checklist { display: flex; gap: 14px; flex-wrap: wrap; }
.bp-team label, .bp-checklist label { flex-direction: row; align-items: center; }
.bp-checklist { flex-direction: column; margin: 20px 0; }
.bp-form-actions { margin-top: 24px; border-top: 1px solid var(--bp-line); padding-top: 20px; }
.bp-position { display: grid; grid-template-columns: 2fr 1fr 1fr auto; align-items: end; gap: 10px; margin: 12px 0; }

/* Tabellen, Verlauf und Meldungen */
.bp-table-wrap { overflow: auto; }
.bp-dialog table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bp-dialog td, .bp-dialog th { text-align: left; border-bottom: 1px solid var(--bp-line); padding: 14px 10px; vertical-align: top; }
.bp-dialog th { font-size: 11px; color: var(--bp-muted); font-weight: 600; white-space: nowrap; }
.bp-dialog td button { margin: 3px 5px 3px 0; }
.bp-dialog .bp-facts th { width: 220px; color: var(--bp-muted); font-size: 12px; white-space: normal; }
.bp-dialog .bp-facts td { overflow-wrap: anywhere; }
.bp-dialog details { border-bottom: 1px solid var(--bp-line); padding: 12px 0; }
.bp-dialog summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.bp-dialog details .bp-table-wrap { margin-top: 10px; }
.bp-error { padding: 14px 20px; margin: 14px 32px; background: var(--bp-danger-bg); border: 1px solid #fecaca; color: var(--bp-danger); border-radius: var(--radius-md, 10px); font-size: 13px; }
.bp-error[hidden] { display: none; }
.bp-notice { padding: 14px; background: var(--bp-warn-bg); color: var(--bp-warn); border-radius: var(--radius-md, 10px); font-size: 13px; line-height: 1.6; }
.bp-dialog pre, .bm-dialog pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 280px; overflow: auto; font-size: 12px; }
.bp-loading { padding: 50px; }

/* Bestandsabgleich */
.bm-dialog { width: min(760px, calc(100vw - 40px)); max-width: none; max-height: 90dvh; overflow: auto; padding: 28px; }
.bm-dialog fieldset { border: 1px solid var(--bp-line); border-radius: var(--radius-md, 10px); padding: 16px; margin: 16px 0; }
.bm-dialog label { display: block; padding: 8px; }
.bm-dialog pre { margin-left: 25px; }

@media (max-width: 1000px) {
    .bp-calendar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bp-calendar > section { border-bottom: 1px solid var(--bp-line); min-height: 170px; }
    .bp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bp-order-grid, .bp-integration-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
    .bp-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
    .bp-dialog header { padding: 20px 16px; }
    .bp-dialog h2 { font-size: 22px; }
    .bp-dialog nav { padding: 0 12px 12px; flex-wrap: nowrap; overflow-x: auto; }
    .bp-dialog nav button { white-space: nowrap; min-height: 42px; }
    .bp-dialog main { padding: 18px 16px; }
    .bp-fields, .bp-two, .bp-order-grid, .bp-integration-grid { grid-template-columns: 1fr; }
    .bp-calendar { grid-template-columns: 1fr; }
    .bp-stat { padding: 14px; }
    .bp-stat strong { font-size: 23px; }
    .bp-panel { padding: 2px 14px 14px; }
    .bp-dialog .bp-areas { padding: 4px 14px; }
    .bp-toolbar > label { flex: 1; min-width: 130px; }
    .bp-dialog button { min-height: 42px; }
    .bp-dialog input, .bp-dialog select, .bp-dialog textarea { font-size: 16px; }
    .bp-position { grid-template-columns: 1fr 1fr; }
    .bp-error { margin: 12px 16px; }
    .bp-section { padding: 14px; }
    .bp-record { flex-direction: column; align-items: stretch; gap: 10px; }
    .bp-record button { align-self: flex-start; }
    .bp-dialog .bp-facts th { width: 40%; }
}
