/* ===== REALOMAT DESIGN SYSTEM ===== */

/* --- Tokens --- */
:root {
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-light: #eff6ff;
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --color-text-light: #94a3b8;

  --color-rot: #ef4444;
  --color-rot-bg: #fef2f2;
  --color-gelb: #f59e0b;
  --color-gelb-bg: #fffbeb;
  --color-gruen: #22c55e;
  --color-gruen-bg: #f0fdf4;
  --color-blau: #3b82f6;
  --color-blau-bg: #eff6ff;
  --color-grau: #94a3b8;
  --color-grau-bg: #f1f5f9;

  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.05);
  --transition: 200ms ease;

  --sidebar-w: 240px;
  --topbar-h: 60px;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
input, select, button { font: inherit; }

.hidden { display: none !important; }

/* --- Typography --- */
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 22px; font-weight: 600; }
h3 { font-size: 18px; font-weight: 600; }
h4 { font-size: 15px; font-weight: 600; }
.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: 13px; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; cursor: pointer;
  border: none; transition: all var(--transition);
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-secondary { background: var(--color-primary-light); color: var(--color-primary); border: 1px solid var(--color-primary); }
.btn-secondary:hover { background: #dbeafe; }
.btn-ghost { background: transparent; color: var(--color-text-muted); }
.btn-ghost:hover { background: var(--color-bg); color: var(--color-text); }
.btn-full { width: 100%; justify-content: center; }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-icon { background: none; border: none; cursor: pointer; padding: 6px; border-radius: var(--radius-sm); color: var(--color-text-muted); display:flex;align-items:center; }
.btn-icon:hover { background: var(--color-bg); color: var(--color-text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* --- Card --- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
}

/* --- Badge --- */
.badge {
  display: inline-flex; align-items: center; padding: 4px 12px;
  border-radius: 20px; font-size: 13px; font-weight: 500;
}
.badge-rot { background: var(--color-rot-bg); color: var(--color-rot); }
.badge-gelb { background: var(--color-gelb-bg); color: var(--color-gelb); }
.badge-gruen { background: var(--color-gruen-bg); color: var(--color-gruen); }
.badge-blau { background: var(--color-blau-bg); color: var(--color-blau); }
.badge-grau { background: var(--color-grau-bg); color: var(--color-grau); }

/* --- Inputs --- */
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  font-size: 14px; background: var(--color-surface);
  transition: border var(--transition);
}
input:focus, select:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.input-sm { width: 80px; padding: 8px 10px; }

/* --- Slider --- */
.slider {
  -webkit-appearance: none; width: 100%; height: 6px;
  border-radius: 3px; background: var(--color-border); outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px;
  border-radius: 50%; background: var(--color-primary); cursor: pointer;
}

/* --- Progress bar --- */
.progress-bar { width: 100%; height: 10px; background: var(--color-bg); border-radius: 5px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--color-primary); border-radius: 5px; transition: width 600ms ease; }

/* ===== SCREEN: LOGIN ===== */
.screen { display: none; }
.screen.active { display: flex; }

.login-wrapper {
  width: 100vw; height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #7c3aed 100%);
}
.login-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 420px; max-width: 95vw;
  box-shadow: var(--shadow-lg);
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.login-logo h1 { font-size: 28px; }
.login-subtitle { color: var(--color-text-muted); margin-bottom: 32px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.login-divider {
  display: flex; align-items: center; gap: 16px;
  margin: 24px 0; color: var(--color-text-light); font-size: 13px;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--color-border);
}

/* ===== APP SHELL ===== */
.app-shell { display: flex; min-height: 100vh; }

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w); background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  transition: transform var(--transition);
}
.sidebar.collapsed { transform: translateX(calc(var(--sidebar-w) * -1)); }
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--color-border); }
.sidebar-brand { font-size: 18px; font-weight: 700; color: var(--color-primary); }
.sidebar-nav { flex: 1; padding: 12px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--color-text-muted);
  transition: all var(--transition); margin-bottom: 2px;
}
.nav-item:hover { background: var(--color-bg); color: var(--color-text); }
.nav-item.active { background: var(--color-primary-light); color: var(--color-primary); }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--color-border); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--color-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 14px; font-weight: 500; }
.user-role { font-size: 12px; color: var(--color-text-muted); }

/* --- Main area --- */
.main-area { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; transition: margin var(--transition); }

/* --- Topbar --- */
.topbar {
  height: var(--topbar-h); background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 16px; font-weight: 600; white-space: nowrap; }
.topbar-search {
  flex: 1; max-width: 400px;
  display: flex; align-items: center; gap: 8px;
  background: var(--color-bg); border-radius: var(--radius-sm);
  padding: 0 12px;
}
.topbar-search input { border: none; background: transparent; padding: 8px 0; }
.topbar-search input:focus { box-shadow: none; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; position: relative; }
.notification-dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-rot);
}
.lang-switcher { display: flex; gap: 2px; margin-right: 8px; }
.lang-btn {
  padding: 4px 8px; border-radius: 4px; border: 1px solid var(--color-border);
  background: transparent; font-size: 12px; font-weight: 600;
  cursor: pointer; color: var(--color-text-muted); transition: all var(--transition);
}
.lang-btn:hover { background: var(--color-bg); color: var(--color-text); }
.lang-btn.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.sidebar-toggle { display: none; }

/* --- Content --- */
.content { padding: 24px; flex: 1; }
.view { display: none; }
.view.active { display: block; }

/* ===== DASHBOARD ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.kpi-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-label { font-size: 13px; color: var(--color-text-muted); margin-bottom: 4px; }
.kpi-value { font-size: 26px; font-weight: 700; line-height: 1.2; }
.kpi-sub { font-size: 12px; color: var(--color-text-light); margin-top: 4px; }
.kpi-card .kpi-icon { position: absolute; top: 16px; right: 16px; opacity: .15; }

.dashboard-actions { display: flex; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }

/* --- Tabs --- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--color-border); margin-bottom: 24px; }
.tab {
  padding: 10px 20px; font-size: 14px; font-weight: 500;
  color: var(--color-text-muted); background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  cursor: pointer; transition: all var(--transition);
}
.tab:hover { color: var(--color-text); }
.tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- Overview grid --- */
.overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.overview-chart, .overview-buildings, .overview-risk { min-height: 200px; }
.chart-container { padding: 16px 0; }

/* Bar chart (CSS based) */
.bar-chart { display: flex; align-items: flex-end; gap: 20px; height: 160px; padding-top: 10px; }
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar-pair { display: flex; gap: 4px; align-items: flex-end; height: 130px; }
.bar {
  width: 28px; border-radius: 4px 4px 0 0; transition: height 600ms ease;
  position: relative;
}
.bar-ist { background: var(--color-primary); opacity: .6; }
.bar-soll { background: var(--color-primary); }
.bar-label { font-size: 11px; color: var(--color-text-muted); text-align: center; }

/* Donut chart */
.donut-chart { display: flex; align-items: center; gap: 24px; }
.donut-svg { width: 120px; height: 120px; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }

/* Buildings list */
.building-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--color-border);
  cursor: pointer; transition: background var(--transition);
}
.building-row:hover { background: var(--color-bg); margin: 0 -24px; padding: 12px 24px; }
.building-row:last-child { border-bottom: none; }
.building-info { display: flex; flex-direction: column; gap: 2px; }
.building-name { font-weight: 500; font-size: 14px; }
.building-meta { font-size: 12px; color: var(--color-text-muted); }
.risk-score-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 20px;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.risk-high { color: var(--color-rot); }
.risk-medium { color: var(--color-gelb); }
.risk-low { color: var(--color-gruen); }
.risk-score-badge.high { background: var(--color-rot-bg); color: var(--color-rot); }
.risk-score-badge.medium { background: var(--color-gelb-bg); color: var(--color-gelb); }
.risk-score-badge.low { background: var(--color-gruen-bg); color: var(--color-gruen); }

/* Risk list */
.risk-item { padding: 10px 0; border-bottom: 1px solid var(--color-border); font-size: 14px; display: flex; align-items: start; gap: 8px; }
.risk-item:last-child { border-bottom: none; }
.risk-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }

/* ===== IMPORT WIZARD ===== */
.wizard { max-width: 700px; margin: 0 auto; }
.wizard-steps { display: flex; justify-content: center; gap: 8px; margin-bottom: 32px; }
.wizard-step {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 20px;
  font-size: 14px; color: var(--color-text-muted);
  background: var(--color-bg);
}
.wizard-step.active { background: var(--color-primary); color: #fff; }
.wizard-step.done { background: var(--color-gruen-bg); color: var(--color-gruen); }
.step-num { font-weight: 700; }
.wizard-content { display: none; }
.wizard-content.active { display: block; }

/* Upload area */
.upload-area {
  text-align: center; padding: 48px;
  border: 2px dashed var(--color-border); cursor: pointer;
  transition: all var(--transition);
}
.upload-area:hover { border-color: var(--color-primary); background: var(--color-primary-light); }
.upload-area h3 { margin: 16px 0 8px; }
.upload-area .btn { margin-top: 16px; }
.upload-file-info { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.upload-success .card { text-align: left; }

/* Mapping */
.mapping-grid { display: flex; flex-direction: column; gap: 12px; margin: 24px 0; }
.mapping-row { display: flex; align-items: center; gap: 12px; }
.mapping-source { flex: 1; font-size: 14px; font-weight: 500; padding: 10px; background: var(--color-bg); border-radius: var(--radius-sm); }
.mapping-arrow { color: var(--color-text-muted); font-size: 18px; }
.mapping-select { flex: 1; }
.wizard-actions { display: flex; justify-content: space-between; margin-top: 24px; }

/* Loader */
.analysis-loader { text-align: center; padding: 48px; }
.loader-spinner {
  width: 48px; height: 48px; border: 4px solid var(--color-border);
  border-top-color: var(--color-primary); border-radius: 50%;
  animation: spin 1s linear infinite; margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-steps { margin: 24px 0; text-align: left; max-width: 300px; margin-left: auto; margin-right: auto; }
.loader-step { padding: 8px 0; font-size: 14px; color: var(--color-text-muted); display: flex; align-items: center; gap: 8px; }
.loader-step.done { color: var(--color-gruen); }
.loader-check { opacity: 0; transition: opacity 300ms; }
.loader-step.done .loader-check { opacity: 1; }

/* Analysis done */
.analysis-done { text-align: center; padding: 48px; }
.analysis-done h3 { margin: 16px 0 24px; }
.analysis-summary { display: flex; gap: 24px; justify-content: center; margin-bottom: 32px; flex-wrap: wrap; }
.analysis-stat { display: flex; flex-direction: column; align-items: center; }
.stat-num { font-size: 28px; font-weight: 700; color: var(--color-primary); }
.stat-label { font-size: 13px; color: var(--color-text-muted); }

/* ===== HEATMAP / EINHEITEN ===== */
.heatmap-layout { display: grid; grid-template-columns: 260px 1fr; gap: 0; min-height: calc(100vh - var(--topbar-h) - 48px); }
.heatmap-layout.drawer-open { grid-template-columns: 260px 1fr 360px; }

/* Filter panel */
.filter-panel {
  background: var(--color-surface); border-right: 1px solid var(--color-border);
  padding: 20px; overflow-y: auto; max-height: calc(100vh - var(--topbar-h) - 48px);
}
.filter-panel h3 { margin-bottom: 16px; }
.filter-group { margin-bottom: 20px; }
.filter-group label { display: block; font-size: 13px; font-weight: 500; color: var(--color-text-muted); margin-bottom: 8px; }
.filter-select { padding: 8px 10px; font-size: 13px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 12px; border-radius: 16px; font-size: 12px;
  font-weight: 500; cursor: pointer; border: 2px solid transparent;
  transition: all var(--transition);
}
.chip-rot { background: var(--color-rot-bg); color: var(--color-rot); }
.chip-gelb { background: var(--color-gelb-bg); color: var(--color-gelb); }
.chip-gruen { background: var(--color-gruen-bg); color: var(--color-gruen); }
.chip-blau { background: var(--color-blau-bg); color: var(--color-blau); }
.chip-grau { background: var(--color-grau-bg); color: var(--color-grau); }
.chip.active { border-color: currentColor; box-shadow: 0 0 0 1px currentColor; }
.range-inputs { display: flex; align-items: center; gap: 8px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; min-height: 0; }
.active-filter {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 12px;
  background: var(--color-primary-light); color: var(--color-primary);
  font-size: 12px; cursor: pointer;
}
.active-filter:hover { background: #dbeafe; }

/* Heatmap center */
.heatmap-center { padding: 20px; overflow-y: auto; max-height: calc(100vh - var(--topbar-h) - 48px); }
.heatmap-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.heatmap-header .badge { background: var(--color-primary-light); color: var(--color-primary); }

.heatmap-building { margin-bottom: 32px; }
.heatmap-building-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.heatmap-building-name { font-size: 16px; font-weight: 600; }
.heatmap-building-meta { font-size: 13px; color: var(--color-text-muted); }
.heatmap-floor { margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.floor-label { font-size: 12px; color: var(--color-text-muted); width: 50px; text-align: right; flex-shrink: 0; }
.floor-units { display: flex; gap: 4px; flex-wrap: wrap; }

.unit-cell {
  width: 50px; height: 40px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; color: #fff;
  cursor: pointer; transition: all var(--transition);
  position: relative;
}
.unit-cell:hover { transform: scale(1.15); z-index: 10; box-shadow: var(--shadow-md); }
.unit-cell.status-rot { background: var(--color-rot); }
.unit-cell.status-gelb { background: var(--color-gelb); }
.unit-cell.status-gruen { background: var(--color-gruen); }
.unit-cell.status-blau { background: var(--color-blau); }
.unit-cell.status-grau { background: var(--color-grau); }
.unit-cell.selected { outline: 3px solid var(--color-text); outline-offset: 2px; }
.unit-cell.filtered-out { opacity: .15; pointer-events: none; }

/* Detail drawer */
.detail-drawer {
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  display: flex; flex-direction: column;
  max-height: calc(100vh - var(--topbar-h) - 48px);
  overflow-y: auto;
}
.drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--color-border); }
.drawer-tabs { display: flex; border-bottom: 1px solid var(--color-border); padding: 0 20px; }
.drawer-tabs .tab { font-size: 13px; padding: 10px 16px; }
.drawer-body { flex: 1; padding: 20px; overflow-y: auto; }
.drawer-footer { padding: 16px 20px; border-top: 1px solid var(--color-border); display: flex; gap: 8px; }
.drawer-footer .btn { font-size: 13px; padding: 8px 14px; flex: 1; justify-content: center; }

/* Drawer profile */
.drawer-profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.drawer-field { display: flex; flex-direction: column; gap: 2px; }
.drawer-field-label { font-size: 12px; color: var(--color-text-muted); }
.drawer-field-value { font-size: 14px; font-weight: 500; }

/* ===== MASSNAHMEN ===== */
.massnahmen-layout { display: grid; grid-template-columns: 1fr 420px; gap: 24px; }

/* Timeline */
.timeline-card { margin-bottom: 24px; }
.timeline-bar { display: flex; gap: 4px; margin-top: 12px; }
.timeline-year {
  flex: 1; padding: 10px; text-align: center;
  font-size: 13px; font-weight: 500;
  background: var(--color-bg); border-radius: var(--radius-sm);
  color: var(--color-text-muted);
}
.timeline-year.active { background: var(--color-primary); color: #fff; }

/* Massnahmen catalog */
.massnahmen-category { margin-bottom: 24px; }
.massnahmen-category h3 { margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.category-badge { font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.cat-energetik { background: #fef3c7; color: #92400e; }
.cat-instandhaltung { background: #e0e7ff; color: #3730a3; }
.cat-mietmassnahmen { background: #d1fae5; color: #065f46; }
.cat-foerderung { background: #fce7f3; color: #9d174d; }

.massnahme-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 16px;
  cursor: pointer; transition: all var(--transition);
}
.massnahme-card:hover { box-shadow: var(--shadow); }
.massnahme-card.active { border-color: var(--color-primary); background: var(--color-primary-light); }
.massnahme-check {
  width: 22px; height: 22px; border-radius: 6px;
  border: 2px solid var(--color-border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); color: #fff; font-size: 14px;
}
.massnahme-card.active .massnahme-check { background: var(--color-primary); border-color: var(--color-primary); }
.massnahme-info { flex: 1; }
.massnahme-name { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.massnahme-details { display: flex; gap: 16px; font-size: 12px; color: var(--color-text-muted); }
.massnahme-editable {
  display: flex; flex-direction: column; gap: 2px; text-align: right; min-width: 90px;
}
.massnahme-editable input {
  width: 80px; padding: 4px 8px; font-size: 13px;
  text-align: right; border: 1px solid var(--color-border);
  border-radius: 4px;
}
.massnahme-editable label { font-size: 11px; color: var(--color-text-muted); }

/* Impact */
.impact-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.impact-card { text-align: center; padding: 16px; }
.impact-label { font-size: 13px; color: var(--color-text-muted); display: block; margin-bottom: 4px; }
.impact-value { font-size: 22px; font-weight: 700; display: block; transition: all var(--transition); }
.impact-delta {
  font-size: 14px; font-weight: 600; display: inline-block;
  padding: 2px 8px; border-radius: 10px; margin-top: 4px;
  transition: all 400ms ease;
}
.impact-delta.positive { background: var(--color-gruen-bg); color: var(--color-gruen); }
.impact-delta.negative { background: var(--color-rot-bg); color: var(--color-rot); }

/* ===== DOKUMENTE ===== */
.dokumente-layout { display: grid; grid-template-columns: 200px 1fr 320px; gap: 0; min-height: calc(100vh - var(--topbar-h) - 48px); }

.folder-tree {
  background: var(--color-surface); border-right: 1px solid var(--color-border);
  padding: 20px 12px;
}
.folder-tree h3 { margin-bottom: 12px; padding: 0 8px; }
.tree-node {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 13px; cursor: pointer; color: var(--color-text-muted);
  transition: all var(--transition); margin-bottom: 2px;
}
.tree-node:hover { background: var(--color-bg); color: var(--color-text); }
.tree-node.active { background: var(--color-primary-light); color: var(--color-primary); font-weight: 500; }

.doc-list-area { padding: 20px; overflow-y: auto; }
.doc-progress-bar-wrapper { margin-bottom: 20px; }
.doc-progress-label { font-size: 14px; margin-bottom: 8px; }
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--color-border); background: var(--color-surface);
  transition: all var(--transition);
}
.doc-row:hover { box-shadow: var(--shadow); }
.doc-status-icon { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.doc-status-vorhanden { background: var(--color-gruen-bg); color: var(--color-gruen); }
.doc-status-unvollstaendig { background: var(--color-gelb-bg); color: var(--color-gelb); }
.doc-status-fehlend { background: var(--color-rot-bg); color: var(--color-rot); }
.doc-info { flex: 1; }
.doc-name { font-size: 14px; font-weight: 500; }
.doc-category { font-size: 12px; color: var(--color-text-muted); }
.doc-action .btn { font-size: 12px; padding: 6px 12px; }
.doc-actions { margin-top: 24px; text-align: center; }

/* AI Panel */
.ai-panel { background: var(--color-surface); border-left: 1px solid var(--color-border); padding: 20px; overflow-y: auto; }
.ai-card { border: 1px solid #dbeafe; background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%); }
.ai-header { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--color-primary); margin-bottom: 16px; }
.ai-section { margin-bottom: 20px; }
.ai-section h4 { margin-bottom: 8px; font-size: 14px; }
.ai-section ul { padding-left: 16px; font-size: 13px; }
.ai-section li { margin-bottom: 6px; line-height: 1.5; }
.risk-list .risk-high { color: var(--color-rot); }
.risk-list .risk-medium { color: var(--color-gelb); }
.risk-list .risk-low { color: var(--color-gruen); }

/* ===== TOOLTIP ===== */
.tooltip {
  position: fixed; z-index: 1000;
  background: var(--color-text); color: #fff;
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 13px; max-width: 260px;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  transition: opacity 150ms;
}
.tooltip.hidden { opacity: 0; display: block; visibility: hidden; }
.tooltip-row { display: flex; justify-content: space-between; gap: 12px; }
.tooltip-label { color: #94a3b8; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.4); display: flex;
  align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--color-surface); border-radius: var(--radius-lg);
  width: 500px; max-width: 95vw; max-height: 80vh;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--color-border); }
.modal-body { padding: 24px; overflow-y: auto; max-height: 60vh; }
.modal-body ul { padding-left: 20px; }
.modal-body li { margin-bottom: 8px; font-size: 14px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(calc(var(--sidebar-w) * -1)); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .heatmap-layout { grid-template-columns: 1fr; }
  .heatmap-layout.drawer-open { grid-template-columns: 1fr; }
  .filter-panel { display: none; }
  .detail-drawer { position: fixed; right: 0; top: var(--topbar-h); bottom: 0; width: 360px; z-index: 90; box-shadow: var(--shadow-lg); }
  .massnahmen-layout { grid-template-columns: 1fr; }
  .dokumente-layout { grid-template-columns: 1fr; }
  .folder-tree, .ai-panel { display: none; }
  .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-value { font-size: 20px; }
  .dashboard-actions { flex-direction: column; }
  .impact-kpis { grid-template-columns: 1fr; }
  .unit-cell { width: 36px; height: 30px; font-size: 8px; }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 400ms ease; }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
.slide-in-right { animation: slideInRight 300ms ease; }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.05)} }
.pulse { animation: pulse 600ms ease; }
