/* ==========================================================
   Brandschutz-App · Design-System v1.14
   Funktional-puristisch · warm · aufgeräumt
   ========================================================== */

/* ── Basis & Resets ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0 }

:root {
  --primary: #DF5830;
  --primary-hover: #c94a24;
  --bg: #F2F0E9;
  --surface: #FFFFFF;
  --surface-alt: #F7F5F0;
  --border: #E0DDD6;
  --border-light: #EDE9E3;
  --text: #1A1A1A;
  --text-muted: #8A8A8A;
  --text-dim: #B0B0B0;

  --success: #16a34a;
  --warning: #eab308;
  --danger: #dc2626;

  --accent-green: #2D5A27;
  --accent-green-light: rgba(45,90,39,0.08);
  --accent-green-mid: rgba(45,90,39,0.15);
  --orange: #f97316;
  --purple: #a855f7;
  --cyan: #06b6d4;
  --pink: #ec4899;
  --lime: #84cc16;

  --success-bg: #dcfce7;
  --success-bright: #22c55e;
  --success-text: #166534;
  --danger-bg: #fef2f2;
  --danger-text: #dc2626;
  --warning-bg: #fef3c7;
  --orange-bg: #fff7ed;

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --radius-pill: 999px;

  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-warm: 0 2px 8px rgba(223,88,48,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.07);
  --shadow-warm-md: 0 6px 16px rgba(223,88,48,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.10);

  --border-alt: #D0CDC6;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}

/* ── Layout ──────────────────────────────────────────── */
.app { max-width: 1200px; margin: 0 auto; padding: 24px 24px 80px; overflow: visible }
.view { display: none }
.view.active { display: block }

/* ── Header ──────────────────────────────────────────── */
.header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; margin-bottom: 20px; gap: 10px;
  border-bottom: 1px solid var(--border-light);
}
.header-left { display: flex; align-items: center; gap: 12px }
.header-left h1 {
  font-size: 18px; color: var(--accent-green); font-weight: 700;
  letter-spacing: -0.3px; margin: 0
}
.header-actions { display: flex; align-items: center; gap: 8px }

/* Hamburger */
.hamburger {
  display: flex; flex-direction: column; gap: 4px;
  width: 32px; height: 32px; border: none;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; padding: 7px;
  position: relative; z-index: 301; transition: .15s;
}
.hamburger:hover { border-color: var(--primary); background: var(--surface-alt) }
.hamburger span {
  display: block; width: 16px; height: 2px;
  background: var(--text); border-radius: 2px; transition: .2s
}
.hamburger.open span:nth-child(1) { transform: translateY(5px) rotate(45deg) }
.hamburger.open span:nth-child(2) { opacity: 0 }
.hamburger.open span:nth-child(3) { transform: translateY(-5px) rotate(-45deg) }
.hamburger-badge {
  position: absolute; top: -2px; right: -2px;
  width: 10px; height: 10px; background: var(--danger);
  border-radius: 50%; display: none; z-index: 302
}

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3); z-index: 400;
}
.sidebar-overlay.show { display: block }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 264px;
  background: var(--surface); z-index: 500;
  box-shadow: var(--shadow-warm-md);
  transform: translateX(-100%); transition: transform .25s ease;
  display: flex; flex-direction: column; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 80px
}
.sidebar::-webkit-scrollbar { width: 4px }
.sidebar::-webkit-scrollbar-track { background: transparent }
.sidebar::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 4px }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2) }
.sidebar.open { transform: translateX(0) }

.sidebar-header {
  padding: 24px; border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 12px
}
.sidebar-header .logo {
  width: 38px; height: 38px; background: var(--primary);
  border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 18px; color: #fff; flex-shrink: 0
}
.sidebar-header .app-name { font-size: 15px; font-weight: 700; color: var(--accent-green) }
.sidebar-header .app-sub { font-size: 11px; color: var(--accent-green); opacity: .7 }

.sidebar-nav { padding: 12px 0; flex: 1 }

.sidebar-item {
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px; height: 48px; border: none; background: none;
  width: 100%; text-align: left;
  font-size: 14px; color: var(--text); cursor: pointer;
  font-family: inherit; font-weight: 500; transition: .15s;
}
.sidebar-item:hover { background: var(--surface-alt); color: var(--primary) }
.sidebar-item.active {
  background: var(--accent-green-light);
  color: var(--accent-green); font-weight: 600;
  border-left: 3px solid var(--accent-green);
  border-right: none;
}
.sidebar-item .icon {
  width: 24px; height: 24px; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0
}
.sidebar-item .icon svg { width: 20px; height: 20px; stroke-width: 1.8; color: inherit }
.sidebar-item .label { flex: 1 }
.sidebar-item .badge-count {
  background: var(--danger); color: #fff; font-size: 10px;
  font-weight: 700; min-width: 20px; height: 20px;
  border-radius: 50%; text-align: center; line-height: 20px; display: none
}

.sidebar-footer {
  padding: 16px 24px; border-top: 1px solid var(--border-light);
  font-size: 11px; color: var(--text-dim)
}
.sidebar-doc {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px; border-top: 1px solid var(--border-light);
  color: var(--text-muted); text-decoration: none; font-size: 14px; cursor: pointer; transition: .15s;
}
.sidebar-doc:hover { background: var(--surface-alt); color: var(--primary) }

/* ── Info-Panel ──────────────────────────────────────── */
.info-panel {
  background: var(--surface); border-radius: var(--radius-md);
  margin-bottom: 16px; border: 1px solid var(--border-light); overflow: hidden
}
.info-panel-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; cursor: pointer;
}
.info-panel-header .ip-icon {
  width: 28px; height: 28px; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0;
  background: var(--accent-green-light); border-radius: 8px; color: var(--accent-green)
}
.info-panel-header .ip-title { font-size: 14px; font-weight: 600; flex: 1 }
.info-panel-header .ip-total { font-size: 15px; font-weight: 700; color: var(--primary) }
.info-panel-header .ip-toggle { font-size: 11px; color: var(--text-dim) }
.info-panel-body { max-height: 0; overflow: hidden; opacity: 0; transition: .2s }
.info-panel-body.open { max-height: 500px; opacity: 1; padding: 0 16px 14px }

.ip-row { display: flex; gap: 8px; flex-wrap: wrap }
.ip-category {
  flex: 1; min-width: 100px; padding: 12px; border-radius: 8px;
  border: 1px solid var(--border-light); text-align: center; cursor: pointer;
  background: var(--surface-alt); transition: .15s;
}
.ip-category:hover { border-color: var(--primary) }
.ip-category .ip-cat-icon { font-size: 22px; margin-bottom: 4px }
.ip-category .ip-cat-count { font-size: 20px; font-weight: 800; line-height: 1.2 }
.ip-category .ip-cat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px }
.ip-overdue {
  font-size: 12px; color: var(--text-muted);
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-light);
  display: flex; justify-content: space-between; align-items: center;
}
.ip-overdue strong { color: var(--danger) }

/* ── Buttons (Standard: Medium 44px) ─────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; height: 44px; box-sizing: border-box;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 14px; font-weight: 600; font-family: inherit;
  line-height: 1; white-space: nowrap;
  transition: all .15s;
}
.btn svg { width: 20px; height: 20px; stroke-width: 2; flex-shrink: 0 }
/* ── Large (52px) ── Haupt-CTA, prominente Aktionen */
.btn-lg {
  padding: 12px 28px; height: 52px; font-size: 16px; font-weight: 700;
  gap: 10px; border-radius: var(--radius-sm);
}
.btn-lg svg { width: 22px; height: 22px }
/* ── Small (36px) ── Inline-Aktionen, sekundär */
.btn-sm {
  padding: 6px 14px; height: 36px; font-size: 12px; font-weight: 600;
  gap: 6px; border-radius: var(--radius-xs);
}
.btn-sm svg { width: 16px; height: 16px }
/* ── Farbschemata ─────────────────────────────────────── */
.btn-primary { background: var(--primary); color: #fff }
.btn-primary:hover { background: var(--primary-hover) }
.btn-secondary { background: var(--surface-alt); color: var(--text); border: 1px solid var(--border) }
.btn-secondary:hover { background: #EDEAE4 }
.btn-danger { background: var(--danger); color: #fff }
.btn-danger:hover { background: #b91c1c }
.btn-success { background: var(--success); color: #fff }
.btn-success:hover { background: #15803d }

/* ── Reminder / Task Bars ─────────────────────────────── */
.reminder-bar, .task-bar {
  background: var(--surface); border-radius: var(--radius-md);
  padding: 14px 16px; margin-bottom: 16px;
  display: none; border-left: 4px solid var(--primary);
  box-shadow: var(--shadow-warm);
}
.reminder-bar.show, .task-bar.show { display: block }
.reminder-bar h3 { font-size: 14px; margin-bottom: 6px; color: var(--primary); font-weight: 700 }
.task-bar h3 {
  font-size: 14px; margin: 0; color: var(--accent-green);
  display: flex; align-items: center; gap: 8px; font-weight: 700
}
.reminder-item, .task-item {
  font-size: 14px; padding: 8px 0;
  color: var(--text-muted); border-bottom: 1px solid var(--border-light);
  display: flex; justify-content: space-between; align-items: center;
}
.reminder-item:last-child, .task-item:last-child { border: none }
.reminder-item strong, .task-item strong { color: var(--text) }

.task-badge {
  min-width: 22px; height: 22px; background: var(--primary); color: #fff;
  border-radius: 50%; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.task-bar-pruefungen h3 { color: var(--accent-blue, #4A90D9) }
.task-bar-pruefungen { border-left-color: var(--accent-blue, #4A90D9) }
.task-bar-bewertungen h3 { color: var(--accent-orange, #E8913A) }
.task-bar-bewertungen { border-left-color: var(--accent-orange, #E8913A) }
.task-status-offen {
  background: var(--warning-bg); color: #92400e;
  padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 600
}
.task-status-arbeit {
  background: rgba(6,182,212,.15); color: #0e7490;
  padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 600
}
.task-status-erledigt {
  background: var(--success-bg); color: #15803d;
  padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 600
}

/* ── Dashboard Grid (Client Cards) ────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px; margin-bottom: 20px
}

.client-card {
  background: var(--surface); border-radius: var(--radius-md);
  padding: 16px; cursor: pointer;
  border: 1px solid var(--border-light);
  position: relative; overflow: hidden;
  transition: all .15s; box-shadow: var(--shadow-warm);
}
.client-card:hover { border-color: var(--primary); box-shadow: var(--shadow-warm-md) }
.client-card .name {
  font-size: 15px; font-weight: 700; margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px
}
.client-card .status-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap }
.client-card .info { font-size: 13px; color: var(--text-muted); line-height: 1.6 }
.client-card .meta {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-dim);
  margin-top: 12px
}
.client-card.auto-eskaliert {
  border-left: 4px solid var(--danger) !important;
  border-color: var(--danger) !important;
  background: linear-gradient(135deg, #fff 0%, #fef2f2 100%)
}
.client-card.archived { border-left: 4px solid var(--text-dim) !important; filter: grayscale(.3) }

/* ── Badges ────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; border: 1.5px solid transparent;
  line-height: 1.4;
}
.badge-low { background: var(--success-bg); color: #166534; border-color: rgba(22,101,52,.2) }
.badge-medium { background: var(--warning-bg); color: #92400e; border-color: rgba(146,64,14,.2) }
.badge-high { background: var(--orange-bg); color: #9a3412; border-color: rgba(154,52,18,.2) }
.badge-critical { background: var(--danger-bg); color: var(--danger); border-color: rgba(220,38,38,.2) }

/* ── Progress Bars ────────────────────────────────────── */
.progress-bar {
  height: 6px; background: var(--border-light);
  border-radius: 999px; margin: 10px 0; overflow: hidden
}
.progress-fill { height: 100%; border-radius: 999px; transition: width .3s }
.progress-low { background: var(--success) }
.progress-medium { background: var(--warning) }
.progress-high { background: var(--primary) }
.progress-critical { background: var(--danger) }

/* ── Eskalations-Badges ───────────────────────────────── */
.esk-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 12px; border-radius: 999px;
  font-size: 11px; font-weight: 600; border: 1.5px solid
}
.esk-0 { color: var(--success); border-color: var(--success); background: var(--success-bg) }
.esk-1 { color: var(--lime); border-color: var(--lime); background: rgba(132,204,22,.08) }
.esk-2 { color: var(--warning); border-color: var(--warning); background: var(--warning-bg) }
.esk-3 { color: var(--primary); border-color: var(--primary); background: var(--orange-bg) }
.esk-4 { color: var(--danger); border-color: var(--danger); background: var(--danger-bg) }
.esk-5 { color: #b91c1c; border-color: #b91c1c; background: rgba(185,28,28,.08) }
.esk-row { display: flex; align-items: center; gap: 8px; margin: 6px 0 8px }
.esk-pruefung { font-size: 11px; color: var(--text-muted) }

/* ── Filter ────────────────────────────────────────────── */
.filter-icon-btn {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 6px; cursor: pointer; color: var(--text-muted);
  display: inline-flex; align-items: center; position: relative; transition: .15s;
}
.filter-icon-btn:hover, .filter-icon-btn.active { border-color: var(--primary); color: var(--primary) }
.filter-icon-btn .badge-dot {
  position: absolute; top: -2px; right: -2px;
  width: 8px; height: 8px; background: var(--danger); border-radius: 50%
}
.filter-panel {
  display: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px 16px;
  margin-bottom: 14px; flex-wrap: wrap; gap: 12px;
  box-shadow: var(--shadow);
}
.filter-panel.open { display: flex }
.filter-group { min-width: 150px }
.filter-group-title {
  font-size: 11px; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 8px; font-weight: 700
}
.filter-group .opt {
  display: inline-block; padding: 4px 0; font-size: 13px; cursor: pointer;
  color: var(--text-muted); margin: 0 10px 0 0;
  border-bottom: 2px solid transparent; transition: .15s;
}
.filter-group .opt.active, .filter-group .opt:hover { color: var(--primary); border-bottom-color: var(--primary) }
.filter-bar { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap }
.filter-btn {
  padding: 5px 12px; border: 1px solid var(--border);
  border-radius: 999px; background: transparent; color: var(--text-muted);
  cursor: pointer; font-size: 12px; transition: .15s;
}
.filter-btn.active, .filter-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff }

/* ── Detail-Ansicht ────────────────────────────────────── */
.detail-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px
}
.detail-header h2 { font-size: 20px; font-weight: 700 }
.back-btn { cursor: pointer; color: var(--primary); font-size: 14px; display: flex; align-items: center; gap: 4px; font-weight: 600 }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px }
@media (max-width: 768px) { .detail-grid { grid-template-columns: 1fr } }
.detail-section { background: var(--surface); border-radius: var(--radius-md); padding: 16px; box-shadow: var(--shadow) }
.detail-section h3 { font-size: 14px; color: var(--primary); margin-bottom: 12px; font-weight: 700 }
.stat { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--border-light) }
.stat:last-child { border: none }
.stat-label { color: var(--text-muted) }
.stat-value { font-weight: 600 }

.detail-tabs {
  display: flex; gap: 4px; margin-bottom: 16px;
  background: var(--surface-alt); border-radius: var(--radius-md);
  padding: 4px; box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.detail-tab {
  padding: 8px 12px; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  text-align: center; flex: 1; min-width: 0; 
  border: none; background: none; font-family: inherit;
  transition: .15s; white-space: nowrap;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.detail-tab.active { background: var(--primary); color: #fff; font-weight: 600 }
.detail-tab:hover:not(.active) { color: var(--text) }
.detail-tab svg { flex-shrink: 0; width: 16px; height: 16px }

/* Auf kleinen Screens in 2 Reihen */
@media (max-width: 480px) {
  .detail-tab { flex: 0 0 calc(50% - 2px); font-size: 12px; padding: 7px 8px }
}

/* ── Timeline ──────────────────────────────────────────── */
.timeline { padding-left: 24px; position: relative }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border)
}
.timeline-item {
  padding: 8px 0 8px 10px; border-bottom: 1px solid var(--border-light);
  position: relative;
}
.timeline-item::before {
  content: ''; position: absolute; left: -18px; top: 12px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary); border: 2px solid var(--surface)
}
.timeline-item .date { font-size: 11px; color: var(--text-dim) }
.timeline-item .desc { font-size: 14px }

/* ── Maßnahmen ─────────────────────────────────────────── */
.measure-item {
  background: var(--surface-alt); border-radius: var(--radius-sm);
  padding: 12px; margin-bottom: 8px;
  border: 1px solid var(--border-light)
}
.measure-item .m-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; gap: 8px }
.measure-item .m-title { font-size: 14px; font-weight: 600; flex: 1 }
.measure-item .m-meta { font-size: 11px; color: var(--text-dim) }
.measure-item .m-actions { display: flex; gap: 6px; margin-top: 10px }

/* ── Assessment / Fragebogen ──────────────────────────── */
.assessment-progress {
  background: var(--surface); border-radius: var(--radius-md);
  padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.assessment-progress .progress-text { font-size: 14px; color: var(--text-muted); margin-bottom: 8px }
.progress-steps { display: flex; gap: 4px; flex-wrap: wrap }
.step-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--border) }
.step-dot.done { background: var(--success) }
.step-dot.current { background: var(--primary) }
.step-dot.skipped { background: var(--text-dim) }

.question-card {
  background: var(--surface); border-radius: var(--radius-md);
  padding: 20px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.question-card .q-num { font-size: 12px; color: var(--text-dim); margin-bottom: 6px }
.question-card .q-dim { font-size: 13px; color: var(--primary); font-weight: 600; margin-bottom: 8px }
.question-card .q-text {
  font-size: 16px; font-weight: 600; margin-bottom: 20px; line-height: 1.5
}
.q-options { display: flex; gap: 10px; flex-wrap: wrap }
.q-option {
  flex: 1; min-width: 90px; padding: 10px 18px;
  border: 2px solid var(--border); border-radius: 8px;
  background: transparent; color: var(--text);
  font-size: 14px; font-weight: 500; cursor: pointer;
  text-align: center; font-family: inherit; transition: .15s;
}
.q-option:hover { border-color: var(--primary); background: var(--surface-alt) }
.q-option.selected { background: var(--primary); border-color: var(--primary); color: #fff }
.q-option.ka { background: var(--surface-alt); border-color: var(--text-dim); opacity: .6 }
.q-option.ka.selected { background: var(--text-dim); border-color: var(--text-dim); color: #fff }

.info-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--border); color: var(--text-muted);
  cursor: pointer; vertical-align: middle; font-size: 13px; transition: .15s;
}
.info-icon:hover { background: var(--primary); color: #fff }
.q-info { display: none !important }
.q-info.show { display: block !important }

.q-nav { display: flex; justify-content: space-between; margin-top: 20px }
.q-nav-btn {
  padding: 8px 20px; border: none; border-radius: 8px;
  cursor: pointer; font-weight: 500; font-size: 14px; font-family: inherit; transition: .15s;
}
.q-nav-btn.btn-prev { background: var(--surface-alt); color: var(--text); border: 1px solid var(--border) }
.q-nav-btn.btn-next { background: var(--primary); color: #fff }
.q-nav-btn.btn-next:hover { background: var(--primary-hover) }

/* ── Ergebnis ──────────────────────────────────────────── */
.result-screen { background: var(--surface); border-radius: var(--radius-md); padding: 24px; text-align: center; box-shadow: var(--shadow) }
.result-stufe { font-size: 28px; font-weight: 800; margin: 10px 0 }
.result-quote { font-size: 16px; color: var(--text-muted); margin-bottom: 16px }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0 }
@media (max-width: 600px) { .result-grid { grid-template-columns: 1fr } }
.result-item { background: var(--surface-alt); border-radius: 8px; padding: 12px }
.result-item .label { font-size: 12px; color: var(--text-muted) }
.result-item .value { font-size: 20px; font-weight: 700; margin-top: 2px }

/* ── Tabs ──────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px; margin-bottom: 16px;
  background: var(--surface-alt); border-radius: var(--radius-md);
  padding: 4px; overflow-x: auto;
}
.tab {
  padding: 8px 18px; border: none; border-radius: 8px;
  background: transparent; color: var(--text-muted); cursor: pointer;
  font-size: 14px; font-weight: 600; white-space: nowrap; font-family: inherit; transition: .15s;
}
.tab.active { background: var(--primary); color: #fff }
.tab:hover:not(.active) { color: var(--text) }

/* ── Kennzahlen ────────────────────────────────────────── */
.kz-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap }
.kz-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius-md); padding: 12px 16px;
  min-width: 120px; flex: 1 0 auto; box-shadow: var(--shadow);
}
.kz-num { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; line-height: 1; font-variant-numeric: tabular-nums }
.kz-label { font-size: 11px; color: var(--text-muted); font-weight: 500; margin-top: 2px }
.kz-icon {
  width: 28px; height: 28px; display: flex; align-items: center;
  justify-content: center; border-radius: 8px; flex-shrink: 0
}
.kz-icon svg { width: 18px; height: 18px; stroke-width: 2 }
.kz-total .kz-icon { background: var(--accent-green-light); color: var(--accent-green) }
.kz-kritisch .kz-num { color: #ef4444 }
.kz-kritisch .kz-icon { background: var(--danger-bg); color: #ef4444 }
.kz-hoch .kz-num { color: var(--primary) }
.kz-hoch .kz-icon { background: rgba(223,88,48,.1); color: var(--primary) }
.kz-mittel .kz-num { color: var(--warning) }
.kz-mittel .kz-icon { background: var(--warning-bg); color: var(--warning) }
.kz-niedrig .kz-num { color: var(--success) }
.kz-niedrig .kz-icon { background: var(--success-bg); color: var(--success) }
.kz-massnahmen .kz-icon { background: rgba(249,115,22,.1); color: var(--orange) }
.kz-ueberfaellig .kz-icon { background: var(--danger-bg); color: #ef4444 }
.kz-keine .kz-icon { background: var(--surface-alt); color: var(--text-dim) }

/* ── Expanded Card ─────────────────────────────────────── */
.client-card.expanded { grid-column: 1 / -1 }
.card-expanded { border-top: 1px solid var(--border-light); margin-top: 10px; padding-top: 10px }
.card-expand-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 6px; margin-bottom: 8px }
.cstat { background: var(--surface-alt); border-radius: 6px; padding: 6px 8px; text-align: center }
.cstat span { display: block; font-size: 10px; color: var(--text-dim) }
.cstat strong { font-size: 14px; font-weight: 700 }
.card-expand-dims { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin-bottom: 8px }
.card-expand-measures { background: var(--surface-alt); border-radius: 8px; padding: 8px; margin-bottom: 6px }
.card-expand-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px }
.card-expand-actions .btn { flex: 1; min-width: 60px; padding: 5px 10px; font-size: 12px; border-radius: 6px }
.card-expand-actions .btn-primary { background: rgba(223,88,48,.1); color: var(--primary) }
.card-expand-actions .btn-secondary { background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border) }
.card-expand-actions .btn-danger { background: rgba(220,38,38,.08); color: var(--danger) }

/* ── Overlays / Modals ─────────────────────────────────── */
.modal-overlay, .user-modal, .agenda-modal-overlay, .ma-edit-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4); z-index: 100;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.show, .user-modal.show { display: flex }
.modal, .user-modal-inner, .modal-content, .agenda-modal, .ma-edit-modal {
  background: var(--surface); border-radius: var(--radius-lg);
  max-width: 520px; width: 100%; max-height: 80vh;
  overflow-y: auto; padding: 24px; box-shadow: var(--shadow-lg);
}
.agenda-modal { max-width: 660px }
.ma-edit-modal { max-width: 560px }
.modal h3, .user-modal-inner h3, .ma-edit-modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 10px }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px }
.modal p { font-size: 14px; color: var(--text-muted); margin-bottom: 14px }
.user-modal-inner label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px }
.user-modal-inner input, .modal input {
  width: 100%; padding: 10px 12px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 14px; transition: .15s;
}
.user-modal-inner input:focus, .modal input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(223,88,48,.1) }

.user-badge {
  font-size: 13px; color: var(--text); background: var(--surface);
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border); display: flex; align-items: center; gap: 6px;
  cursor: pointer; line-height: 1;
}
.user-badge:hover { border-color: var(--primary); }

/* ── Log-Einträge ──────────────────────────────────────── */
.log-item {
  padding: 10px 14px; border-left: 4px solid var(--border);
  margin-bottom: 6px; background: var(--surface); border-radius: 0 8px 8px 0
}
.log-item .log-date { font-size: 11px; color: var(--text-dim) }
.log-item .log-text { font-size: 14px; margin: 4px 0 }
.log-item .log-user { font-size: 11px; color: var(--text-dim) }
.log-item.auto_eskalation { border-left-color: var(--danger); background: var(--danger-bg) }
.log-item.deeskalation { border-left-color: var(--success); background: var(--success-bg) }
.log-item.measure { border-left-color: var(--orange); background: rgba(249,115,22,.06) }
.log-item.zuweisung { border-left-color: var(--cyan); background: rgba(6,182,212,.06) }

.log-input {
  width: 100%; padding: 10px 12px; background: var(--surface-alt);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 14px; resize: vertical; min-height: 60px; font-family: inherit;
}
.log-input:focus { outline: none; border-color: var(--primary) }

/* ── Empty / Leerzustände ──────────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-dim) }
.empty-state h3 { font-size: 17px; margin-bottom: 8px }
.empty-state p { color: var(--text-muted); font-size: 14px }

.empty-dashboard { display: flex; align-items: center; justify-content: center; min-height: 50vh; padding: 24px }
.empty-dashboard-card {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 40px; text-align: center;
  max-width: 400px; width: 100%; box-shadow: var(--shadow);
}
.empty-dashboard-card h2 { font-size: 20px; margin: 0 0 8px }
.empty-dashboard-card h2 strong { color: var(--primary) }
.empty-dashboard-role {
  display: inline-block; padding: 4px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 600; color: #fff; margin: 6px auto;
}
.empty-dashboard-hint { font-size: 14px; color: var(--text-muted); margin: 14px 0 0 }

/* ── Setup / Klient anlegen ────────────────────────────── */
.setup-screen { max-width: 420px; margin: 40px auto; text-align: center }
.setup-screen h2 { font-size: 19px; margin-bottom: 8px }
.setup-screen p { color: var(--text-muted); margin-bottom: 20px; font-size: 14px }
.setup-input-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px }
.setup-input {
  width: 100%; padding: 10px 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 14px; transition: .15s;
}
.setup-input:focus { outline: none; border-color: var(--primary) }
.setup-row { display: flex; gap: 8px }

/* ── Agenda ────────────────────────────────────────────── */
.agenda-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 0 0 16px; border-bottom: 1px solid var(--border-light); gap: 12px }
.agenda-header h2 { font-size: 17px; font-weight: 700; color: var(--primary) }
.agenda-body { padding: 16px 0 0 }
.agenda-section { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border-light) }
.agenda-section-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; padding: 5px 12px; border-radius: 8px; display: inline-block }
.agenda-esk-title, .agenda-mass-title, .agenda-bew-title, .agenda-pruef-title { background: var(--surface-alt) }
.agenda-item { padding: 10px 14px; margin-bottom: 6px; background: var(--surface-alt); border-radius: 8px; font-size: 14px }
.agenda-footer { padding: 14px 0 0; margin-top: 8px; border-top: 2px solid var(--primary); font-size: 14px }
.agenda-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px }

/* ── Bericht ───────────────────────────────────────────── */
.bericht-screen { background: var(--surface); border-radius: var(--radius-md); padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow) }
.bericht-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; flex-wrap: wrap; gap: 12px }
.bericht-titel { font-size: 20px; font-weight: 700; color: var(--primary) }
.bericht-datum { font-size: 14px; color: var(--text-muted); margin-top: 4px }
.bericht-actions { display: flex; gap: 8px }
.bericht-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px }
.bericht-kachel { background: var(--surface-alt); border-radius: 8px; padding: 14px; text-align: center; border: 1px solid var(--border-light); display: flex; flex-direction: column; align-items: center; gap: 4px }
.bericht-kachel .bz-num { font-size: 24px; font-weight: 800 }
.bericht-kachel .bz-label { font-size: 12px; color: var(--text-muted) }
.bericht-sektion { margin-bottom: 20px }
.bericht-sektion h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 2px solid var(--primary) }
.bericht-tabelle { width: 100%; border-collapse: collapse; font-size: 14px }
.bericht-tabelle th { background: var(--surface-alt); padding: 8px 10px; text-align: left; font-size: 11px; color: var(--text-muted); border-bottom: 2px solid var(--border); text-transform: uppercase; letter-spacing: .5px }

/* ── Unterweisungen ────────────────────────────────────── */
.unterweisungen-page { max-width: 920px; margin: 0 auto }
.unterweisungen-page h2 { font-size: 17px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px }
.unterweisungen-page h3 { font-size: 15px; margin-bottom: 10px; color: var(--accent-green); display: flex; align-items: center; gap: 6px }
.unterweisungen-page h4 { font-size: 14px; margin-bottom: 6px }
.uw-card { background: var(--surface); border-radius: var(--radius-md); padding: 16px; margin-bottom: 14px; border: 1px solid var(--border-light); box-shadow: var(--shadow) }
.uw-card p, .uw-card li { font-size: 14px; line-height: 1.7; color: var(--text) }
.uw-card ul { padding-left: 24px; margin: 8px 0 }
.uw-kontakt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 12px 0 }
.uw-kontakt-item { background: var(--surface-alt); border-radius: 8px; padding: 12px; border: 1px solid var(--border-light); text-align: center }
.uw-kontakt-item .k-icon { font-size: 26px; margin-bottom: 4px }
.uw-kontakt-item .k-name { font-size: 13px; font-weight: 600 }
.uw-kontakt-item .k-nummer { font-size: 15px; font-weight: 700; color: var(--primary) }
.uw-step { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-light); align-items: flex-start }
.uw-step-nr { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0 }
.uw-step-content { flex: 1 }
.uw-step-content strong { font-size: 14px; display: block }
.uw-step-content span { font-size: 13px; color: var(--text-muted) }
.uw-modul-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 12px 0 }
.uw-modul-item { background: var(--surface-alt); border-radius: 8px; padding: 14px; border: 1px solid var(--border-light); cursor: pointer; text-align: center; transition: .15s }
.uw-modul-item:hover { border-color: var(--primary) }
.uw-modul-item .m-icon { font-size: 26px; display: block; margin-bottom: 6px }
.uw-modul-item .m-title { font-size: 14px; font-weight: 600; margin-bottom: 4px }
.uw-modul-item .m-desc { font-size: 12px; color: var(--text-muted) }
.uw-modul-item .m-status { font-size: 11px; margin-top: 6px; display: inline-block; padding: 3px 10px; border-radius: 999px; font-weight: 600 }
.uw-modul-item .m-status-ok { background: var(--success-bg); color: var(--success) }
.uw-modul-item .m-status-pending { background: var(--warning-bg); color: #92400e }
.uw-teilnahme-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px }
.uw-teilnahme-table th { text-align: left; padding: 8px; color: var(--text-muted); font-weight: 600; border-bottom: 2px solid var(--border); font-size: 11px; text-transform: uppercase; letter-spacing: .5px }
.uw-teilnahme-table td { padding: 8px; border-bottom: 1px solid var(--border-light) }
.uw-btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 24px; border: none; border-radius: 999px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; transition: .15s }
.uw-btn-primary { background: var(--primary); color: #fff }
.uw-btn-success { background: var(--success); color: #fff }
.uw-btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text) }
.uw-pdf-link { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 8px; color: var(--text); text-decoration: none; font-size: 14px; cursor: pointer }
.uw-hinweis { background: var(--orange-bg); border: 1px solid #fed7aa; border-radius: 8px; padding: 12px; font-size: 13px; color: #9a3412; display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 }

/* ── Notfall ───────────────────────────────────────────── */
.notfall-fab {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%);
  z-index: 998; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--danger); color: #fff;
  padding: 8px 20px; border-radius: 0 0 12px 12px;
  font-size: 14px; font-weight: 700; font-family: inherit;
  box-shadow: 0 4px 12px rgba(220,38,38,.4); transition: .15s;
}
.notfall-fab:hover { padding-top: 10px }
.notfall-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.6); z-index: 1000; align-items: center; justify-content: center; padding: 20px }
.notfall-overlay.show { display: flex }
.notfall-modal { background: var(--surface); border-radius: var(--radius-md); max-width: 540px; width: 100%; max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-lg) }
.notfall-header { background: var(--danger); color: #fff; padding: 20px; text-align: center; border-radius: var(--radius-md) var(--radius-md) 0 0 }
.notfall-header .nf-icon { display: flex; align-items: center; justify-content: center; margin-bottom: 8px }
.notfall-header .nf-icon svg { width: 44px; height: 44px }
.notfall-header h2 { font-size: 20px; font-weight: 700; margin: 0 }
.notfall-header p { font-size: 14px; opacity: .85; margin-top: 6px }
.notfall-body { padding: 24px; min-height: 200px }
.notfall-progress { display: flex; gap: 4px; margin-bottom: 20px; padding: 0 24px }
.notfall-progress .nf-dot { flex: 1; height: 4px; border-radius: 2px; background: var(--border) }
.notfall-progress .nf-dot.active { background: var(--danger) }
.notfall-progress .nf-dot.done { background: var(--success) }
.notfall-step { display: none }
.notfall-step.active { display: block }
.notfall-step .step-icon { display: flex; align-items: center; justify-content: center; margin-bottom: 12px }
.notfall-step .step-icon svg { width: 48px; height: 48px; color: var(--danger) }
.notfall-step h3 { font-size: 18px; font-weight: 700; color: var(--danger); text-align: center; margin-bottom: 8px }
.notfall-step .step-text { font-size: 15px; line-height: 1.6; color: var(--text); text-align: center; margin-bottom: 16px }
.notfall-step .step-action { background: var(--surface-alt); border-radius: 8px; padding: 14px; margin: 12px 0; border-left: 4px solid var(--danger); font-size: 14px }
.notfall-step .nf-phone-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 14px; background: var(--success); color: #fff; border: none; border-radius: 8px; font-size: 16px; font-weight: 700; cursor: pointer; margin: 12px 0; font-family: inherit; transition: .15s }
.notfall-step .nf-phone-btn:hover { background: #15803d }
.notfall-footer { display: flex; justify-content: space-between; padding: 16px 24px 20px; border-top: 1px solid var(--border-light) }
.notfall-footer .nf-btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; border-radius: 999px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; transition: .15s }
.notfall-footer .nf-btn-back { background: var(--surface-alt); border: 1px solid var(--border); color: var(--text) }
.notfall-footer .nf-btn-next { background: var(--danger); border: none; color: #fff }
.notfall-footer .nf-btn-done { background: var(--success); border: none; color: #fff }
.notfall-footer .nf-btn-close { background: none; border: none; color: var(--text-muted); font-size: 14px; cursor: pointer }

.notfall-112-leiste { display: flex; align-items: center; gap: 10px; padding: 10px 16px; margin: 0 0 10px; background: var(--danger-bg); border: 2px solid var(--danger); border-radius: 8px }
.nf-112-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--danger); color: #fff; border: none; padding: 8px 20px; border-radius: 999px; font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit }
.nf-entscheidung { display: flex; flex-direction: column; gap: 8px }
.nf-entscheidung-btn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; font-family: inherit; font-size: 15px; font-weight: 500; text-align: left; color: var(--text); transition: .15s }
.nf-entscheidung-btn:hover { border-color: var(--primary); background: var(--surface-alt) }
.nf-frage { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; margin-top: 8px }

/* ── Login ──────────────────────────────────────────────── */
#loginRolle { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 }
.role-btn { padding: 8px 16px; border: 2px solid var(--border); border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; font-size: 14px; font-weight: 500; font-family: inherit; transition: .15s }
.role-btn:hover { border-color: var(--primary) }
.role-btn.selected { background: var(--primary); border-color: var(--primary); color: #fff }

/* ── Chat Panel ──────────────────────────────────────────── */
.chat-panel {
  position: fixed; bottom: 82px; right: 20px; z-index: 899;
  width: 380px; max-width: calc(100vw - 32px);
  height: 500px; max-height: calc(100vh - 100px);
  background: var(--surface); border-radius: var(--radius-md);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: none; flex-direction: column; overflow: hidden;
}
.chat-panel.open { display: flex }
.chat-header { background: var(--primary); color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px; flex-shrink: 0 }
.chat-header-icon { display: flex; align-items: center }
.chat-header-icon svg { width: 22px; height: 22px }
.chat-header h3 { margin: 0; font-size: 15px }
.chat-header span { font-size: 11px; opacity: .8 }
.chat-close { margin-left: auto; background: none; border: none; color: #fff; cursor: pointer; display: flex; align-items: center }
.chat-close svg { width: 18px; height: 18px }
.chat-msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px }
.chat-msg { max-width: 85%; padding: 10px 14px; border-radius: 10px; font-size: 14px; line-height: 1.5 }
.chat-msg.bot { background: var(--surface-alt); color: var(--text); align-self: flex-start }
.chat-msg.user { background: var(--primary); color: #fff; align-self: flex-end }
.chat-msg .msg-label { font-size: 10px; font-weight: 600; margin-bottom: 6px; opacity: .7 }
.chat-input-wrap { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); flex-shrink: 0 }
.chat-input { flex: 1; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 14px; outline: none; background: var(--surface-alt); transition: .15s }
.chat-input:focus { border-color: var(--primary); background: var(--surface) }
.chat-send { background: var(--primary); color: #fff; border: none; border-radius: 8px; padding: 0 16px; cursor: pointer; display: flex; align-items: center }
.chat-send svg { width: 18px; height: 18px }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--border); flex-shrink: 0 }
.chat-suggestion { display: inline-block; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 999px; padding: 5px 14px; font-size: 12px; cursor: pointer; color: var(--text-muted); transition: .15s }
.chat-suggestion:hover { border-color: var(--primary); color: var(--primary) }

/* ── Maßnahmen-Edit ────────────────────────────────────── */
.ma-edit-field { margin-bottom: 14px }
.ma-edit-field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px }
.ma-edit-input { width: 100%; padding: 10px 12px; background: var(--bg); border: 2px solid var(--border); border-radius: 8px; color: var(--text); font-size: 14px; font-family: inherit; transition: .15s }
.ma-edit-input:focus { outline: none; border-color: var(--primary); background: var(--surface) }
textarea.ma-edit-input { resize: vertical; min-height: 70px }
.ma-edit-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-light) }
.ma-edit-rollen { display: flex; flex-wrap: wrap; gap: 6px }
.ma-edit-rolle { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; cursor: pointer; border: 2px solid; transition: .15s }

/* ── Maßnahmen-Controlling ─────────────────────────────── */
.ma-co-item { background: var(--surface); border-radius: 8px; padding: 12px; margin-bottom: 6px; border: 1px solid var(--border-light); border-left: 4px solid var(--orange) }
.ma-co-item.ueberfaellig { border-left-color: var(--danger) !important }
.ma-co-item.erledigt { border-left-color: var(--success) !important; opacity: .6 }
.ma-co-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px }
.ma-co-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; justify-content: center; align-items: stretch }
.ma-co-stat { background: var(--surface); border-radius: 8px; padding: 10px 16px; border: 1px solid var(--border-light); min-width: 100px; flex: 1 1 100px; max-width: 140px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px }
.ma-co-stat .mcs-num { font-size: 20px; font-weight: 700 }
.ma-co-stat .mcs-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px }
.ma-co-filters { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; justify-content: center }
.ma-co-filter { padding: 6px 16px; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 12px; font-family: inherit; transition: .15s; display: flex; align-items: center; gap: 4px }
.ma-co-filter.active { background: var(--primary); border-color: var(--primary); color: #fff }
.ma-co-empty { text-align: center; padding: 24px; color: var(--text-dim); font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 8px }
.bericht-tabelle td { padding: 6px 10px; border-bottom: 1px solid var(--border-light); font-size: 13px }
.bericht-warning { background: var(--danger-bg); color: var(--danger-text); padding: 10px; border-radius: 6px; margin-top: 8px; font-size: 13px; display: flex; align-items: center; gap: 6px }
.bericht-keine { text-align: center; padding: 40px; color: var(--text-dim); font-size: 15px; display: flex; flex-direction: column; align-items: center; gap: 4px }

/* ── Aufgaben ──────────────────────────────────────────── */
.aufgaben-section { margin-bottom: 14px }
.aufgaben-kachel { background: var(--surface); border-radius: var(--radius-md); padding: 14px; margin-bottom: 8px; border-left: 4px solid var(--orange); border: 1px solid var(--border-light); box-shadow: var(--shadow) }
.aufgaben-kachel h4 { font-size: 14px; margin-bottom: 6px }
.aufgaben-meta { font-size: 13px; color: var(--text-muted) }

/* ── Emoji-Picker ──────────────────────────────────────── */
.emoji-picker-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; background: var(--bg); border: 2px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 26px }
.emoji-picker-dropdown { display: none; margin-top: 6px; background: var(--surface); border: 2px solid var(--border); border-radius: 8px; max-height: 240px; overflow-y: auto; padding: 8px }
.emoji-picker-dropdown.open { display: block }
.emoji-picker-grid { display: flex; flex-wrap: wrap; gap: 4px }
.emoji-picker-option { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; font-size: 22px; border-radius: 6px; cursor: pointer; transition: .1s }
.emoji-picker-option:hover { background: var(--surface-alt) }

/* ── Print ─────────────────────────────────────────────── */
@media print {
  body { background: #fff !important }
  .header, .sidebar, .sidebar-overlay, .hamburger,
  .reminder-bar, .task-bar, .filter-bar, .filter-panel,
  .bericht-actions { display: none !important }
  .bericht-screen { box-shadow: none !important; border: 1px solid #ddd !important }
}

/* ── Mobile ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr }
  .header-left h1 { font-size: 16px }
  .question-card { padding: 16px }
  .q-option { min-width: 80px; padding: 10px }
}

/* ── PWA Status ────────────────────────────────────────── */
.pwa-online { color: var(--success); font-weight: 600 }
.pwa-offline { color: var(--danger); font-weight: 600 }
.bg-surface2 { background: var(--surface-alt) }

/* ── Bottom Navigation ─────────────────────────────────── */
@media (min-width: 600px) {
  .bottom-nav { display: none }
}
@media (max-width: 599px) {
  .hamburger { display: none !important }
  .sidebar {
    display: flex !important;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay { display: block !important; opacity: 0; pointer-events: none; transition: opacity 0.25s ease }
  .sidebar-overlay.show { opacity: 1; pointer-events: auto }
}
.bottom-nav {
  display: flex; align-items: flex-start; justify-content: center;
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 600px;
  height: 64px; padding: 0 4px;
  background: #fff;
  border-top-left-radius: var(--radius-md); border-top-right-radius: var(--radius-md);
  border-top: 1px solid var(--border-light);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
  z-index: 500; gap: 0;
}
.bottom-nav-item {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; flex: 1; height: 100%;
  border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 500;
  color: var(--text-muted); transition: .15s;
  position: relative; padding: 6px 0 8px;
}
.bottom-nav-item svg {
  width: 24px; height: 24px; stroke-width: 1.8;
  transition: .15s;
}
.bottom-nav-item span { line-height: 1; white-space: nowrap }
.bottom-nav-item.active { color: var(--primary) }
.bottom-nav-item.active svg { stroke-width: 2.5 }
.nav-badge {
  position: absolute; top: 2px; right: 50%;
  transform: translateX(calc(50% + 8px));
  background: var(--primary); color: #fff;
  font-size: 9px; font-weight: 700;
  min-width: 16px; height: 16px;
  align-items: center; justify-content: center;
  border-radius: 8px; padding: 0 4px;
  line-height: 1; box-sizing: border-box;
  display: none;
}
.bottom-nav-item:active { opacity: .6 }

/* ── Maßnahmen-Zuordnung ──────────────────────────────── */
.mz-gruppe { margin-bottom: 16px }
.mz-gruppe-titel {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 700; padding: 10px 14px;
  border-radius: 10px 10px 0 0; margin-bottom: 0;
}
.mz-gruppe-stufe2 { background: #fef9e7; color: #92400e }
.mz-gruppe-stufe3 { background: #fff5f0; color: #9a3412 }
.mz-gruppe-stufe4 { background: #fef2f2; color: #991b1b }
.mz-item {
  background: var(--surface); border: 1px solid var(--border-light);
  border-top: none; padding: 12px 14px;
}
.mz-item:last-child { border-radius: 0 0 10px 10px; margin-bottom: 12px }
.mz-item-top {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
}
.mz-item-text { font-size: 13px; font-weight: 500; flex: 1; line-height: 1.4 }
.mz-item-meta {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px;
  font-size: 12px; color: var(--text-muted);
}
.mz-item-meta span { display: flex; align-items: center; gap: 3px }
.mz-item-meta svg { width: 14px; height: 14px; flex-shrink: 0 }

/* ── Chat Panel ─────────────────────────────────────────── */
/* ── Fragen-Konfiguration ───────────────────────────────── */
.fk-dim-group {
  background: var(--surface);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}
.fk-card {
  background: var(--bg);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  border-left: 3px solid var(--accent);
}
.fk-card-header {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-family: monospace;
  display: flex;
  align-items: center;
  gap: 2px;
}
.fk-card-weight {
  color: var(--text-muted);
  margin-left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.fk-field {
  margin-bottom: 6px;
}
.fk-field label {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 3px;
}
.fk-textarea {
  width: 100%;
  padding: 7px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.fk-textarea:focus {
  border-color: var(--accent);
}
.fk-textarea-main { min-height: 42px; }
.fk-textarea-sub { min-height: 34px; font-size: 12px; }
.fk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.fk-btn-reset {
  background: transparent !important;
  border: 1px solid var(--border) !important;
  color: var(--text-muted) !important;
  font-size: 11px !important;
}
.fk-btn-archive {
  background: transparent !important;
  border: 1px solid var(--danger) !important;
  color: var(--danger) !important;
  font-size: 11px !important;
  cursor: pointer !important;
}
.fk-btn-delete {
  background: transparent !important;
  border: 1px solid var(--danger) !important;
  color: var(--danger) !important;
  font-size: 11px !important;
  cursor: pointer !important;
}
.fk-toggle-archived {
  background: transparent !important;
  border: 1px dashed var(--text-dim) !important;
  color: var(--text-muted) !important;
  padding: 4px 12px !important;
  border-radius: 6px !important;
  font-size: 11px !important;
  cursor: pointer !important;
  width: 100% !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.fk-archived-card {
  background: var(--surface-alt);
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 6px;
  border-left: 3px dashed var(--text-dim);
  opacity: 0.7;
}
.fk-add-btn {
  background: transparent !important;
  border: 1px dashed var(--accent) !important;
  color: var(--accent) !important;
  padding: 6px 14px !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  cursor: pointer !important;
  width: 100% !important;
  margin-top: 4px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

@media (max-width: 768px) {
  .view { padding-bottom: 80px }
  .header { padding-right: 0 }
}

/* ==========================================================
   Responsive: Tablet (768px – 1199px)
   Sidebar always visible, icons only (~56px), no hamburger
   ========================================================== */
@media (min-width: 768px) and (max-width: 1199px) {
  /* Hide hamburger toggle button */
  .hamburger { display: none !important }

  /* Keep dark overlay hidden permanently */
  .sidebar-overlay { display: none !important }

  /* Sidebar: always visible, fixed left, icons-only width */
  .sidebar {
    transform: translateX(0) !important;
    width: 56px;
    left: 0;
    z-index: 100;
    padding-bottom: 16px;
  }

  /* Sidebar header: icon only, no text */
  .sidebar-header {
    padding: 16px 9px;
    justify-content: center;
  }
  .sidebar-header .app-name,
  .sidebar-header .app-sub { display: none }

  /* Nav items: centered icons, hidden labels */
  .sidebar-item {
    padding: 0 9px;
    justify-content: center;
    height: 48px;
  }
  .sidebar-item .label { display: none !important }
  .sidebar-item .badge-count { display: none !important }
  .sidebar-item.active { border-left-width: 2px }

  /* Doc link: icon only */
  .sidebar-doc {
    justify-content: center;
    padding: 12px 9px;
  }
  .sidebar-doc span { display: none }

  /* Hide sidebar footer text */
  .sidebar-footer { display: none }

  /* Content area: shift right to accommodate sidebar */
  .app { padding-left: 56px; padding-bottom: 24px }

  /* Override mobile bottom padding on views */
  .view { padding-bottom: 0 !important }

  /* Hide bottom navigation on tablet (sidebar replaces it) */
  .bottom-nav { display: none !important }
}

/* ==========================================================
   Responsive: Desktop (1200px+)
   Sidebar always visible with labels (~220px), stat grids
   ========================================================== */
@media (min-width: 1200px) {
  /* Hide hamburger */
  .hamburger { display: none !important }

  /* Keep overlay hidden */
  .sidebar-overlay { display: none !important }

  /* Sidebar: always visible, fixed left, full width with labels */
  .sidebar {
    transform: translateX(0) !important;
    width: 220px;
    left: 0;
    z-index: 100;
    padding-bottom: 16px;
  }

  /* Show all sidebar content */
  .sidebar-header { padding: 24px 16px }
  .sidebar-header .app-name,
  .sidebar-header .app-sub { display: block }

  /* Nav items: show labels */
  .sidebar-item {
    padding: 0 16px;
    justify-content: flex-start;
  }
  .sidebar-item .label { display: block !important }
  .sidebar-item.active { border-left-width: 3px }

  /* Doc link: show text */
  .sidebar-doc {
    justify-content: flex-start;
    padding: 12px 16px;
  }
  .sidebar-doc span { display: inline }

  /* Show footer */
  .sidebar-footer { display: block }

  /* Content area: shift right with sidebar offset */
  .app {
    padding-left: 220px;
    padding-bottom: 24px;
  }

  /* Override mobile bottom padding */
  .view { padding-bottom: 0 !important }

  /* Hide bottom navigation (sidebar replaces it) */
  .bottom-nav { display: none !important }

  /* Stat cards: 3-4 column grid */
  .kz-bar {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
  }
  .kz-card { min-width: 0; flex: none }
}