/* ==========================================================================
   THW-TASCHENKARTE: UI COMPONENTS (EMOJIFREI & VEKTOR-BASIERT)
   Systematik-Filter (4 Tabs), StAN-Badges, 3-Stufen-Status & Meta-Pills
   ========================================================================== */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn:hover {
  background: var(--border-color);
}

.btn-primary {
  background: var(--thw-blue);
  color: #ffffff;
  border-color: var(--thw-blue-hover);
}

.btn-primary:hover {
  background: var(--thw-blue-hover);
}

.btn-yellow {
  background: var(--thw-yellow);
  color: #000000;
  border-color: var(--thw-yellow-hover);
}

.btn-yellow:hover {
  background: var(--thw-yellow-hover);
}

/* Verknüpfungs-Button: Taschenkarte → Tool (Sandsack-Rechner etc.) */
.btn-tool-link {
  background: hsl(168, 55%, 35%);
  color: #fff;
  border-color: hsl(168, 55%, 28%);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.btn-tool-link:hover {
  background: hsl(168, 55%, 28%);
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* Badges & Tags */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.badge-thw { background: var(--thw-blue-subtle); color: var(--thw-blue); }
.badge-danger { background: var(--color-danger-subtle); color: var(--color-danger); }
.badge-warning { background: var(--color-warning-subtle); color: var(--color-warning); }
.badge-success { background: var(--color-success-subtle); color: var(--color-success); }
.badge-info { background: var(--color-info-subtle); color: var(--color-info); }

.badge-stan-unit {
  background: #0f1e36;
  color: #ffffff;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
}

.badge-stan-task {
  background: #f1f5f9;
  color: #1e293b;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
}

body.theme-dark .badge-stan-task {
  background: #162645;
  color: #f1f5f9;
  border-color: #2c497d;
}

/* Search Bar */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  pointer-events: none;
}

.search-icon svg {
  width: 16px;
  height: 16px;
}

.search-input {
  width: 100%;
  padding: 0.5rem 2.2rem 0.5rem 2.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-app);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  box-sizing: border-box;
  transition: border-color var(--transition-fast);
}

.search-input:focus {
  border-color: var(--thw-blue);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(0, 51, 153, 0.12);
}

.search-shortcut {
  position: absolute;
  right: 0.5rem;
  font-size: 0.68rem;
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  background: var(--border-color);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ==========================================================================
   MULTI-TAXONOMY NAVIGATION (4 TABS)
   StAN-Einheiten | StAN-Aufgaben | Themen | Vorschriften
   ========================================================================== */
.taxonomy-tabs-bar {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  gap: 1px;
  background: var(--bg-app);
  padding: 2px 2px 0 2px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  width: 100%;
  box-sizing: border-box;
}

.taxonomy-tab {
  flex: 1;
  text-align: center;
  padding: 0.45rem 0.15rem;
  font-size: 0.74rem;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.taxonomy-tab:hover {
  background: var(--bg-surface);
  color: var(--thw-blue);
}

.taxonomy-tab.active {
  background: var(--bg-surface);
  color: var(--thw-blue);
  border-top: 2px solid var(--thw-blue);
}

.taxonomy-selector-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.taxonomy-dropdown {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding: 0.4rem 0.45rem;
  font-size: 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-app);
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  box-sizing: border-box;
}

.taxonomy-dropdown:focus {
  border-color: var(--thw-blue);
}

.sort-dropdown {
  width: 110px;
  flex-shrink: 0;
  padding: 0.4rem 0.4rem;
  font-size: 0.78rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-app);
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  box-sizing: border-box;
  text-overflow: ellipsis;
}

/* ==========================================================================
   SIDEBAR CARD LIST ITEMS (Titel & Untertitel, vertikal zentriert austariert)
   ========================================================================== */
.card-nav-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-height: 56px;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  color: inherit;
  box-sizing: border-box;
  width: 100%;
}

.card-nav-item:hover {
  background: var(--thw-blue-subtle);
  border-color: var(--thw-blue);
}

.card-nav-item.active {
  background: var(--thw-blue-subtle);
  border-left: 4px solid var(--thw-blue);
  box-shadow: var(--shadow-sm);
}

.card-nav-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.card-nav-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.25;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  margin-top: 2px;
}

/* ==========================================================================
   VORSCHRIFTEN-LISTE (FERTIGE DOKUMENTE & HERAUSGEBER-LINKS)
   ========================================================================== */
.regulation-card {
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
  box-sizing: border-box;
}

.regulation-card:hover {
  border-color: var(--thw-blue);
  background: var(--thw-blue-subtle);
}

.regulation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.regulation-code {
  font-weight: 800;
  color: var(--thw-blue);
  font-size: 0.9rem;
}

.regulation-publisher {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
}

.regulation-title {
  font-size: 0.82rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.regulation-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.74rem;
  color: var(--thw-blue);
  text-decoration: none;
  font-weight: 700;
  margin-top: 0.2rem;
}

.regulation-link-btn:hover {
  text-decoration: underline;
}

/* ==========================================================================
   CARD HEADER: 2-SPALTIGES LAYOUT
   Links: Titel & Untertitel | Rechts: Freigabeprocedere & Meta-Pills
   ========================================================================== */
.card-header-banner {
  background: linear-gradient(135deg, var(--thw-blue) 0%, var(--thw-blue-dark) 100%);
  color: #ffffff;
  padding: 1.35rem 1.6rem;
  position: relative;
  border-bottom: 3px solid var(--thw-yellow);
}

.card-header-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  align-items: center;
}

@media (max-width: 880px) {
  .card-header-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.card-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.card-title {
  font-size: 1.65rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1.2;
  color: #ffffff;
}

.card-subtitle {
  font-size: 0.95rem;
  color: #e2e8f0;
  line-height: 1.35;
}

.card-header-right {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: flex-end;
}

@media (max-width: 880px) {
  .card-header-right {
    align-items: flex-start;
  }
}

/* ==========================================================================
   3-STUFIGER QUALITÄTS- & FREIGABE-WORKFLOW
   ========================================================================== */
.status-pipeline-container {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.status-step {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  position: relative;
  font-size: 0.74rem;
  font-weight: 600;
  color: #cbd5e1;
  cursor: help;
  user-select: none;
}

.status-step.completed {
  color: #ffffff;
}

.status-step-icon {
  width: 15px;
  height: 15px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: transparent;
}

.status-step.completed .status-step-icon {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #ffffff;
}

.status-step-icon svg {
  width: 11px;
  height: 11px;
}

.status-step-divider {
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.75rem;
}

/* Status Tooltip Popover */
.status-step .status-tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  top: 135%;
  right: 0;
  background: #0f172a;
  color: #ffffff;
  padding: 0.55rem 0.8rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: normal;
  white-space: nowrap;
  box-shadow: var(--shadow-xl);
  border: 1px solid #334155;
  z-index: 300;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  line-height: 1.45;
}

.status-step:hover .status-tooltip {
  visibility: visible;
  opacity: 1;
}

/* ==========================================================================
   META-PILLS ZUSAMMENFASSUNG (Einheiten, Aufgaben, Themen, Schlagworte)
   ========================================================================== */
.card-meta-summary-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.meta-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  color: #ffffff;
  cursor: help;
  user-select: none;
  transition: background var(--transition-fast);
}

.meta-pill:hover {
  background: rgba(255, 255, 255, 0.22);
}

.meta-pill-count {
  font-weight: 800;
  color: var(--thw-yellow);
}

/* Meta-Pill Hover Tooltip */
.meta-pill .meta-tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  top: 135%;
  right: 0;
  width: max-content;
  max-width: 440px;
  background: #0f172a;
  color: #ffffff;
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: normal;
  line-height: 1.5;
  box-shadow: var(--shadow-xl);
  border: 1px solid #334155;
  z-index: 300;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  box-sizing: border-box;
}

.meta-pill:hover .meta-tooltip {
  visibility: visible;
  opacity: 1;
}

.tooltip-title {
  font-weight: 800;
  color: var(--thw-yellow);
  margin-bottom: 0.3rem;
  border-bottom: 1px solid #334155;
  padding-bottom: 0.2rem;
  white-space: nowrap;
}

.tooltip-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.tooltip-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 320px;
  white-space: normal;
}

.tooltip-tag-chip {
  background: #1e293b;
  border: 1px solid #334155;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.7rem;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Action Toolbar */
.card-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.5rem;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-color);
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card-toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ==========================================================================
   SICHERHEITS- & GEFAHRENHINWEISE (AUFKLAPPBAR / ACCORDION)
   ========================================================================== */
.safety-hazard-accordion {
  border-bottom: 2px solid var(--color-danger);
  background: var(--color-danger-subtle);
  overflow: hidden;
  transition: all var(--transition-normal);
}

.safety-hazard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.5rem;
  cursor: pointer;
  user-select: none;
  gap: 0.75rem;
  transition: background var(--transition-fast);
}

.safety-hazard-header:hover {
  background: rgba(201, 48, 44, 0.12);
}

.safety-hazard-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.safety-hazard-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--color-danger);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.hazard-icons-strip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.hazard-icon-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  background: #ffffff;
  border-radius: 4px;
  padding: 2px;
  border: 1px solid #e2e8f0;
}

.safety-hazard-toggle-hint {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--color-danger);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.safety-hazard-toggle-hint svg {
  transition: transform var(--transition-normal);
}

.safety-hazard-accordion.open .safety-hazard-toggle-hint svg {
  transform: rotate(180deg);
}

/* Aufgeklappte Tabelle */
.safety-hazard-content {
  display: none;
  padding: 0.5rem 1.5rem 1rem 1.5rem;
  background: var(--bg-surface);
  border-top: 1px solid rgba(201, 48, 44, 0.2);
}

.safety-hazard-accordion.open .safety-hazard-content {
  display: block;
}

.safety-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.safety-table th {
  background: #fdf2f2;
  color: var(--color-danger);
  font-weight: 700;
  padding: 0.45rem 0.75rem;
  border: 1px solid #fecaca;
  text-align: left;
}

.safety-table td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  vertical-align: middle;
}

.safety-icon-cell {
  width: 54px;
  text-align: center;
}

.safety-icon-cell img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
}

.safety-desc-cell {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-primary);
}

/* Summary Box */
.card-summary-box {
  margin: 1rem 1.5rem 0.25rem 1.5rem;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  background: var(--thw-blue-subtle);
  border-left: 4px solid var(--thw-blue);
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-primary);
}

/* Section Blocks */
.card-sections-container {
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card-section-block {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  overflow: hidden;
}

.card-section-header {
  padding: 0.5rem 0.85rem;
  background: var(--bg-app);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.card-section-body {
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  line-height: 1.6;
  white-space: pre-line;
}

/* Interactive Checklist */
.checklist-container {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.checklist-text {
  flex: 1;
  font-size: 0.88rem;
  line-height: 1.4;
}

.checklist-item:hover {
  background: var(--thw-blue-subtle);
}

.checklist-item.checked {
  background: var(--color-success-subtle);
  border-color: var(--color-success);
  color: var(--text-secondary);
}

.checklist-item.checked .checklist-text {
  text-decoration: line-through;
}

.checklist-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--thw-blue);
  flex-shrink: 0;
}

.checklist-time-badge {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Interaktives Badge in der linken Navigationsleiste */
.card-nav-badge-interactive {
  display: inline-block;
  background: var(--thw-yellow);
  color: #000000;
  font-weight: 800;
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  margin-left: 0.4rem;
  vertical-align: middle;
  letter-spacing: 0.02em;
}

/* Tables */
.table-responsive-wrapper {
  overflow-x: auto;
  margin: 0.75rem 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.card-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.card-table th {
  background: var(--thw-blue);
  color: #ffffff;
  padding: 0.55rem 0.75rem;
  font-weight: 700;
  border: 1px solid var(--thw-blue-hover);
}

.card-table td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
}

.card-table tr:nth-child(even) {
  background: var(--bg-app);
}

/* Media Gallery */
.media-gallery {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0.75rem 0;
}

.media-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  overflow: hidden;
}

.media-image-container {
  width: 100%;
  max-height: 400px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
  overflow: hidden;
  border-bottom: 1px solid var(--border-color);
}

.media-image-container img {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  transition: transform var(--transition-fast);
}

.media-image-container:hover img {
  transform: scale(1.01);
}

.media-caption {
  padding: 0.5rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Lightbox Modal */
.lightbox-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  flex-direction: column;
}

.lightbox-modal.active {
  display: flex;
}

.lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: rgba(0, 0, 0, 0.75);
  color: #ffffff;
  z-index: 10;
}

.lightbox-viewport {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: grab;
}

.lightbox-viewport.grabbing {
  cursor: grabbing;
}

.lightbox-image {
  max-width: 92%;
  max-height: 92%;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 0.1s ease-out;
  user-select: none;
}

/* Generic Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 560px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 0.85rem 1.15rem;
  background: var(--thw-blue);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 1.15rem;
  overflow-y: auto;
  max-height: 75vh;
}

.modal-footer {
  padding: 0.75rem 1.15rem;
  background: var(--bg-app);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ==========================================================================
   SIDEBAR TOOLS SECTION
   ========================================================================== */
.sidebar-tools-section {
  padding: 0.6rem 0.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-panel);
  margin-top: auto;
}

.sidebar-tools-header {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  padding: 0.2rem 0.4rem 0.4rem 0.4rem;
}

.tool-nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.tool-nav-item:hover {
  border-color: var(--thw-blue);
  background: rgba(0, 51, 153, 0.06);
}

.tool-nav-item.active {
  border-color: var(--thw-blue);
  background: rgba(0, 51, 153, 0.12);
  box-shadow: 0 0 0 1px var(--thw-blue);
}

.tool-nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: var(--thw-blue);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tool-nav-content {
  flex: 1;
  min-width: 0;
}

.tool-nav-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-nav-subtitle {
  font-size: 0.7rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   DISLOZIERUNG TREE VIEW (EINHEITENÜBERSICHT)
   ========================================================================== */
.dislo-view-container {
  max-width: 1120px;
  margin: 0 auto 3rem auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.dislo-header {
  background: linear-gradient(135deg, var(--thw-blue) 0%, var(--thw-blue-dark) 100%);
  color: #ffffff;
  padding: 1.5rem 1.75rem;
}

.dislo-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.dislo-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dislo-icon-badge {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.dislo-title {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

.dislo-subtitle {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 0.15rem;
}

.dislo-stats-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dislo-stat-pill {
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.15);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

/* Dislozierung Toolbar & Filter */
.dislo-toolbar {
  padding: 1rem 1.75rem;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dislo-search-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.dislo-search-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.dislo-search-icon {
  position: absolute;
  left: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.dislo-search-input {
  width: 100%;
  padding: 0.55rem 0.75rem 0.55rem 2.25rem;
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

.dislo-search-input:focus {
  border-color: var(--thw-blue);
  box-shadow: 0 0 0 2px rgba(0, 51, 153, 0.15);
}

.dislo-actions {
  display: flex;
  gap: 0.4rem;
}

.dislo-filter-chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.dislo-filter-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-right: 0.25rem;
}

.dislo-chip {
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.73rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dislo-chip:hover {
  border-color: var(--thw-blue);
  color: var(--thw-blue);
}

.dislo-chip.active {
  background: var(--thw-blue);
  border-color: var(--thw-blue);
  color: #ffffff;
}

/* Dislozierung Tree Structure */
.dislo-tree-body {
  padding: 1.25rem 1.75rem;
}

.dislo-lv-node {
  margin-bottom: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.dislo-lv-node:hover {
  border-color: rgba(0, 51, 153, 0.4);
}

.dislo-lv-header {
  padding: 0.85rem 1.15rem;
  background: var(--bg-panel);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  border-bottom: 1px solid transparent;
}

.dislo-lv-node.expanded .dislo-lv-header {
  border-bottom-color: var(--border-color);
  background: rgba(0, 51, 153, 0.04);
}

.dislo-header-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.dislo-chevron {
  display: inline-block;
  transition: transform var(--transition-fast);
  color: var(--thw-blue);
  font-size: 0.8rem;
}

.dislo-node.expanded > .dislo-header-row .dislo-chevron,
.dislo-lv-node.expanded > .dislo-lv-header .dislo-chevron,
.dislo-rst-node.expanded > .dislo-rst-header .dislo-chevron,
.dislo-ov-node.expanded > .dislo-ov-header .dislo-chevron {
  transform: rotate(90deg);
}

.dislo-lv-body {
  display: none;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
}

.dislo-lv-node.expanded .dislo-lv-body {
  display: block;
}

/* Regionalstelle Level */
.dislo-rst-node {
  margin-bottom: 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  overflow: hidden;
}

.dislo-rst-header {
  padding: 0.65rem 0.95rem;
  background: var(--bg-panel);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.dislo-rst-node.expanded .dislo-rst-header {
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 51, 153, 0.02);
}

.dislo-rst-body {
  display: none;
  padding: 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dislo-rst-node.expanded .dislo-rst-body {
  display: flex;
}

/* Ortsverband Level */
.dislo-ov-node {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-card);
  overflow: hidden;
}

.dislo-ov-header {
  padding: 0.55rem 0.85rem;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: background var(--transition-fast);
}

.dislo-ov-header:hover {
  background: var(--bg-panel);
}

.dislo-ov-node.expanded .dislo-ov-header {
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 51, 153, 0.03);
}

.dislo-ov-body {
  display: none;
  padding: 0.75rem;
  background: var(--bg-panel);
}

.dislo-ov-node.expanded .dislo-ov-body {
  display: block;
}

/* Units Grid inside OV */
.dislo-units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.55rem;
}

.dislo-unit-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.65rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.dislo-unit-card:hover {
  border-color: var(--thw-blue);
  box-shadow: var(--shadow-sm);
}

.dislo-unit-icon {
  width: 48px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dislo-unit-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.dislo-unit-info {
  flex: 1;
  min-width: 0;
}

.dislo-unit-short {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dislo-unit-name {
  font-size: 0.68rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dislo-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 10px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   DEICHVERTEIDIGUNG TOOL — dv-* Klassen (THW Designsystem)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Tool Tabs */
.dv-tabs-container {
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.dv-tabs {
  display: flex;
  gap: 0.35rem;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.35rem;
  overflow-x: auto;
}

.dv-tab {
  flex: 1;
  min-width: max-content;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.dv-tab svg {
  flex-shrink: 0;
  stroke: currentColor;
}

.dv-tab.active {
  background: var(--thw-blue);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.dv-tab:not(.active):hover {
  background: var(--bg-surface);
  color: var(--thw-blue);
}

/* Tab Panels */
.dv-tab-panel {
  display: none;
  flex-direction: column;
  gap: 1.25rem;
}

.dv-tab-panel.active {
  display: flex;
}

.dv-section-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--thw-blue);
}

/* Calculator Form Grid */
.dv-calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.dv-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.dv-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.dv-label-hint {
  font-size: 0.7rem;
  font-weight: normal;
  color: var(--text-muted);
}

.dv-input-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dv-input {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: all var(--transition-fast);
  width: 0;
}

.dv-input:focus {
  outline: none;
  border-color: var(--thw-blue);
  box-shadow: 0 0 0 3px rgba(0, 51, 153, 0.12);
}

.dv-select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dv-select:focus {
  outline: none;
  border-color: var(--thw-blue);
  box-shadow: 0 0 0 3px rgba(0, 51, 153, 0.12);
}

.dv-unit {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 700;
  flex-shrink: 0;
  min-width: 2.2rem;
}

.dv-hint {
  font-size: 0.73rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.dv-hint strong {
  color: var(--thw-blue);
}

/* Result Cards */
.dv-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.dv-result-card {
  padding: 0.9rem 1.1rem;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.dv-result-card:hover {
  border-color: var(--border-hover);
}

.dv-result-card.primary {
  border-color: var(--thw-blue);
  border-width: 2px;
  background: var(--thw-blue-subtle);
}

.dv-result-card.warning {
  border-left: 4px solid var(--thw-yellow);
}

.dv-result-card.info {
  border-left: 4px solid var(--thw-blue);
}

.dv-result-label {
  font-size: 0.73rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.dv-result-value {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.dv-result-card.primary .dv-result-value {
  color: var(--thw-blue);
}

.theme-dark .dv-result-card.primary .dv-result-value {
  color: var(--thw-blue-light);
}

.dv-result-sub {
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.35;
  margin-top: 0.15rem;
}

.dv-disclaimer {
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 0.65rem 0.9rem;
  background: var(--bg-app);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  line-height: 1.5;
}

/* Quellkade steps */
.dv-steps-box {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.35rem;
}

.dv-steps-title {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.dv-steps {
  margin: 0;
  padding-left: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.dv-steps li {
  font-size: 0.84rem;
  color: var(--text-primary);
  line-height: 1.45;
}

/* Tables */
.dv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.dv-table thead th {
  background: var(--thw-blue);
  color: #ffffff;
  padding: 0.65rem 0.85rem;
  text-align: left;
  font-weight: 800;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.dv-table tbody td {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.dv-table tbody tr:last-child td {
  border-bottom: none;
}

.dv-table tbody tr:hover td {
  background: var(--bg-hover);
}

.dv-table .dv-tr-sep td {
  border-top: 2px solid var(--thw-blue);
}

/* Kennzahlen Grid */
.dv-kennzahlen {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.35rem;
}

.dv-kz-title {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  margin-bottom: 0.85rem;
}

.dv-kz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.5rem 1.25rem;
}

.dv-kz-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--border-color);
  font-size: 0.83rem;
}

.dv-kz-label {
  color: var(--text-secondary);
  font-weight: 600;
}

.dv-kz-val {
  color: var(--text-primary);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Material Cards Grid */
.dv-material-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.85rem;
}

.dv-mat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.95rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.dv-mat-name {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--thw-blue);
}

.theme-dark .dv-mat-name {
  color: var(--thw-blue-light);
}

.dv-mat-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Begriffe Grid */
.dv-begriffe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.6rem;
}

.dv-beg-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.dv-beg-term {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-primary);
}

.dv-beg-def {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ─────────────────────────────────────────────────────────────────────────────
   VERSIONING & APPROVAL STATUS STYLES (MONOCHROME / TEXT-FARBEN)
   ───────────────────────────────────────────────────────────────────────────── */

/* Sidebar Footer Status & Filter Bar (Unten über den Tools) */
.sidebar-footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.85rem;
  background: var(--bg-surface-elevated);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  gap: 0.5rem;
}

.sidebar-counter {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.sidebar-status-toggle {
  display: flex;
  align-items: center;
}

.segmented-control {
  display: inline-flex;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.segmented-btn {
  background: transparent;
  border: none;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.22rem 0.55rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1.2;
}

.segmented-btn:hover {
  color: var(--text-primary);
}

.segmented-btn.active {
  background: var(--thw-blue);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 51, 153, 0.2);
}

.theme-dark .segmented-btn.active {
  background: var(--thw-blue);
  color: #ffffff;
}

/* Sidebar Nav Meta & Version Badges */
.card-nav-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
}

.card-nav-version {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.05);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}

.theme-dark .card-nav-version {
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}

.card-nav-badge-status {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.card-nav-badge-status.review,
.card-nav-badge-status.reviewed {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.theme-dark .card-nav-badge-status.review,
.theme-dark .card-nav-badge-status.reviewed {
  background: #78350f;
  color: #fde68a;
  border: 1px solid #92400e;
}

.card-nav-badge-status.archived {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.theme-dark .card-nav-badge-status.archived {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
}

.card-nav-badge-status.draft {
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}

/* Card Toolbar Version Picker */
.card-version-picker-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.45rem;
}

.card-version-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.card-version-select {
  background: transparent;
  border: none;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  outline: none;
  cursor: pointer;
}

/* Card Version Warning Banners */
.card-version-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  border-bottom: 1px solid transparent;
}

.card-version-banner.archived {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

.theme-dark .card-version-banner.archived {
  background: #451a03;
  color: #fef3c7;
  border-color: #78350f;
}

.card-version-banner.review {
  background: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
}

.theme-dark .card-version-banner.review {
  background: #172554;
  color: #dbeafe;
  border-color: #1e3a8a;
}

.version-banner-link {
  font-weight: 800;
  text-decoration: underline;
  color: inherit;
  margin-left: 0.4rem;
}

/* Checklist History Accordion Box */
.checklist-history-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  overflow: hidden;
}

.checklist-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.95rem;
  cursor: pointer;
  background: rgba(0, 51, 153, 0.04);
  user-select: none;
}

.theme-dark .checklist-history-header {
  background: rgba(255, 255, 255, 0.03);
}

.checklist-history-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--thw-blue);
}

.theme-dark .checklist-history-title {
  color: var(--thw-blue-light);
}

.checklist-history-btn-toggle {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.checklist-history-body {
  padding: 0.85rem 0.95rem;
  border-top: 1px solid var(--border-color);
}

.checklist-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.checklist-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.75rem;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.checklist-history-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  flex-wrap: wrap;
}

.checklist-history-badge {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.72rem;
  background: var(--thw-blue);
  color: #ffffff;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

.checklist-history-date {
  color: var(--text-secondary);
}

.checklist-history-count {
  font-weight: 600;
  color: var(--color-success);
}

.checklist-history-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   SECTION SPLIT LAYOUT & CAROUSEL GALLERY (TEXT LINKS / BILD RECHTS)
   ───────────────────────────────────────────────────────────────────────────── */

.card-section-split {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 380px);
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  align-items: start;
}

.card-section-split.image-left {
  grid-template-columns: minmax(240px, 380px) 1fr;
}

.card-section-split.stacked {
  grid-template-columns: 1fr;
}

.section-split-text {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.section-split-text strong {
  color: var(--text-primary);
}

.section-split-media {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.section-image-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.section-image-card:hover {
  transform: translateY(-2px);
  border-color: var(--thw-blue);
  box-shadow: var(--shadow-md);
}

.section-image-wrapper {
  position: relative;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  max-height: 320px;
  overflow: hidden;
  padding: 0.5rem;
}

.theme-dark .section-image-wrapper {
  background: #1e293b;
}

.section-image {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  display: block;
}

.section-image-overlay {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  background: rgba(15, 23, 42, 0.82);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  opacity: 0.85;
  transition: opacity var(--transition-fast);
  backdrop-filter: blur(2px);
}

.section-image-card:hover .section-image-overlay {
  opacity: 1;
  background: var(--thw-blue);
}

.section-image-caption {
  padding: 0.6rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-app);
  border-top: 1px solid var(--border-color);
  line-height: 1.4;
}

/* Diashow / Karussell Steuerung */
.section-carousel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.carousel-slides-container {
  position: relative;
}

.carousel-slide {
  display: none;
}

.carousel-slide.active {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.99); }
  to { opacity: 1; transform: scale(1); }
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
}

.carousel-nav-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.carousel-nav-btn:hover {
  background: var(--thw-blue);
  color: #ffffff;
  border-color: var(--thw-blue);
}

.carousel-counter {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-secondary);
  min-width: 50px;
  text-align: center;
}

/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE ANSICHT FÜR SMARTPHONES (2-SPALTIGES SPLIT-LAYOUT UMBRECHEN)
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .card-section-split {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
  }

  .section-image-wrapper {
    min-height: 150px;
    max-height: 240px;
  }
}

/* ==========================================================================
   GEFÄHRDUNGSBEURTEILUNG (5-A-B-C-D-5-E MATRIX) STYLING
   ========================================================================== */
.gb-matrix-table td {
  vertical-align: middle;
  padding: 0.6rem 0.65rem;
}

.gb-matrix-table select.gb-select {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast);
}

.gb-matrix-table select.gb-select:focus {
  border-color: var(--thw-blue);
}

.gb-psa-recommendation-box {
  transition: background-color var(--transition-normal);
}

@media print {
  .gb-select {
    border: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    background: transparent !important;
    font-weight: bold;
    padding: 0 !important;
  }
  #btn-reset-gb,
  #btn-print-gb {
    display: none !important;
  }
}

/* ==========================================================================
   2-SPALTIGES SECTION-LAYOUT & DIASHOW (SLIDESHOW / CAROUSEL)
   ========================================================================== */

/* 2-Spalten Split Container */
.section-split-container {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.25rem;
  align-items: start;
}

.section-split-container.image-left {
  grid-template-columns: 340px 1fr;
}

.section-text-col {
  min-width: 0; /* Verhindert Overflow bei Tabellen/Code */
}

.section-media-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: sticky;
  top: 1rem;
}

/* Einzelbild im Abschnitt */
.section-single-image {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.section-single-image:hover {
  border-color: var(--thw-blue);
  box-shadow: var(--shadow-md);
}

.section-single-image img {
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
  background: #ffffff;
  padding: 0.4rem;
}

.section-single-caption {
  padding: 0.4rem 0.65rem;
  font-size: 0.74rem;
  color: var(--text-muted);
  background: var(--bg-app);
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-weight: 500;
}

/* Interaktive Diashow / Carousel */
.card-slideshow {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: border-color var(--transition-fast);
}

.card-slideshow:hover {
  border-color: var(--thw-blue);
}

.slideshow-viewport {
  position: relative;
  width: 100%;
  min-height: 200px;
  max-height: 320px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.slideshow-slide {
  display: none;
  width: 100%;
  height: 100%;
  text-align: center;
}

.slideshow-slide.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.slideshow-slide img {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  cursor: zoom-in;
  padding: 0.5rem;
  display: block;
}

/* Diashow Navigation Controls */
.slideshow-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.6rem;
  background: var(--bg-app);
  border-top: 1px solid var(--border-color);
}

.slideshow-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  padding: 0;
  transition: all var(--transition-fast);
}

.slideshow-btn:hover {
  background: var(--thw-blue);
  color: #ffffff;
  border-color: var(--thw-blue);
}

.slideshow-counter {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-secondary);
}

.slideshow-caption-box {
  padding: 0.35rem 0.65rem;
  font-size: 0.74rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  text-align: center;
  line-height: 1.3;
}

/* Inline Markdown Bilder */
.markdown-figure {
  margin: 0.8rem 0;
  display: inline-block;
  max-width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #ffffff;
}

.markdown-figure img {
  max-width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
}

.markdown-figure figcaption {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-app);
  padding: 0.25rem 0.5rem;
  text-align: center;
  border-top: 1px solid var(--border-color);
}

/* Responsive Breakpoints für 2-Spalten Layout */
@media (max-width: 768px) {
  .section-split-container,
  .section-split-container.image-left {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .section-media-col {
    position: static;
    max-width: 440px;
    margin: 0 auto;
    width: 100%;
  }

  .slideshow-viewport {
    max-height: 260px;
  }
}

