/* =============================================================================
   ERP Holzbau – components.css: eigene Bausteine oberhalb von Blueprint
   (Stat-Tiles, Datentabelle, Formularraster, Vorschlagsliste, Drawer-Inhalte,
   Palette, Dropdown-Menüs, Meldungen, Scan-Ansicht, Hilfsklassen).
   ============================================================================= */

/* --------------------------------------------------------------- Hilfsklassen */
.spacer {
  flex: 1 1 auto;
}
.mono {
  font-family: var(--bp-typography-family-mono);
  font-size: 12px;
}
.text-right {
  text-align: right;
}
.nowrap {
  white-space: nowrap;
}
.muted {
  color: var(--bp-typography-color-muted);
}
.flex {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--grid-gap);
}
.mt-8 {
  margin-top: 8px;
}
.mt-16 {
  margin-top: 16px;
}
.mb-8 {
  margin-bottom: 8px;
}
.skeleton-block {
  padding: 4px 0;
}
.view-panel {
  display: flex;
  flex-direction: column;
  gap: var(--grid-gap);
}
.view-panel > .dash-grid {
  width: 100%;
}
.workspace-head .head-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.workspace-head .head-actions .bp6-button {
  min-height: var(--hit);
}
.navbar-title {
  font-size: 13px;
  color: var(--bp-typography-color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
#navbar .bp6-navbar-heading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}
#navbar .bp6-navbar-heading .bp6-icon {
  color: var(--bp-intent-primary-rest);
}
#navbar .navbar-status.err .bp6-icon {
  color: var(--bp-intent-danger-rest);
}
#navbar .navbar-status.offline .bp6-icon {
  color: var(--bp-intent-warning-rest);
}
#navbar .navbar-status .bp6-icon {
  color: var(--bp-intent-success-rest);
}
#navbar .navbar-status-text {
  font-size: 11px;
  margin-left: 4px;
  color: var(--bp-typography-color-muted);
  font-variant-numeric: tabular-nums;
}
.sidebar .sidebar-group {
  padding: 6px 0 0 20px;
  margin: 0;
  border: 0;
  height: 24px;
  overflow: hidden;
  box-sizing: border-box;
}
.sidebar .bp6-menu-divider {
  margin: 6px 0 0;
}
.sidebar .sidebar-group .bp6-heading {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bp-typography-color-muted);
  opacity: 0;
  transition: opacity 120ms linear;
  margin: 0;
  padding: 0; /* Blueprint gibt dem h6 im Menükopf 10 px oben – würde die Zeile abschneiden */
  line-height: 16px;
}
body.sidebar-expanded .sidebar .sidebar-group .bp6-heading,
.sidebar:focus-within .sidebar-group .bp6-heading {
  opacity: 1;
}
@media (hover: hover) and (min-width: 1200px) {
  .sidebar:hover .sidebar-group .bp6-heading {
    opacity: 1;
  }
}
.sidebar .bp6-menu-item .sidebar-badge {
  margin-right: 8px;
}
.sidebar li {
  list-style: none;
}
.sidebar .bp6-menu-item .bp6-icon-large {
  font-size: 20px;
}

/* ----------------------------------------------------------- Widget-Ergänzung */
.widget > .panel-head .panel-meta {
  margin-left: auto;
}
.widget > .panel-head .panel-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}
.widget > .panel-head .panel-actions .bp6-button {
  min-height: 24px;
}
.widget > .panel-head .bp6-icon {
  color: var(--bp-typography-color-muted);
}
.widget.widget-danger {
  box-shadow: inset 3px 0 0 var(--bp-intent-danger-rest);
}
.widget.widget-warning {
  box-shadow: inset 3px 0 0 var(--bp-intent-warning-rest);
}
.widget.widget-flat {
  padding: 0;
}
.widget.widget-flat > .panel-head {
  padding: 12px 12px 0;
}
.widget .panel-body > .data-table-wrap .table-scroll {
  max-height: 420px;
}
.widget .panel-body .bp6-callout {
  margin-bottom: 8px;
}
.panel-body p:last-child {
  margin-bottom: 0;
}

/* -------------------------------------------------------------- Stat-Tiles */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--grid-gap);
}
/* Sechs Kacheln: feste Reihen 6 → 3 → 2 statt „5 + 1 verwaist“ (z. B. CRM-Übersicht auf dem iPad) */
.kpi-grid.kpi-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
@media (max-width: 1199.98px) {
  .kpi-grid.kpi-6 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 719.98px) {
  .kpi-grid.kpi-6 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 84px;
  padding: 10px 12px;
  background: var(--bp-surface-background-color-default, #fff);
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: var(--bp-surface-border-radius, 4px);
  color: inherit;
  text-decoration: none;
  position: relative;
}
body.bp6-dark .stat-tile {
  background: var(--bp-palette-dark-gray-4, #2f343c);
}
.stat-tile.clickable {
  cursor: pointer;
}
.stat-tile.clickable:hover {
  border-color: var(--bp-intent-primary-rest);
  text-decoration: none;
}
.stat-tile:focus-visible {
  outline: 2px solid var(--bp-emphasis-focus-color, #2d72d2);
  outline-offset: 1px;
}
.stat-tile .stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.stat-tile .stat-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--bp-typography-color-muted);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-tile .stat-icon {
  color: var(--bp-typography-color-muted);
}
.stat-tile .stat-value {
  font-size: var(--fs-tile);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.stat-tile .stat-value.hero {
  font-size: var(--fs-hero);
}
.stat-tile .stat-unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--bp-typography-color-muted);
}
.stat-tile .stat-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  min-height: 16px;
}
.stat-tile .stat-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-tile .stat-spark {
  margin-left: auto;
  display: inline-flex;
}
.stat-tile .stat-delta {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stat-tile .stat-delta.good {
  color: var(--viz-delta-good);
}
.stat-tile .stat-delta.bad {
  color: var(--viz-critical);
}
.stat-tile .stat-delta.flat {
  color: var(--bp-typography-color-muted);
}
.stat-tile.tone-good {
  box-shadow: inset 0 3px 0 var(--viz-good);
}
.stat-tile.tone-warning {
  box-shadow: inset 0 3px 0 var(--viz-warning);
}
.stat-tile.tone-critical {
  box-shadow: inset 0 3px 0 var(--viz-critical);
}
.stat-tile.tone-critical .stat-value {
  color: var(--viz-critical);
}
.stat-tile.tone-warning .stat-value {
  color: var(--viz-serious);
}
.stat-tile.tone-neutral .stat-value {
  color: inherit;
}

/* ------------------------------------------------------------- Datentabelle */
.data-table-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.table-toolbar .table-filter {
  min-width: 160px;
  max-width: 260px;
}
.table-toolbar .table-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.table-toolbar .bp6-html-select select {
  height: 24px;
  font-size: 12px;
  padding-right: 22px;
}
.table-scroll {
  overflow: auto;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: var(--bp-surface-border-radius, 4px);
  max-height: min(70vh, 720px);
}
.table-scroll table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bp-palette-light-gray-4, #edeff2);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bp-typography-color-muted);
  white-space: nowrap;
  box-shadow: inset 0 -1px 0 var(--bp-surface-border-color-default);
}
body.bp6-dark .table-scroll thead th {
  background: var(--bp-palette-dark-gray-3, #2f343c);
}
.data-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.data-table th.sortable:hover {
  color: var(--bp-typography-color-default);
}
.data-table th .sort-icon {
  margin-left: 4px;
  opacity: 0.35;
  font-size: 12px;
  vertical-align: middle;
}
.data-table th.sorted .sort-icon {
  opacity: 1;
  color: var(--bp-intent-primary-rest);
}
.data-table td,
.data-table th {
  vertical-align: middle;
}
.data-table td.num,
.data-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.data-table tbody tr.selected td {
  background: var(--bp-surface-layer-primary, rgba(45, 114, 210, 0.12)) !important;
}
.data-table tbody tr.row-danger td:first-child {
  box-shadow: inset 3px 0 0 var(--viz-critical);
}
.data-table tbody tr.row-warning td:first-child {
  box-shadow: inset 3px 0 0 var(--viz-warning);
}
.data-table tbody tr.row-good td:first-child {
  box-shadow: inset 3px 0 0 var(--viz-good);
}
.data-table tbody tr.muted-row td {
  color: var(--bp-typography-color-muted);
}
.data-table tr.empty-row td {
  padding: 24px 12px;
}
.data-table tr.empty-row .bp6-non-ideal-state {
  padding: 0;
}
.data-table td .bp6-tag {
  vertical-align: middle;
}
.data-table td .bp6-button.bp6-small {
  min-height: 22px;
}
.table-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.kv-table td:first-child {
  width: 30%;
}
@media (max-width: 719.98px) {
  .hide-sm {
    display: none !important;
  }
}
@media (max-width: 1199.98px) {
  .hide-md {
    display: none !important;
  }
}

/* --------------------------------------------------------------- Formulare */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 12px;
}
.form-grid.cols-1 {
  grid-template-columns: minmax(0, 1fr);
}
.form-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.form-grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.form-grid .span-2 {
  grid-column: span 2;
}
.form-grid .span-3 {
  grid-column: span 3;
}
.form-grid .span-all {
  grid-column: 1 / -1;
}
.form-grid .bp6-form-group {
  margin: 0 0 8px;
  min-width: 0;
}
.form-grid .bp6-label {
  font-size: 12px;
  margin-bottom: 3px;
}
.form-grid .bp6-label .bp6-text-muted {
  font-weight: 400;
}
.form-grid .bp6-form-group.required .bp6-label .bp6-text-muted {
  display: none;
}
.form-grid .bp6-form-group.required .bp6-label::after {
  content: ' *';
  color: var(--bp-intent-danger-rest);
}
.form-grid .bp6-form-helper-text {
  font-size: 11px;
}
.form-grid .field-error {
  color: var(--bp-intent-danger-rest);
}
.form-grid .bp6-form-group.bp6-intent-danger .bp6-input,
.form-grid .bp6-form-group.bp6-intent-danger select {
  box-shadow: 0 0 0 1px var(--bp-intent-danger-rest);
}
.form-grid .form-error {
  margin: 4px 0;
}
.form-grid .form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 4px;
}
.form-grid .form-actions .bp6-button {
  min-height: var(--hit);
}
.form-grid .static-value {
  min-height: 30px;
  display: flex;
  align-items: center;
  font-weight: 500;
}
.form-grid .bp6-html-select select,
.form-grid .bp6-input,
.form-grid textarea.bp6-input {
  min-height: var(--hit);
  font-size: var(--fs-ui);
}
.form-grid textarea.bp6-input {
  min-height: 56px;
  resize: vertical;
}
.form-grid.large .bp6-input,
.form-grid.large select {
  min-height: max(40px, var(--hit));
  font-size: 16px;
}
.form-card .form-desc {
  margin: -4px 0 8px;
}
.form-card .panel-head .bp6-icon {
  color: var(--bp-typography-color-muted);
}
.bp6-html-select select {
  width: 100%;
}
.form-dialog .bp6-dialog-body {
  padding-bottom: 8px;
}
.form-dialog .form-grid .form-actions {
  justify-content: flex-end;
}
@media (max-width: 719.98px) {
  .form-grid,
  .form-grid.cols-3,
  .form-grid.cols-4 {
    grid-template-columns: minmax(0, 1fr);
  }
  .form-grid .span-2,
  .form-grid .span-3 {
    grid-column: span 1;
  }
}

/* Scan-Eingabe */
.scan-field .bp6-input.scan-input {
  font-family: var(--bp-typography-family-mono);
  font-size: var(--fs-scan);
  letter-spacing: 0.02em;
  min-height: max(var(--hit), 40px);
}
.scan-field > .bp6-icon {
  top: 50%;
  transform: translateY(-50%);
}
.scan-field.bp6-large .bp6-input.scan-input {
  font-size: 22px;
  min-height: 48px;
}

/* Vorschlagsliste */
.suggest-anchor {
  position: relative;
}
.suggest {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 25;
  max-height: 320px;
  overflow: auto;
  padding: 4px;
}
.suggest .bp6-menu-item {
  min-height: 30px;
}
body.density-halle .suggest .bp6-menu-item {
  min-height: 44px;
  font-size: 16px;
}

/* ------------------------------------------------------------------ Drawer */
#drawer-root .bp6-drawer-header {
  gap: 10px;
  align-items: flex-start;
  padding: 12px 16px;
}
#drawer-root .bp6-drawer-header .bp6-icon-large {
  margin-top: 2px;
  color: var(--bp-typography-color-muted);
}
#drawer-root .drawer-titles {
  flex: 1 1 auto;
  min-width: 0;
}
#drawer-root .drawer-titles .bp6-heading {
  margin: 0;
  font-size: 16px;
  line-height: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#drawer-root .drawer-sub {
  margin-top: 2px;
}
#drawer-root .drawer-tags {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}
#drawer-root .bp6-drawer-body {
  padding: 12px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#drawer-root .drawer-wide {
  width: min(760px, 100%);
}
.detail-section > h4 {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--bp-typography-color-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.detail-section > h4 .spacer {
  flex: 1;
}
.detail-section > h4 .bp6-button {
  min-height: 22px;
}
.detail-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.detail-actions .bp6-button {
  min-height: var(--hit);
}
.kv {
  display: grid;
  grid-template-columns: minmax(110px, 35%) 1fr;
  gap: 4px 12px;
  margin: 0;
  font-size: 13px;
}
.kv dt {
  color: var(--bp-typography-color-muted);
}
.kv dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}
.kv dd.num {
  font-variant-numeric: tabular-nums;
}

/* Dialog */
#dialog-root .bp6-dialog {
  width: min(560px, calc(100vw - 32px));
}
#dialog-root .bp6-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#dialog-root .bp6-dialog-footer-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Palette */
#palette-root .palette {
  width: min(680px, calc(100vw - 32px));
  padding-bottom: 0;
}
#palette-root .palette-input {
  margin: 8px;
}
#palette-root .palette-input .bp6-input {
  padding-left: 36px;
  padding-right: 56px;
}
#palette-root .palette-input .palette-hint {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}
#palette-root .palette .bp6-menu {
  max-height: min(60vh, 480px);
  overflow: auto;
  margin: 0;
  border-radius: 0 0 4px 4px;
}
#palette-root .palette .bp6-menu-header {
  padding: 6px 12px 2px;
}
#palette-root .palette .bp6-menu-item {
  min-height: 32px;
}

/* Dropdown-Menüs (Navbar) */
.dropdown {
  position: fixed;
  z-index: 38;
  min-width: 220px;
  margin: 0;
}
.dropdown li {
  list-style: none;
}

/* Meldungen */
.notif-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notif {
  padding: 10px 12px;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
  display: grid;
  gap: 4px;
}
.notif.read {
  opacity: 0.6;
}
.notif .notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.notif .notif-title {
  font-weight: 600;
}
.notif .bp6-button {
  justify-self: start;
}

/* Toast-Animation */
#toast-root .bp6-toast {
  animation: toast-in 160ms ease-out;
}
#toast-root .bp6-toast.toast-out {
  opacity: 0;
  transform: translateY(8px);
  transition: all 160ms ease-in;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ----------------------------------------------------------- Dashboard */
.dash-actions .bp6-button {
  justify-content: flex-start;
}
.dash-actions .bp6-button .bp6-icon {
  color: var(--bp-intent-primary-rest);
}
body.bp6-dark .dash-actions .bp6-button .bp6-icon {
  color: var(--bp-palette-blue-5, #8abbff);
}
.due-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.due-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid var(--bp-surface-border-color-default);
  font-size: 13px;
}
.due-row.clickable {
  cursor: pointer;
}
.due-row.clickable:hover {
  background: var(--bp-surface-background-color-default-hover);
}
.due-row .due-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.due-row .due-when {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.meter-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* Zuteilung: Sitzungsprotokoll */
.session-log {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow: auto;
}
.session-log .entry {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
  font-size: 13px;
}
.preview-box {
  min-height: 48px;
  padding: 8px 10px;
  border-radius: 4px;
  background: var(--bp-surface-background-color-default-hover, rgba(143, 153, 168, 0.1));
  font-size: 13px;
  display: grid;
  gap: 4px;
}
.preview-box .bp6-tag {
  justify-self: start;
}

/* Scan-Ansicht */
.scan-panel .scan-result {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.scan-panel .scan-result .bp6-card {
  background: var(--bp-palette-dark-gray-3, #2f343c);
}
.scan-panel .scan-actions .bp6-button {
  min-height: 56px;
  font-size: 16px;
}
.scan-panel .scan-recent .bp6-menu {
  background: transparent;
}
.scan-panel .scan-recent .bp6-menu-item {
  color: inherit;
}
.scan-panel .scan-camera .bp6-button {
  position: absolute;
  right: 8px;
  top: 8px;
}

/* Etiketten */
.label-preview {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.label-preview .label-img {
  background: #fff;
  border: 1px solid var(--bp-surface-border-color-default);
  padding: 8px;
  border-radius: 4px;
  max-width: 100%;
}
.label-preview img {
  display: block;
  max-width: 420px;
  width: 100%;
  height: auto;
}

/* Konsole */
.console-out {
  max-height: 60vh;
  overflow: auto;
  font-size: 12px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.console-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12px;
}

/* Baum (Kategorien) */
.tree-row .indent {
  display: inline-block;
  width: 16px;
}

/* Status-Badges neben Titeln */
.title-tags {
  display: inline-flex;
  gap: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

/* Fokus sichtbar */
.data-table tbody tr:focus-visible {
  outline: 2px solid var(--bp-emphasis-focus-color, #2d72d2);
  outline-offset: -2px;
}

/* --------------------------------------------------- Nachbesserungen (Sichtprüfung 2026-09-19) */
#navbar .navbar-search .bp6-input-group {
  position: relative;
}
#navbar .navbar-search .bp6-input-group .bp6-input {
  padding-right: 64px;
}
#navbar .navbar-search .bp6-input-group .bp6-tag {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  pointer-events: none;
}
.workspace .bp6-tab .bp6-icon {
  margin-right: 6px;
  vertical-align: -1px;
}
.workspace .bp6-tab .bp6-tag {
  margin-left: 6px;
}
.workspace .bp6-breadcrumb .bp6-icon {
  margin-right: 6px;
}
/* Dialog/Palette sichtbar: layout.css setzt #…-root .bp6-dialog auf opacity 0 (ID-Spezifität) – hier die Öffnungsregel mit gleicher Spezifität */
#dialog-root .bp6-overlay-open .bp6-dialog,
#palette-root .bp6-overlay-open .bp6-dialog {
  opacity: 1;
  transform: none;
}
/* Blueprint gibt .bp6-overlay-backdrop z-index 20 – Dialog, Palette und Drawer müssen darüber liegen, sonst fängt der Hintergrund die Klicks ab */
#dialog-root .bp6-dialog-container,
#palette-root .bp6-dialog-container,
#drawer-root .bp6-drawer {
  z-index: 21;
}
/* Hintergrund der Overlays unter den Inhalt: Blueprint gibt .bp6-overlay-backdrop z-index 20, der Drawer selbst hat keinen – Klicks landeten auf dem Hintergrund */
#drawer-root > .bp6-overlay > .bp6-overlay-backdrop,
#dialog-root > .bp6-overlay > .bp6-overlay-backdrop,
#palette-root > .bp6-overlay > .bp6-overlay-backdrop {
  z-index: 0;
}
#drawer-root .bp6-drawer {
  position: fixed;
  z-index: 2;
}
#dialog-root .bp6-dialog-container,
#palette-root .bp6-dialog-container {
  z-index: 2;
}

/* Callouts mit eigenem Icon-Element (statt Blueprint-Pseudoelement) */
.bp6-callout.has-icon {
  position: relative;
  padding-left: 40px;
}
.bp6-callout.has-icon > .callout-icon {
  position: absolute;
  left: 10px;
  top: 10px;
}
.bp6-callout.has-icon.bp6-compact {
  padding-left: 32px;
}
.bp6-callout.has-icon.bp6-compact > .callout-icon {
  left: 8px;
  top: 7px;
}
#update-banner.has-icon > .callout-icon {
  top: 50%;
  transform: translateY(-50%);
}
/* Kennzahl-Reihe im Dashboard-Raster: Reihenfolge nur auf dem Handy über --order-sm */
@media (max-width: 719.98px) {
  .dash-grid > .kpi-grid {
    order: var(--order-sm, 0);
  }
}
/* Zuteilung: zwei Spalten, Warenkorb */
.alloc-layout {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: var(--grid-gap);
  align-items: start;
}
@media (max-width: 1199.98px) {
  .alloc-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}
.cart {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cart-line {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
}
.cart-line.has-error {
  border-color: var(--bp-intent-danger-rest);
  box-shadow: inset 3px 0 0 var(--bp-intent-danger-rest);
}
.cart-line .cart-main {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
}
.cart-line .cart-fields {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.cart-line .cart-fields .bp6-html-select select {
  max-width: 220px;
}
.cart-line .cart-fields .bp6-input,
.cart-line .cart-fields select {
  min-height: var(--hit);
}
.preview-box .bp6-intent-danger {
  color: var(--bp-intent-danger-rest);
}
.preview-box .bp6-intent-warning {
  color: var(--bp-intent-warning-rest);
}
.wx-site {
  padding: 6px 8px;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wx-site:hover {
  background: var(--bp-surface-background-color-default-hover);
}
.wx-site .wx-strip.compact {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
/* Tabellen: sichtbarer schmaler Scrollbalken, Aktionszellen nicht umbrechen */
.table-scroll {
  scrollbar-width: thin;
}
.table-scroll::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}
.table-scroll::-webkit-scrollbar-thumb {
  background: var(--bp-palette-gray-3, #8f99a8);
  border-radius: 4px;
}
.data-table td:last-child .bp6-button,
.data-table td .flex.nowrap {
  white-space: nowrap;
}
.data-table td .bp6-tag + span {
  white-space: nowrap;
}
.bp6-button.nowrap {
  white-space: nowrap;
}
/* Tabellenzelle mit Tag + Text nebeneinander (Nächster Ablauf) */
.data-table td .flex {
  flex-wrap: nowrap;
}
/* Vertrieb: Positions-Editor, Summen */
#dialog-root .doc-dialog {
  width: min(920px, calc(100vw - 32px));
}
.doc-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 55vh;
  overflow: auto;
  padding-right: 2px;
}
.doc-line {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 6px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
}
.doc-line .doc-line-no {
  padding-top: 6px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.doc-line .doc-line-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.doc-line .doc-line-main .flex {
  flex-wrap: wrap;
}
.doc-line .doc-line-sum {
  min-width: 90px;
  text-align: right;
}
.doc-line .doc-line-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.doc-sums {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  align-items: center;
}
.doc-sums.right {
  justify-content: flex-end;
}
.doc-sums .doc-gross {
  font-size: 15px;
}

/* ------------------------------------------------------------ Dokumente (Ausbau 9) */
.doc-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.doc-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
  cursor: pointer;
}
.doc-row:hover {
  background: var(--bp-surface-background-color-default-hover);
}
.doc-row .doc-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: var(--bp-surface-background-color-default-hover);
  color: var(--bp-typography-color-muted);
}
.doc-row .doc-main {
  min-width: 0;
}
.doc-row .doc-title {
  font-weight: 600;
  display: flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-row .doc-sub {
  font-size: 12px;
  color: var(--bp-typography-color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-row .doc-right {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.doc-preview {
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
  background: var(--viz-page);
  min-height: 420px;
  height: 60vh;
  overflow: hidden;
}
.doc-preview.tall {
  height: calc(100dvh - var(--navbar-h) - 2 * var(--ws-pad) - 160px);
  min-height: 480px;
}
.doc-preview iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.doc-preview img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  margin: 0 auto;
}
.doc-drop {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px;
  border: 1px dashed var(--bp-surface-border-color-default);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
}
.doc-drop:hover {
  border-color: var(--bp-intent-primary-rest);
}
.doc-drop .doc-file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.doc-logo {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
  background: #fff;
  padding: 10px;
}
.doc-logo img {
  max-height: 80px;
  max-width: 100%;
}
.doc-dispatch {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}
.doc-section .bp6-button {
  margin-left: 4px;
}
.mail-body {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 13px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
  background: var(--bp-surface-background-color-default);
}
.doc-dispatch.clickable {
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 3px;
}
.doc-dispatch.clickable:hover {
  background: var(--bp-surface-background-color-default-hover);
}

/* ------------------------------------------------------------ Intuitiv-Ausbau: Neu-Menü, Hilfe, Stepper, Checkliste */
.navbar-new {
  margin-right: 6px;
}
.navbar-new .bp6-button-text {
  font-weight: 600;
}
.bp6-menu-item.new-item .bp6-menu-item-label {
  font-size: 11px;
}
.head-help {
  opacity: 0.8;
}
.help-body .help-intro {
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}
.help-body h4 {
  margin: 8px 0 4px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bp-typography-color-muted);
}
.help-tasks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.help-task {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
  font-size: 13px;
}
.help-task > .bp6-icon {
  color: var(--bp-intent-primary-rest);
}
.help-body kbd {
  font-family: var(--bp-typography-family-monospace, ui-monospace, monospace);
  font-size: 11px;
  padding: 1px 6px;
  border: 1px solid var(--bp-surface-border-color-default);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bp-surface-background-color-default);
}
/* Prozess-Stepper */
.proc-stepper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 10px 12px;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
  background: var(--bp-surface-background-color-default);
}
body.bp6-dark .proc-stepper {
  background: var(--bp-palette-dark-gray-4);
}
.proc-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  flex: 1 1 auto;
}
.proc-step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--bp-typography-color-muted);
  position: relative;
  padding-right: 22px;
}
.proc-step:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 6px;
  top: 50%;
  width: 12px;
  height: 1px;
  background: var(--bp-surface-border-color-default);
}
.proc-step:last-child {
  padding-right: 0;
}
.proc-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--bp-surface-border-color-default);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex: 0 0 auto;
}
.proc-step.is-done {
  color: var(--bp-typography-color-default);
}
.proc-step.is-done .proc-dot {
  background: var(--viz-good);
  border-color: var(--viz-good);
  color: #fff;
}
.proc-step.is-current {
  color: var(--bp-typography-color-default);
  font-weight: 600;
}
.proc-step.is-current .proc-dot {
  background: var(--bp-intent-primary-rest);
  border-color: var(--bp-intent-primary-rest);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(45, 114, 210, 0.25);
}
.proc-step.is-stopped .proc-dot {
  background: var(--viz-critical);
  border-color: var(--viz-critical);
  color: #fff;
}
.proc-next {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.proc-next-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bp-typography-color-muted);
}
/* Erste-Schritte-Checkliste */
.checklist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
  font-size: 13px;
}
.check-item.is-done {
  opacity: 0.7;
}
.check-item .check-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--bp-surface-border-color-default);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.check-item.is-done .check-mark {
  background: var(--viz-good);
  border-color: var(--viz-good);
  color: #fff;
}
.check-item .check-text {
  flex: 1 1 auto;
  min-width: 0;
}
.check-item .check-text small {
  display: block;
  color: var(--bp-typography-color-muted);
}
.check-progress {
  height: 6px;
  border-radius: 3px;
  background: var(--bp-surface-border-color-default);
  overflow: hidden;
}
.check-progress > span {
  display: block;
  height: 100%;
  background: var(--viz-good);
}
.doc-section > h4 {
  flex-wrap: wrap;
  gap: 4px;
}
.doc-section > h4 .bp6-button {
  white-space: nowrap;
}
/* Dashboard-Kachel „Herstellerkatalog“: Trefferzeilen der Schnellsuche */
.cat-hits {
  gap: 6px;
}
.cat-hit {
  padding: 6px 8px;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cat-hit:hover,
.cat-hit:focus-visible {
  background: var(--bp-surface-background-color-default-hover);
}
.cat-hit-name {
  font-weight: 500;
  /* Zwei Zeilen: Katalognamen tragen das Unterscheidungsmerkmal (Maße, Ausführung) am Ende */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cat-hit-meta {
  font-size: 12px;
  align-items: center;
  gap: 6px;
}
.cat-sub {
  margin: 4px 0 0;
  color: var(--bp-typography-color-muted);
}
/* Herstellerkatalog: vollständige Herstellerliste rechts, scrollbar statt endlos hoch */
.mfr-list {
  max-height: clamp(280px, 52vh, 620px);
  overflow-y: auto;
  scrollbar-width: thin;
}

/* =========================================================== Ausbau 12 – „Ultimativ intuitiv“ */
/* Ein Satz unter dem Seitentitel: wofür ist der Bereich da */
.workspace-head .workspace-lead {
  flex: 0 0 100%; /* eigene Zeile unter Titel und Aktionen (kein max-width: sonst rutscht sie daneben) */
  margin: -4px 0 0;
  font-size: 13px;
  line-height: 1.45;
}
.workspace-lead > .lead-text {
  display: inline-block;
  max-width: 920px;
}
.workspace-lead .lead-more {
  white-space: nowrap;
  font-weight: 500;
}
.workspace-lead .lead-more .bp6-icon {
  font-size: 12px;
  vertical-align: -1px;
}
body.density-compact .workspace-lead {
  display: none;
}
/* Server-Status: Punkt reicht, Text nur bei „langsam“/„offline“ */
#navbar .navbar-status.slow .bp6-icon {
  color: var(--bp-intent-warning-rest);
}
#navbar .navbar-status-text:empty {
  display: none;
}
/* Meldungen führen zum Datensatz */
.notif.notif-link {
  cursor: pointer;
  border-radius: 4px;
  transition: background 120ms;
}
.notif.notif-link:hover,
.notif.notif-link:focus-visible {
  background: var(--bp-surface-layer-primary, rgba(45, 114, 210, 0.08));
  outline: none;
}
.notif .notif-go {
  margin-left: 4px;
  opacity: 0.45;
  font-size: 12px;
  vertical-align: -1px;
}
.notif.notif-link:hover .notif-go {
  opacity: 1;
  color: var(--bp-intent-primary-rest);
}
/* „Neu“-Menü: Einträge des aktuellen Bereichs zuerst */
.dropdown .bp6-menu-header.new-here h6 {
  color: var(--bp-intent-primary-rest);
}
/* Tabellenzeilen, die sich öffnen lassen: Pfeil am Zeilenende beim Überfahren / Fokus */
.data-table tbody tr.row-open td:last-child {
  padding-right: 24px;
  background-repeat: no-repeat;
  background-position: right 7px center;
  background-size: 10px 10px;
}
.data-table tbody tr.row-open:hover td:last-child,
.data-table tbody tr.row-open:focus-visible td:last-child {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%235f6b7c' d='M6.3 3.3a1 1 0 0 0 0 1.4L9.6 8l-3.3 3.3a1 1 0 1 0 1.4 1.4l4-4a1 1 0 0 0 0-1.4l-4-4a1 1 0 0 0-1.4 0z'/%3E%3C/svg%3E");
}
body.bp6-dark .data-table tbody tr.row-open:hover td:last-child,
body.bp6-dark .data-table tbody tr.row-open:focus-visible td:last-child {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23abb3bf' d='M6.3 3.3a1 1 0 0 0 0 1.4L9.6 8l-3.3 3.3a1 1 0 1 0 1.4 1.4l4-4a1 1 0 0 0 0-1.4l-4-4a1 1 0 0 0-1.4 0z'/%3E%3C/svg%3E");
}
.data-table tbody tr.row-open:focus-visible td {
  background: var(--bp-surface-layer-primary, rgba(45, 114, 210, 0.1));
}
/* Zuletzt geöffnet (Dashboard-Aktionen, Fußzeile) */
.recent-row {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  flex-wrap: wrap;
}
.recent-row .recent-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.recent-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}
.recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 260px;
  padding: 3px 10px 3px 8px;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  min-height: 26px;
}
.recent-chip .recent-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-chip .bp6-icon {
  color: var(--bp-intent-primary-rest);
  font-size: 12px;
}
.recent-chip:hover,
.recent-chip:focus-visible {
  border-color: var(--bp-intent-primary-rest);
  background: var(--bp-surface-layer-primary, rgba(45, 114, 210, 0.08));
  outline: none;
}
/* Lager › Buchen: erst wählen, was passiert */
.book-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}
.book-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-height: 56px;
  transition:
    border-color 120ms,
    background 120ms;
}
.book-choice > .bp6-icon {
  color: var(--bp-intent-primary-rest);
  flex: 0 0 auto;
}
.book-choice.is-fix > .bp6-icon {
  color: var(--bp-typography-color-muted);
}
.book-choice .book-choice-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.book-choice .book-choice-text strong {
  font-size: 13px;
  font-weight: 600;
}
.book-choice .book-choice-text small {
  font-size: 11px;
  color: var(--bp-typography-color-muted);
}
.book-choice:hover,
.book-choice:focus-visible {
  border-color: var(--bp-intent-primary-rest);
  outline: none;
}
.book-choice.active {
  border-color: var(--bp-intent-primary-rest);
  background: var(--bp-surface-layer-primary, rgba(45, 114, 210, 0.1));
  box-shadow: inset 0 0 0 1px var(--bp-intent-primary-rest);
}
.book-mode {
  margin: 0;
  font-size: 12px;
  white-space: nowrap;
}
.form-card.active {
  box-shadow: inset 0 0 0 1px var(--bp-intent-primary-rest);
}
/* Rundgang */
.tour {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}
.tour .tour-spot {
  position: fixed;
  border-radius: 8px;
  box-shadow:
    0 0 0 2px var(--bp-intent-primary-rest),
    0 0 0 9999px rgba(17, 20, 24, 0.62);
  transition:
    top 220ms ease,
    left 220ms ease,
    width 220ms ease,
    height 220ms ease;
  pointer-events: auto;
}
.tour .tour-card {
  position: fixed;
  padding: 14px 16px 12px;
  pointer-events: auto;
  transition:
    top 220ms ease,
    left 220ms ease;
  background: var(--bp-palette-white, #fff);
}
body.bp6-dark .tour .tour-card {
  background: var(--bp-palette-dark-gray-3, #2f343c);
}
.tour .tour-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.tour .tour-step {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--bp-typography-color-muted);
}
.tour .tour-card h4 {
  margin: 0 0 6px;
  font-size: 15px;
}
.tour .tour-card p {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
}
.tour .tour-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
body.has-tour {
  overflow: hidden;
}
@media (max-width: 640px) {
  .tour .tour-card {
    left: 12px !important;
    right: 12px;
    width: auto !important;
  }
  .book-choices {
    grid-template-columns: 1fr 1fr;
  }
  .book-choice .book-choice-text small {
    display: none;
  }
  .book-mode {
    display: none;
  }
}
.tour .tour-off {
  display: block;
  margin-top: 8px;
  text-align: right;
}
.tour .tour-card[data-side='over'] {
  box-shadow:
    0 0 0 1px var(--bp-intent-primary-rest),
    0 8px 24px rgba(0, 0, 0, 0.4);
}
/* ---- CRM (Ausbau 13) */
/* Pipeline-Board: Spalten je Phase, horizontal scrollbar; eigener Stapelkontext, damit Karten nie über
   Drawer/Dialog liegen (HANDOVER §5 Nr. 18) */
.crm-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(230px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  isolation: isolate;
  z-index: 0;
  min-height: 240px;
}
.crm-board-tools {
  flex-wrap: wrap;
  gap: 8px;
}
.crm-board-tools .bp6-input-group input {
  min-width: 180px;
}
.crm-board-empty {
  grid-column: 1 / -1;
}
.crm-switch {
  margin: 0;
  font-size: 12px;
  white-space: nowrap;
}
.crm-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: var(--bp-surface-border-radius, 4px);
  background: var(--bp-surface-background-color-default);
  transition: box-shadow 120ms ease;
}
.crm-col.is-over {
  box-shadow: inset 0 0 0 2px var(--bp-intent-primary-rest);
  background: var(--bp-surface-layer-primary, rgba(45, 114, 210, 0.08));
}
.crm-col.is-collapsed {
  grid-auto-columns: auto;
  min-width: 150px;
  max-width: 190px;
}
.crm-col-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--bp-surface-border-color-default);
  border-top: 3px solid var(--crm-stage, var(--bp-surface-border-color-default));
  border-radius: var(--bp-surface-border-radius, 4px) var(--bp-surface-border-radius, 4px) 0 0;
  position: sticky;
  top: 0;
  background: inherit;
  z-index: 1;
}
.crm-col.is-collapsed .crm-col-head {
  border-bottom: 0;
}
.crm-col-new {
  --crm-stage: var(--viz-s1);
}
.crm-col-qualified {
  --crm-stage: var(--viz-s7);
}
.crm-col-proposal {
  --crm-stage: var(--viz-s4);
}
.crm-col-negotiation {
  --crm-stage: var(--viz-s2);
}
.crm-col-won {
  --crm-stage: var(--viz-s3);
}
.crm-col-lost {
  --crm-stage: var(--viz-s8);
}
.crm-col-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  min-height: 120px;
  max-height: min(66vh, 760px);
  overflow-y: auto;
}
.crm-col-empty {
  text-align: center;
  padding: 14px 0;
  border: 1px dashed var(--bp-surface-border-color-default);
  border-radius: 4px;
}
.crm-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
  background: var(--bp-palette-white, #fff);
  cursor: pointer;
  user-select: none;
  transition:
    box-shadow 120ms ease,
    opacity 120ms ease;
}
body.bp6-dark .crm-card {
  background: var(--bp-palette-dark-gray-3, #2f343c);
}
.crm-card:hover,
.crm-card:focus-visible {
  box-shadow: 0 0 0 1px var(--bp-intent-primary-rest);
  outline: none;
}
.crm-card[draggable='true'] {
  cursor: grab;
}
.crm-card.is-dragging {
  opacity: 0.45;
  cursor: grabbing;
}
.crm-card.is-overdue {
  box-shadow: inset 3px 0 0 var(--viz-critical);
}
.crm-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.crm-grip {
  color: var(--bp-typography-color-muted);
  cursor: grab;
}
.crm-card-title {
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.crm-card-party {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--bp-typography-color-muted);
  min-width: 0;
}
.crm-card-party a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crm-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.crm-card-foot {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 2px -6px -4px;
}
/* Bezugs-Chips (Aktivitäten, Aufgaben) */
.crm-refs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px 10px;
}
/* Aufgabenzeilen (Übersicht, Drawer) */
.crm-task-list {
  display: flex;
  flex-direction: column;
}
.crm-task-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--bp-surface-border-color-default);
}
.crm-task-row:last-child {
  border-bottom: 0;
}
.crm-task-row.is-overdue {
  box-shadow: inset 3px 0 0 var(--viz-critical);
  padding-left: 8px;
}
.crm-task-row.is-done .crm-task-text > a {
  text-decoration: line-through;
  color: var(--bp-typography-color-muted);
}
.crm-task-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
/* Aktivitäten-Zeitleiste */
.crm-act-list {
  display: flex;
  flex-direction: column;
  position: relative;
}
.crm-act {
  display: flex;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
}
.crm-act + .crm-act::before {
  content: '';
  position: absolute;
  left: 19px;
  top: -8px;
  height: 8px;
  border-left: 2px solid var(--bp-surface-border-color-default);
}
.crm-act:hover,
.crm-act:focus-visible {
  background: var(--bp-surface-background-color-default-hover);
  outline: none;
}
.crm-act-icon {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bp-surface-layer-primary, rgba(45, 114, 210, 0.1));
  color: var(--viz-s1);
}
.crm-act-icon.kind-CALL {
  color: var(--viz-s3);
}
.crm-act-icon.kind-EMAIL {
  color: var(--viz-s7);
}
.crm-act-icon.kind-MEETING {
  color: var(--viz-s4);
}
.crm-act-icon.kind-VISIT {
  color: var(--viz-s2);
}
.crm-act-body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.crm-act-head {
  gap: 6px;
  flex-wrap: wrap;
}
.crm-act-excerpt {
  white-space: pre-line;
}
.crm-act-refs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
/* Verkaufschancen-Zeilen in Drawern */
.crm-opp-list {
  display: flex;
  flex-direction: column;
}
.crm-opp-row {
  padding: 5px 0;
  border-bottom: 1px solid var(--bp-surface-border-color-default);
  gap: 8px;
}
.crm-opp-row:last-child {
  border-bottom: 0;
}
/* Mitglieder-Dialog: Checkbox-Liste */
.crm-picklist {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
  padding: 4px 8px;
}
.crm-pick {
  margin: 0;
  padding: 4px 0 4px 26px;
  border-bottom: 1px solid var(--bp-surface-border-color-default);
}
.crm-pick:last-child {
  border-bottom: 0;
}
.crm-pick.is-muted {
  opacity: 0.55;
}
.crm-pick-text {
  display: inline-block;
  line-height: 1.3;
}
/* Handy: Board bleibt horizontal scrollbar; Karten-Knöpfe größer bei Touch-Dichte */
@media (max-width: 719.98px) {
  .crm-board {
    grid-auto-columns: minmax(82vw, 1fr);
  }
}
body.density-touch .crm-card-foot .bp6-button,
body.density-halle .crm-card-foot .bp6-button {
  min-height: 34px;
  min-width: 34px;
}

/* ------------------------------------------------------------ Administration (Ausbau 14) */
/* Checkbox-Liste (form.js type 'checks'): Rollen, Standardrollen, Modulwahl */
.check-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px 12px;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
  padding: 6px 8px;
}
.check-list.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.check-list .check-item {
  margin: 0;
  padding: 4px 0 4px 26px;
  line-height: 1.3;
}
.check-list .check-item.is-muted {
  opacity: 0.55;
}
.check-list .check-text {
  display: inline-block;
}
.check-list .check-text small {
  display: block;
  font-size: 11px;
}
/* Kopieren-Zeile: schreibgeschütztes Feld + Knopf */
.copy-field {
  display: flex;
  align-items: center;
  gap: 6px;
}
.copy-field .bp6-input-group {
  flex: 1;
  min-width: 0;
}
.copy-field .copy-value {
  text-overflow: ellipsis;
}
/* Einmal-Anzeige (generiertes Passwort, Einladungslink) */
.secret-box {
  display: grid;
  gap: 10px;
}
.secret-box .bp6-callout {
  margin: 0;
}
/* Rollen: Liste links, Rechte-Matrix rechts */
.role-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.role-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.role-item:hover {
  background: var(--bp-surface-fill-color-hover, rgba(143, 153, 168, 0.15));
}
.role-item.is-active {
  background: var(--bp-intent-primary-background-color, rgba(45, 114, 210, 0.15));
  border-color: var(--bp-intent-primary-color, #2d72d2);
}
.role-item .role-code {
  font-weight: 600;
  font-family: var(--bp-font-family-monospace, monospace);
  font-size: 12px;
}
.role-item .role-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.role-item .bp6-tag {
  flex: none;
}
.role-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 8px 12px;
  align-items: start;
}
.role-head .bp6-form-group {
  margin: 0;
}
.role-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.role-toolbar .bp6-control {
  margin: 0;
}
.role-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.role-actions .spacer {
  flex: 1;
}
/* Rechte-Matrix */
.perm-matrix-wrap {
  overflow: auto;
  max-height: 60vh;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
}
table.perm-matrix {
  width: 100%;
  border-collapse: collapse;
}
.perm-matrix .perm-group-head th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bp-surface-background-color-secondary, rgba(143, 153, 168, 0.12));
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: 11px;
  padding: 6px 10px;
}
body.bp6-dark .perm-matrix .perm-group-head th {
  background: var(--bp-palette-dark-gray-3, #2f343c);
}
.perm-matrix .perm-group-head .bp6-control {
  margin: 0;
  float: right;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
}
.perm-matrix td {
  vertical-align: middle;
  padding: 6px 10px;
}
.perm-matrix td.perm-check {
  width: 44px;
  text-align: center;
}
.perm-matrix td.perm-check .bp6-control {
  margin: 0;
  padding-left: 16px;
  min-height: 16px;
}
.perm-matrix .perm-label {
  display: block;
  font-weight: 500;
}
.perm-matrix .perm-key {
  font-family: var(--bp-font-family-monospace, monospace);
  font-size: 11px;
  opacity: 0.7;
}
.perm-matrix .perm-desc {
  display: block;
  font-size: 12px;
}
.perm-matrix tr.perm-row.is-on td {
  background: rgba(45, 114, 210, 0.06);
}
.perm-matrix.is-locked td,
.perm-matrix.is-locked th {
  opacity: 0.75;
}
.perm-matrix.is-all tr.perm-row td {
  opacity: 0.5;
}
/* Mandant: Modul-Liste */
.module-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
}
.module-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
}
.module-item.is-off {
  opacity: 0.55;
}
.module-item .bp6-icon {
  flex: none;
}
.module-item .module-name {
  flex: 1;
  min-width: 0;
}
/* Sitzungen: Gerät kürzen */
.ua-text {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
/* Hinweis-Callouts der Plattform am Anfang des Arbeitsbereichs */
.platform-notices {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}
.platform-notices .bp6-callout {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.platform-notices .notice-body {
  flex: 1;
  min-width: 0;
}
.platform-notices .notice-body h5 {
  margin: 0 0 2px;
}
.platform-notices .notice-close {
  flex: none;
  margin: -4px -6px 0 0;
}
.login-notices .bp6-callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
@media (max-width: 719.98px) {
  .role-head {
    grid-template-columns: 1fr;
  }
  .check-list.cols-2 {
    grid-template-columns: 1fr;
  }
  .ua-text {
    max-width: 140px;
  }
}

/* ------------------------------------------------ Datenschutz, Telemetrie, Standort (Ausbau 16) */
.consent-banner {
  position: fixed;
  left: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: calc(var(--z-login) + 5);
  width: 520px;
  max-width: calc(100% - 32px);
  max-height: calc(100% - 32px);
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
body.bp6-dark .consent-banner {
  background: var(--bp-palette-dark-gray-3, #2f343c);
}
.consent-banner.consent-out {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 200ms ease-in,
    transform 200ms ease-in;
}
:root[data-motion='full'] .consent-banner:not(.consent-out) {
  animation: m-enter-up 420ms var(--m-spring) 300ms backwards;
}
.consent-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.consent-head .bp6-icon {
  color: var(--bp-intent-primary-rest, #2d72d2);
}
body.bp6-dark .consent-head .bp6-icon {
  color: var(--bp-palette-blue-5, #8abbff);
}
.consent-head .bp6-heading {
  margin: 0;
}
.consent-lead {
  margin: 0;
  line-height: 1.5;
}
.consent-cats {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.consent-cats[hidden] {
  display: none;
}
.consent-cat .bp6-control {
  margin-bottom: 2px;
}
.consent-text {
  padding-left: 38px;
  line-height: 1.45;
}
.consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.consent-actions .consent-choose {
  margin-right: auto;
}
.consent-details table {
  width: 100%;
  margin-top: 4px;
}
.consent-details td,
.consent-details th {
  font-size: 12px;
}
.consent-details p {
  margin: 8px 0 0;
}
.consent-dialog.bp6-dialog {
  max-width: 600px;
}
.consent-hint {
  margin-bottom: 4px;
}
@media (max-width: 720px) {
  .consent-banner {
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    bottom: calc(var(--bottombar-h) + 8px + env(safe-area-inset-bottom, 0px));
  }
  .consent-actions .bp6-button {
    flex: 1 1 auto;
  }
}

/* Standortanzeige in der Kopfzeile */
.loc-indicator {
  display: inline-flex;
  align-items: center;
}
.loc-indicator .loc-btn {
  position: relative;
}
.loc-indicator.loc-off .loc-btn .bp6-icon {
  color: var(--bp-typography-color-muted);
}
.loc-indicator.loc-on .loc-btn .bp6-icon,
.loc-indicator.loc-trip .loc-btn .bp6-icon {
  color: var(--bp-intent-success-rest, #238551);
}
body.bp6-dark .loc-indicator.loc-on .loc-btn .bp6-icon,
body.bp6-dark .loc-indicator.loc-trip .loc-btn .bp6-icon {
  color: var(--bp-palette-green-5, #72ca9b);
}
.loc-indicator.loc-paused .loc-btn .bp6-icon,
.loc-indicator.loc-warn .loc-btn .bp6-icon {
  color: var(--bp-intent-warning-rest, #c87619);
}
.loc-indicator.loc-on .loc-btn::after,
.loc-indicator.loc-trip .loc-btn::after {
  content: '';
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bp-palette-green-4, #32a467);
  box-shadow: 0 0 0 0 rgba(50, 164, 103, 0.6);
}
:root[data-motion='full'] .loc-indicator.loc-on .loc-btn::after,
:root[data-motion='full'] .loc-indicator.loc-trip .loc-btn::after {
  animation: loc-pulse 2s ease-out infinite;
}
@keyframes loc-pulse {
  70% {
    box-shadow: 0 0 0 7px rgba(50, 164, 103, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(50, 164, 103, 0);
  }
}
.loc-indicator.loc-trip .loc-btn {
  background: rgba(35, 133, 81, 0.15);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 720px) {
  .loc-indicator .loc-btn .bp6-button-text {
    display: none;
  }
}

/* Personal › Standorte */
.map-mini.people-map {
  height: clamp(280px, 50vh, 460px);
}
.map-pin.kind-PERSON {
  background: var(--viz-s7, #7961db);
}

/* Handy: Kopfzeile entlasten (Standortanzeige kam in Ausbau 16 dazu) – Bereichstitel steht in der Bottom-Bar,
   „Neu“ nur als Symbol, Standortsymbol nur, wenn tatsächlich erfasst wird oder etwas zu tun ist */
@media (max-width: 719.98px) {
  #navbar .navbar-title,
  #navbar .bp6-navbar-divider {
    display: none;
  }
  #navbar .navbar-new .bp6-button-text {
    display: none;
  }
  #navbar .loc-indicator.loc-off {
    display: none;
  }
  /* Suche als Lupe (öffnet ohnehin die Palette) – das Feld lief sonst unter „Neu“ */
  #navbar .navbar-search {
    flex: 0 0 40px;
    min-width: 40px;
  }
  #navbar .navbar-search .bp6-input-group > .bp6-input {
    width: 40px;
    min-width: 0;
    padding-right: 0;
    color: transparent;
  }
  #navbar .navbar-search .bp6-input::placeholder {
    color: transparent;
  }
}

/* ============================================================ Ausbau 17 – Baustellenakte */
/* Kopf der Akte: Baustellenwahl, Aktionen, Kennzahlen */
.akte-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}
.akte-pick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.akte-pick .akte-select {
  min-width: 260px;
  max-width: 100%;
}
.akte-pick .akte-select select {
  font-weight: 600;
}
.akte-nav {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--bp-surface-border-color-default);
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.akte-nav::-webkit-scrollbar {
  display: none;
}
.akte-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
  min-height: var(--hit);
}
.akte-tab:hover {
  color: var(--bp-intent-primary-rest);
}
.akte-tab.active {
  border-bottom-color: var(--bp-intent-primary-rest);
  color: var(--bp-intent-primary-rest);
  font-weight: 600;
}
body.bp6-dark .akte-tab.active,
body.bp6-dark .akte-tab:hover {
  color: var(--bp-palette-blue-5, #8abbff);
}
body.bp6-dark .akte-tab.active {
  border-bottom-color: var(--bp-palette-blue-5, #8abbff);
}
.akte-loading {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: 32px;
}

/* Tagesberichte – Liste */
.rep-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rep-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
  cursor: pointer;
}
.rep-row:hover,
.rep-row:focus-visible {
  background: var(--bp-surface-background-color-default-hover);
}
.rep-row-date {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.rep-row-date span {
  font-size: 11px;
}
.rep-row-main {
  min-width: 0;
}
.rep-row-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-weight: 600;
}
.rep-row-sub {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rep-row .wx-icon {
  font-size: 20px;
}
.rep-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 8px 10px;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
  background: var(--bp-surface-background-color-default-hover);
}
.rep-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rep-meta-item .bp6-icon,
.rep-meta-item .wx-icon {
  color: var(--bp-typography-color-muted);
}
.rep-text {
  white-space: pre-wrap;
  margin: 0;
  line-height: 1.5;
}
.crew-table td.num,
.crew-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
/* Tagesbericht-Dialog */
.rep-dialog.bp6-dialog {
  max-width: 760px;
}
.rep-form .bp6-label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rep-wx {
  display: grid;
  grid-template-columns: minmax(140px, 1.4fr) 80px 80px minmax(140px, 2fr);
  gap: 6px;
}
.crew-editor {
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.crew-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.crew-head,
.crew-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 70px minmax(0, 1.6fr) 30px;
  gap: 6px;
  align-items: center;
}
.crew-head {
  padding: 0 2px;
}
.crew-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.crew-row .crew-hours {
  text-align: right;
}
.diary-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 14px;
}
.diary-form .bp6-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}
.diary-form .bp6-checkbox {
  margin-bottom: 8px;
}

/* Nachweise – Zeilen, Kacheln, Fotos */
.ev-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ev-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
  cursor: pointer;
}
.ev-row:hover,
.ev-row:focus-visible {
  background: var(--bp-surface-background-color-default-hover);
}
.ev-row.overdue {
  box-shadow: inset 3px 0 0 var(--bp-intent-danger-rest);
}
.ev-row-thumb {
  width: 56px;
  height: 42px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bp-surface-background-color-default-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bp-typography-color-muted);
}
.ev-row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ev-row-main {
  min-width: 0;
}
.ev-row-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.ev-row-sub {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ev-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}
.ev-card {
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  background: var(--bp-surface-background-color-default);
  display: flex;
  flex-direction: column;
}
body.bp6-dark .ev-card {
  background: var(--bp-palette-dark-gray-3, #2f343c);
}
.ev-card:hover,
.ev-card:focus-visible {
  border-color: var(--bp-intent-primary-rest);
}
.ev-card-img {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--bp-surface-background-color-default-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bp-typography-color-muted);
}
.ev-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ev-card-count {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(17, 20, 24, 0.7);
  color: #fff;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.ev-card-kind {
  position: absolute;
  left: 6px;
  top: 6px;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: rgba(17, 20, 24, 0.7);
  color: #fff;
}
.ev-card-kind.k-DEFECT {
  background: var(--bp-intent-danger-rest);
}
.ev-card-kind.k-ACCEPTANCE {
  background: var(--bp-intent-success-rest);
}
.ev-card-kind.k-SAFETY {
  background: var(--bp-intent-warning-rest);
}
.ev-card-body {
  padding: 6px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
}
.ev-card-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.ev-card-sub {
  font-size: 11px;
}
.ev-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
}
.ev-photo-grid.wide {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.ev-photo {
  position: relative;
  border: 1px solid var(--bp-surface-border-color-default);
  border-radius: 4px;
  overflow: hidden;
  padding: 0;
  background: var(--bp-surface-background-color-default-hover);
  aspect-ratio: 4 / 3;
  cursor: zoom-in;
  display: block;
}
.ev-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ev-photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--bp-typography-color-muted);
}
.ev-photo-sub {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 3px 6px;
  font-size: 10px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}
.ev-filter {
  gap: 6px;
  flex-wrap: wrap;
}
.ev-kind-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.ev-dialog.bp6-dialog {
  max-width: 640px;
}
.ev-form .bp6-form-group[hidden] {
  display: none;
}
/* Fotoauswahl */
.ev-picker {
  border: 1px dashed var(--bp-surface-border-color-default);
  border-radius: 4px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ev-pick-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.ev-pick-actions .bp6-button {
  min-height: var(--hit);
}
.ev-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.ev-pick-grid:empty {
  display: none;
}
.ev-pick {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ev-pick img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 3px;
  display: block;
}
.ev-pick .ev-pick-rm {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(17, 20, 24, 0.6);
  color: #fff;
}
/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-toast) + 1);
  background: rgba(8, 10, 12, 0.94);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  color: #f6f7f9;
}
.lb-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
}
.lb-bar .bp6-button,
.lb-prev,
.lb-next {
  color: #f6f7f9 !important;
}
.lb-count {
  font-size: 13px;
  opacity: 0.8;
}
.lb-img {
  grid-column: 2;
  grid-row: 2;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  justify-self: center;
  align-self: center;
  transition: opacity 150ms;
}
.lb-img.loading {
  opacity: 0.6;
}
.lb-prev,
.lb-next {
  grid-row: 2;
  align-self: center;
  justify-self: center;
}
.lb-prev {
  grid-column: 1;
}
.lb-next {
  grid-column: 3;
}
.lb-cap {
  grid-column: 1 / -1;
  padding: 8px 12px 12px;
  text-align: center;
  font-size: 13px;
  opacity: 0.85;
}
.text-danger {
  color: var(--bp-intent-danger-rest);
}
@media (max-width: 719.98px) {
  .rep-row {
    grid-template-columns: 64px minmax(0, 1fr) auto;
  }
  .rep-row > .bp6-icon-chevron-right {
    display: none;
  }
  .rep-wx {
    grid-template-columns: 1fr 1fr;
  }
  .crew-head,
  .crew-row {
    grid-template-columns: minmax(0, 1.4fr) 60px minmax(0, 1.2fr) 28px;
  }
  .ev-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  .lightbox {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
  }
  .akte-pick .akte-select {
    min-width: 0;
    flex: 1 1 100%;
  }
  /* Handy: die beiden Hauptknöpfe nebeneinander in voller Breite, Nebenknöpfe davor in einer Zeile */
  .akte-pick .spacer {
    flex: 1 1 100%;
    height: 0;
  }
  .akte-pick .akte-report-today,
  .akte-pick .akte-evidence {
    flex: 1 1 40%;
    justify-content: center;
  }
}
