/* ============================================
   KI-Massenermittlung - Stylesheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* --- Design-Tokens: professionelle Bau-Palette (Stahlblau + warmes Bernstein) --- */
:root {
  --primary: #16324f;        /* tiefes, vertrauenswürdiges Stahlblau */
  --primary-light: #21507e;
  --primary-dark: #0c2138;
  --accent: #ef7d12;         /* warmes Bau-Orange, etwas satter */
  --accent-hover: #d96a06;
  --accent-soft: #fef2e3;
  --bg: #eef2f7;             /* kühles Hellgrau */
  --white: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #1e293b;           /* slate-800 */
  --text-light: #64748b;     /* slate-500 */
  --text-faint: #94a3b8;
  --border: #e3e8ef;
  --border-strong: #cbd5e1;
  --shadow-sm: 0 1px 2px rgba(16, 50, 79, 0.06), 0 1px 3px rgba(16, 50, 79, 0.04);
  --shadow: 0 4px 14px rgba(16, 50, 79, 0.08);
  --shadow-lg: 0 14px 40px rgba(16, 50, 79, 0.14);
  --radius: 10px;
  --radius-lg: 16px;
  --changed-bg: #fff3cd;
  --learned-bg: #e0edff;
  --confidence-low-border: var(--accent);
  --green: #16a34a;  --green-soft: #dcfce7;
  --yellow: #d97706; --yellow-soft: #fef3c7;
  --red: #dc2626;    --red-soft: #fee2e2;
  --transition: 0.18s ease;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
}

/* --- Utility --- */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.text-light {
  color: var(--text-light);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* --- Navigation Bar --- */
.navbar {
  background: var(--surface);
  color: var(--text);
  padding: 0 1.75rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(16, 50, 79, 0.02);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.navbar-brand:hover {
  text-decoration: none;
}

.navbar-brand .brand-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: var(--shadow-sm);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.navbar-company {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-light);
}

.navbar-link {
  color: var(--text-light);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  font-family: inherit;
  transition: all var(--transition);
}

.navbar-link:hover {
  color: var(--primary);
  border-color: var(--border-strong);
  background: var(--surface-2);
  text-decoration: none;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1.3rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  font-family: inherit;
  line-height: 1.4;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 80, 126, 0.25);
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

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

.btn-accent {
  background: var(--accent);
  color: var(--white);
}

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

.btn-outline {
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--border-strong);
}

.btn-outline:hover {
  background: var(--surface-2);
  border-color: var(--primary-light);
  color: var(--primary);
}

.btn-sm {
  padding: 0.38rem 0.85rem;
  font-size: 0.82rem;
  border-radius: 8px;
}

.btn-lg {
  padding: 0.85rem 2rem;
  font-size: 1rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  transform: translateY(-2px);
}

/* --- Auth Page (Login / Register) --- */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  padding: 2rem;
}

.auth-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 2.5rem 2rem;
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo .logo-icon {
  width: 60px;
  height: 60px;
  background: var(--accent);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--white);
  margin-bottom: 0.75rem;
}

.auth-logo h1 {
  font-size: 1.4rem;
  color: var(--primary);
  font-weight: 700;
}

.auth-logo p {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Tabs */
.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}

.auth-tab {
  flex: 1;
  padding: 0.75rem;
  text-align: center;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  border: none;
  background: none;
  font-size: 0.95rem;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
}

.auth-tab:hover {
  color: var(--primary);
}

.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--accent);
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 58, 92, 0.12);
}

.form-control::placeholder {
  color: #adb5bd;
}

.form-error {
  color: var(--red);
  font-size: 0.82rem;
  margin-top: 0.3rem;
  display: none;
}

.form-error.visible {
  display: block;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  display: none;
}

.alert.visible {
  display: block;
}

.alert-error {
  background: #f8d7da;
  color: #842029;
  border: 1px solid #f5c2c7;
}

.alert-success {
  background: #d1e7dd;
  color: #0f5132;
  border: 1px solid #badbcc;
}

/* --- Dashboard --- */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header h2 {
  font-size: 1.5rem;
  color: var(--primary);
}

/* Project Grid */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.project-card {
  padding: 1.25rem 1.5rem;
}

.project-card h3 {
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 0.4rem;
}

.project-card .project-address {
  color: var(--text-light);
  font-size: 0.88rem;
  margin-bottom: 0.75rem;
}

.project-card .project-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-light);
}

.project-card .project-plans {
  font-weight: 600;
}

/* Status Badge */
.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-neu {
  background: #e3f2fd;
  color: #1565c0;
}

.badge-analyse {
  background: #fff3e0;
  color: #e65100;
}

.badge-fertig {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-fehler {
  background: #ffebee;
  color: #c62828;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

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

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  padding: 2rem;
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  font-size: 1.2rem;
  color: var(--primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
  line-height: 1;
  padding: 0.25rem;
}

.modal-close:hover {
  color: var(--text);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* --- Upload Zone --- */
.upload-zone {
  border: 2.5px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  background: var(--white);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: #fef8f0;
}

.upload-zone .upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--text-light);
}

.upload-zone h3 {
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 0.4rem;
}

.upload-zone p {
  font-size: 0.9rem;
  color: var(--text-light);
}

.upload-zone input[type="file"] {
  display: none;
}

/* --- Plan List --- */
.plan-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.plan-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.plan-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.plan-icon {
  width: 40px;
  height: 40px;
  background: #e3f2fd;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--primary);
  flex-shrink: 0;
}

.plan-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.plan-status {
  font-size: 0.82rem;
  color: var(--text-light);
}

.plan-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* --- Progress Section --- */
.progress-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 2rem;
}

.progress-bar-wrapper {
  background: #e9ecef;
  border-radius: 20px;
  height: 24px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #f9b44e);
  border-radius: 20px;
  width: 0%;
  transition: width 0.4s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--white);
  min-width: 2rem;
}

.progress-bar.animated {
  background-size: 30px 30px;
  background-image: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.2) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0.2) 75%,
    transparent 75%,
    transparent
  );
  animation: progressStripes 1s linear infinite;
}

@keyframes progressStripes {
  0% { background-position: 30px 0; }
  100% { background-position: 0 0; }
}

/* Agent Status Row */
.agent-row {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.agent-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.agent-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: background var(--transition), box-shadow var(--transition);
  position: relative;
}

.agent-circle.active {
  background: var(--accent);
  color: var(--white);
  box-shadow: 0 0 0 4px rgba(243, 147, 1, 0.25);
  animation: agentPulse 1.5s ease infinite;
}

.agent-circle.done {
  background: var(--green);
  color: var(--white);
  box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.2);
  animation: none;
}

.agent-circle.error {
  background: var(--red);
  color: var(--white);
}

@keyframes agentPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(243, 147, 1, 0.25); }
  50% { box-shadow: 0 0 0 8px rgba(243, 147, 1, 0.1); }
}

.agent-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-light);
}

.agent-circle.active + .agent-label,
.agent-circle.done + .agent-label {
  color: var(--text);
}

.progress-status {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-light);
}

/* --- Results Section --- */
.summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.summary-card {
  text-align: center;
  padding: 1.25rem;
}

.summary-card .summary-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.summary-card .summary-label {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
  gap: 0;
}

.tab-btn {
  padding: 0.7rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: inherit;
  transition: color var(--transition), border-color var(--transition);
}

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

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--accent);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* --- Editable Table --- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table thead th {
  background: var(--primary);
  color: var(--white);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.data-table tbody tr:hover {
  background: #f8f9fa;
}

.data-table tbody td {
  padding: 0.65rem 1rem;
  vertical-align: middle;
}

.data-table tbody td.editable {
  cursor: pointer;
  position: relative;
}

.data-table tbody td.editable:hover {
  background: #eef3f8;
}

.data-table tbody td.changed {
  background: var(--changed-bg) !important;
}

.data-table tbody td.learned {
  background: var(--learned-bg) !important;
}

.data-table tbody td.low-confidence {
  border-left: 3px solid var(--confidence-low-border);
}

.data-table tbody td .cell-input {
  width: 100%;
  padding: 0.3rem 0.5rem;
  font-size: 0.9rem;
  border: 1.5px solid var(--primary);
  border-radius: 4px;
  font-family: inherit;
  background: var(--white);
}

.data-table tbody td .cell-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(26, 58, 92, 0.2);
}

/* Confidence Traffic Light */
.confidence {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.confidence-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e0e0e0;
}

.confidence-green .dot-green {
  background: var(--green);
  box-shadow: 0 0 4px rgba(40, 167, 69, 0.4);
}

.confidence-yellow .dot-yellow {
  background: var(--yellow);
  box-shadow: 0 0 4px rgba(255, 193, 7, 0.4);
}

.confidence-red .dot-red {
  background: var(--red);
  box-shadow: 0 0 4px rgba(220, 53, 69, 0.4);
}

.confidence-value {
  font-size: 0.8rem;
  font-weight: 600;
  margin-left: 4px;
}

/* --- Section Headers --- */
.section {
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --- Project Header --- */
.project-header {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem 2rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.project-header-info h2 {
  font-size: 1.4rem;
  color: var(--primary);
}

.project-header-info p {
  color: var(--text-light);
  font-size: 0.9rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 1rem;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

.back-link:hover {
  color: var(--primary);
  text-decoration: none;
}

/* --- Export Area --- */
.export-area {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-light);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .navbar {
    padding: 0 1rem;
  }

  .page-container {
    padding: 1rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 2rem 1.5rem;
  }

  .agent-row {
    gap: 1rem;
  }

  .agent-circle {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .summary-row {
    grid-template-columns: 1fr 1fr;
  }

  .plan-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .modal {
    padding: 1.5rem;
  }

  .upload-zone {
    padding: 2rem 1rem;
  }

  .tabs {
    overflow-x: auto;
  }

  .tab-btn {
    white-space: nowrap;
    padding: 0.7rem 1rem;
  }
}

/* Manually corrected rows */
.changed-row {
  background-color: #fff3cd;
}

.changed-row td {
  border-left-color: #f39301;
}

/* Loading spinner */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-light);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e0e5ec;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 0.75rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Error alert in cards */
.alert-inline {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  font-size: 0.85rem;
}

/* Delete button */
.btn-danger {
  background: #dc2626;
  color: #fff;
  border: none;
}

.btn-danger:hover {
  background: #b91c1c;
}

/* Delete button on project cards */
.project-card {
  position: relative;
}

.btn-delete-project {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: #dc2626;
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.project-card:hover .btn-delete-project {
  opacity: 1;
}

.btn-delete-project:hover {
  background: #b91c1c;
}

/* Delete button on plan cards */
.btn-delete-plan {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: #dc2626;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  margin-left: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.btn-delete-plan:hover {
  opacity: 1;
  background: #b91c1c;
}

/* Confidence circle in summary card */
.summary-confidence .summary-value {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.confidence-circle {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #9ca3af;
}

.confidence-circle.confidence-green {
  background: #22c55e;
}

.confidence-circle.confidence-yellow {
  background: #eab308;
}

.confidence-circle.confidence-red {
  background: #dc2626;
}

/* Plan card improved */
.plan-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  border-left: 4px solid var(--primary);
  transition: border-color 0.2s;
}

.plan-card:hover {
  border-left-color: var(--accent);
}

.plan-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.plan-icon {
  font-size: 1.5rem;
}

.plan-name {
  font-weight: 600;
  color: var(--text);
}

.plan-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
  font-size: 0.85rem;
}

.plan-actions {
  display: flex;
  gap: 0.5rem;
}

/* Badge variants */
.badge-fertig {
  background: #dcfce7;
  color: #166534;
}

.badge-analyse {
  background: #fef3c7;
  color: #92400e;
}

.badge-fehler {
  background: #fef2f2;
  color: #991b1b;
}

.badge-neu {
  background: #e0e7ff;
  color: #3730a3;
}

/* Confidence display */
.confidence {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.8rem;
}

.confidence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  opacity: 0.3;
}

.confidence-green .dot-green,
.confidence-yellow .dot-yellow,
.confidence-red .dot-red {
  opacity: 1;
}

.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #22c55e; }

.confidence-value {
  margin-left: 4px;
  font-weight: 600;
}

/* Editable cells */
.editable {
  cursor: pointer;
  position: relative;
}

.editable:hover {
  background: #f0f4ff;
}

.cell-input {
  width: 100%;
  padding: 4px 6px;
  border: 2px solid var(--accent);
  border-radius: 4px;
  font-size: inherit;
  font-family: inherit;
  outline: none;
}

.changed {
  background-color: #fff3cd !important;
}

.low-confidence {
  border-left: 3px solid #f59e0b;
}

.learned {
  background-color: #cce5ff !important;
}

@media (max-width: 480px) {
  .summary-row {
    grid-template-columns: 1fr;
  }

  .navbar-company {
    display: none;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* --- Dashboard Stats Row --- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  text-align: center;
  padding: 1.25rem 1rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* --- Recent Activity List --- */
.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.activity-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #eee;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-filename {
  font-weight: 600;
}

.activity-meta {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* --- Agent Connector --- */
.agent-connector {
  width: 40px;
  height: 2px;
  background: #ddd;
  align-self: center;
  flex-shrink: 0;
}

/* --- Agent Row (override for connector layout) --- */
.agent-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

/* --- Table Wrapper --- */
/* (already defined above, kept for reference) */

/* --- Tab Panel --- */
/* (already defined above, kept for reference) */

/* --- Mobile Breakpoints for Stats & Summary --- */
@media (max-width: 768px) {
  .stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .activity-item {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* --- Hero Section (Login-Seite) --- */
.hero-section {
  text-align: center;
  padding: 2rem;
  margin-bottom: 1rem;
}

.hero-title {
  font-size: 1.5rem;
  color: var(--white);
  font-weight: 700;
}

.hero-subtitle {
  color: rgba(255, 255, 255, 0.8);
  max-width: 500px;
  margin: 0.5rem auto;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* --- Feature-Leiste (Login-Seite) --- */
.features-row {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.feature-item {
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
}

.feature-icon {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

/* --- Qualitaetsbericht --- */
.quality-report {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.quality-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.quality-score-big {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
}

.quality-status {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}

.quality-status.akzeptiert {
  background: #dcfce7;
  color: #166534;
}

.quality-status.nachbesserung {
  background: #fef3c7;
  color: #92400e;
}

.quality-status.kritisch {
  background: #fef2f2;
  color: #991b1b;
}

.warning-list,
.recommendation-list {
  list-style: none;
  padding: 0;
}

.warning-item {
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  border-left: 3px solid #f59e0b;
  background: #fffbeb;
  border-radius: 0 4px 4px 0;
  font-size: 0.9rem;
}

.recommendation-item {
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  border-left: 3px solid #3b82f6;
  background: #eff6ff;
  border-radius: 0 4px 4px 0;
  font-size: 0.9rem;
}

/* --- Benachrichtigungs-Toast --- */
.notification-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #22c55e;
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Berechnungs-Modal --- */
.berechnung-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
}

.berechnung-card {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* --- Gewerk-Filter --- */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.filter-btn {
  padding: 0.4rem 1rem;
  border-radius: 20px;
  border: 1px solid #ddd;
  background: white;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  transition: all 0.2s;
}

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

.filter-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* --- Plandetails-Modal --- */
.plan-details-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
}

.plan-details-card {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  max-width: 800px;
  width: 95%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.step-card {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.step-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.step-title {
  font-weight: 700;
  color: var(--primary);
}

.step-time {
  font-size: 0.8rem;
  color: var(--text-light);
}

.step-metrics {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.step-metric {
  font-size: 0.85rem;
}

.step-metric-value {
  font-weight: 700;
}

/* --- Erweiterte Mobile-Anpassungen --- */
@media (max-width: 768px) {
  .summary-row {
    grid-template-columns: 2fr 2fr 1fr;
  }

  .data-table {
    font-size: 0.8rem;
  }

  .filter-btn {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .summary-row {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

  .data-table {
    font-size: 0.8rem;
  }

  .filter-btn {
    font-size: 0.75rem;
  }
}

/* --- Plan Viewer --- */
.plan-viewer { background: white; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); margin-bottom: 2rem; overflow: hidden; }
.plan-viewer.hidden { display: none; }
.plan-viewer-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; border-bottom: 1px solid #eee; }
.plan-viewer-header h3 { margin: 0; font-size: 1.1rem; color: var(--primary); }
.plan-viewer-legend { display: flex; gap: 1.5rem; padding: 0.5rem 1.5rem; background: #f8f9fa; border-bottom: 1px solid #eee; font-size: 0.85rem; }
.legend-item { display: flex; align-items: center; gap: 0.4rem; }
.legend-color { width: 16px; height: 16px; border-radius: 3px; border: 2px solid rgba(0,0,0,0.3); }
.plan-viewer-body { display: flex; min-height: 500px; max-height: 80vh; }
.plan-canvas-container { flex: 1; position: relative; overflow: auto; background: #e5e7eb; padding: 1rem; }
#pdf-canvas, #overlay-canvas { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
#overlay-canvas { pointer-events: auto; cursor: crosshair; }
.plan-sidebar { width: 280px; border-left: 1px solid #eee; overflow-y: auto; padding: 1rem; }
.sidebar-element { padding: 0.5rem; margin-bottom: 0.5rem; border-radius: 6px; border-left: 3px solid; cursor: pointer; font-size: 0.85rem; transition: background 0.15s; }
.sidebar-element:hover { background: #f0f4ff; }
.sidebar-element.raum { border-left-color: #1a3a5c; }
.sidebar-element.fenster { border-left-color: #22c55e; }
.sidebar-element.tuer { border-left-color: #f39301; }
.sidebar-element-name { font-weight: 600; }
.sidebar-element-detail { color: #6b7280; font-size: 0.8rem; }
.element-tooltip { position: fixed; background: white; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.2); padding: 1rem; max-width: 300px; z-index: 100; font-size: 0.85rem; }
.element-tooltip.hidden { display: none; }
.element-tooltip h4 { margin: 0 0 0.5rem; color: var(--primary); }
.element-tooltip .detail-row { display: flex; justify-content: space-between; padding: 0.2rem 0; }
.element-tooltip .detail-label { color: #6b7280; }
.element-tooltip .detail-value { font-weight: 600; }
.plan-viewer-controls { display: flex; gap: 0.5rem; }

@media (max-width: 768px) {
  .plan-viewer-body { flex-direction: column; }
  .plan-sidebar { width: 100%; border-left: none; border-top: 1px solid #eee; max-height: 200px; }
  .plan-viewer-legend { flex-wrap: wrap; gap: 0.75rem; }
}

/* Plan Viewer - Improved */
.sidebar-whg { border-bottom: 1px solid #eee; }
.sidebar-whg-header { padding: 0.6rem 0.75rem; cursor: pointer; background: #f8f9fa; font-size: 0.85rem; display: flex; justify-content: space-between; align-items: center; }
.sidebar-whg-header:hover { background: #e8eef4; }
.sidebar-whg.collapsed .sidebar-whg-body { display: none; }
.sidebar-whg.collapsed .sidebar-whg-header span { transform: rotate(-90deg); }
.sidebar-whg-body { padding: 0.25rem 0; }
.sidebar-element.highlighted { background: #fff3cd !important; border-left-width: 4px !important; }
.sidebar-type-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.confidence-badge { font-size: 0.7rem; padding: 1px 5px; border-radius: 10px; margin-left: 4px; }
.confidence-badge.confidence-green { background: #dcfce7; color: #166534; }
.confidence-badge.confidence-yellow { background: #fef3c7; color: #92400e; }
.confidence-badge.confidence-red { background: #fef2f2; color: #991b1b; }
.sidebar-berechnung { margin-top: 4px; padding: 4px 8px; background: #f8f9fa; border-radius: 4px; font-size: 0.75rem; }
.berechnung-step { color: #4b5563; padding: 1px 0; border-bottom: 1px dotted #e5e7eb; }
.berechnung-step:last-child { border-bottom: none; }
.plan-sidebar { width: 350px; overflow-y: auto; border-left: 1px solid #ddd; max-height: 80vh; }
@media (max-width: 768px) { .plan-sidebar { width: 100%; max-height: 40vh; } .plan-viewer-body { flex-direction: column; } }

/* Plan Viewer v2 - Clean verification */
.pv-whg { border-bottom: 1px solid #eee; }
.pv-whg.collapsed > :not(.pv-whg-head) { display: none; }
.pv-whg-head { padding: 0.5rem 0.75rem; cursor: pointer; background: #f8f9fa; font-size: 0.85rem; font-weight: 600; }
.pv-whg-head:hover { background: #e8eef4; }
.pv-room { padding: 0.4rem 0.75rem; border-left: 3px solid #1a3a5c; margin: 0.25rem 0.5rem; border-radius: 0 4px 4px 0; font-size: 0.82rem; }
.pv-room:hover { background: #f0f4ff; }
.pv-room-name { font-weight: 600; color: #1a3a5c; }
.pv-room-data { display: flex; flex-wrap: wrap; gap: 0.5rem; color: #4b5563; margin-top: 2px; }
.pv-room-data span { white-space: nowrap; }
.pv-missing { color: #dc2626; font-weight: 600; }
.pv-calc { margin-top: 3px; padding: 3px 6px; background: #f0fdf4; border-radius: 3px; font-size: 0.78rem; color: #166534; font-family: monospace; }
.pv-conf { font-size: 0.7rem; padding: 1px 5px; border-radius: 10px; margin-left: 4px; font-weight: normal; }
.pv-conf.green { background: #dcfce7; color: #166534; }
.pv-conf.yellow { background: #fef3c7; color: #92400e; }
.pv-conf.red { background: #fef2f2; color: #991b1b; }

/* --- Trust Tier System (text vs vision-validated vs vision-only) --- */
/* Avoid red/yellow/green to not collide with construction plan color codes */
.trust-bar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 0.65rem 1rem; background: #ffffff; border-bottom: 1px solid #e5e9f0;
  font-size: 0.85rem;
}
.trust-bar.flag-warn { background: #fff7ed; }
.trust-bar.flag-clean { background: #f0fdf4; }
.trust-headline { font-weight: 600; color: #1a3a5c; }
.trust-counter {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer;
  padding: 2px 8px; border-radius: 12px; transition: background 0.15s;
}
.trust-counter:hover { background: #f5f7fa; }
.trust-counter.active { background: #eef2f7; }
.trust-counter.flag-pulse { font-weight: 600; color: #b45309; }
.trust-counter.zero { color: #94a3b8; }

.trust-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  flex-shrink: 0;
}
.trust-dot.text { background: #0f766e; }              /* teal-700 byte-exact */
.trust-dot.matched { background: #1a3a5c; }            /* navy vision+text */
.trust-dot.inferred {
  background: #fff; border: 2px solid #b45309;        /* hollow amber unverified */
  width: 8px; height: 8px;
}
.trust-dot.manual {
  background: #6366f1; position: relative;             /* indigo manual override */
}
.trust-dot.manual::after {
  content: "✎"; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); color: #fff;
  font-size: 7px; line-height: 1; font-weight: 700;
}
.trust-dot.empty { background: #e5e9f0; }

/* Source dot inline next to a value */
.src-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  margin-right: 4px; vertical-align: middle;
}
.src-dot.text { background: #0f766e; }
.src-dot.matched { background: #1a3a5c; }
.src-dot.inferred { background: #fff; border: 1.5px solid #b45309; width: 5px; height: 5px; }
.src-dot.manual { background: #6366f1; position: relative; }
.src-dot.manual::after {
  content: "✎"; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); color: #fff;
  font-size: 5px; line-height: 1; font-weight: 700;
}

/* ÖNORM A 2063 LV-Section in Sidebar */
.pv-lv-section {
  margin-top: 0.5rem; border-top: 2px solid #1a3a5c;
  background: #f8fafc;
}
.pv-lv-section-head {
  padding: 0.6rem 0.75rem; font-size: 0.82rem; font-weight: 600;
  color: #1a3a5c; background: #eef2f7;
  border-bottom: 1px solid #e5e9f0;
}
.pv-lv-pos {
  margin: 0.4rem 0.5rem; padding: 0.6rem 0.75rem;
  border: 1px solid #cbd5e1; border-radius: 6px; background: #fff;
  font-size: 0.82rem;
}
.pv-lv-pos-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.4rem; color: #1a3a5c;
}
.pv-lv-conf {
  font-size: 0.72rem; font-weight: 700; padding: 2px 6px;
  background: #f0fdf4; color: #166534; border-radius: 4px;
}
.pv-lv-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.2rem 0; color: #4b5563;
  font-variant-numeric: tabular-nums;
}
.pv-lv-row strong { color: #1a3a5c; }
.pv-lv-row.pv-lv-vision { color: #6366f1; }
.pv-lv-row.pv-lv-vision strong { color: #6366f1; }

/* ÖNORM-Gewerk-Massenermittlung in der Sidebar */
.pv-gw-section {
  margin-top: 0.5rem; border-top: 3px solid #f39301; background: #fffdfa;
}
.pv-gw-head {
  padding: 0.7rem 0.75rem; font-size: 0.86rem; font-weight: 700;
  color: #1a3a5c; background: #fff4e3; border-bottom: 1px solid #fdba74;
}
.pv-gw-merge-badge {
  display: inline-block; margin-left: 0.4rem; padding: 1px 7px;
  font-size: 0.68rem; font-weight: 600; color: #166534;
  background: #dcfce7; border: 1px solid #86efac; border-radius: 10px;
  white-space: nowrap;
}

/* Projekt-Massen Übersicht auf projekt.html */
.projekt-massen-badge {
  display: inline-block; margin-left: 0.5rem; padding: 2px 8px;
  font-size: 0.72rem; font-weight: 600; color: #166534;
  background: #dcfce7; border: 1px solid #86efac; border-radius: 12px;
  vertical-align: middle;
}
.projekt-massen-info {
  font-size: 0.85rem; color: #555; margin-bottom: 0.7rem;
}
.projekt-massen-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.7rem; margin-bottom: 0.9rem;
}
.projekt-massen-card {
  background: #fff; border: 1px solid #e5e9f0; border-left: 4px solid #f39301;
  border-radius: 6px; padding: 0.7rem 0.85rem;
}
.projekt-massen-card-label {
  font-size: 0.72rem; font-weight: 600; color: #6c757d;
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.3rem;
}
.projekt-massen-card-value {
  font-size: 1.3rem; font-weight: 700; color: #1a3a5c;
  font-variant-numeric: tabular-nums;
}
.projekt-massen-card-unit {
  font-size: 0.85rem; color: #6c757d; margin-left: 0.25rem;
}
.projekt-massen-card-konf {
  font-size: 0.72rem; color: #166534; margin-top: 0.2rem;
}
.projekt-massen-card-konf.warn { color: #92400e; }
.projekt-massen-detail summary {
  cursor: pointer; padding: 0.5rem 0; font-size: 0.85rem; color: #1a3a5c;
  font-weight: 600;
}
.projekt-massen-detail table {
  width: 100%; border-collapse: collapse; font-size: 0.82rem;
}
.projekt-massen-detail th, .projekt-massen-detail td {
  text-align: left; padding: 0.35rem 0.5rem; border-bottom: 1px solid #f1f3f5;
}
.projekt-massen-detail th {
  background: #f8fafc; font-weight: 600; color: #6c757d;
}
.projekt-massen-detail td.num {
  text-align: right; font-variant-numeric: tabular-nums;
}

.projekt-filter-bar {
  display: flex; flex-wrap: wrap; gap: 1rem;
  padding: 0.7rem 0.9rem; background: #f8fafc;
  border: 1px solid #e5e9f0; border-radius: 6px;
  margin-bottom: 0.9rem;
}
.projekt-filter-group { display: flex; flex-direction: column; gap: 0.35rem; }
.projekt-filter-label {
  font-size: 0.72rem; font-weight: 600; color: #6c757d;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.projekt-filter-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.projekt-chip {
  background: #fff; border: 1px solid #e5e9f0; border-radius: 12px;
  padding: 3px 9px; font-size: 0.78rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.3rem;
}
.projekt-chip:has(input:checked) { background: #fff4e3; border-color: #fdba74; color: #9a3412; font-weight: 600; }
.projekt-chip input { margin: 0; cursor: pointer; }
.projekt-filter-baudaten {
  display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: end;
}
.projekt-filter-baudaten label {
  display: flex; flex-direction: column; font-size: 0.72rem; color: #555;
}
.projekt-filter-baudaten input {
  width: 80px; padding: 3px 6px; font-size: 0.82rem;
  border: 1px solid #d1d5db; border-radius: 4px;
}

/* Rohbau-Materialliste */
.materialliste-phase-badge {
  display: inline-block; margin-left: 0.5rem; padding: 2px 8px;
  font-size: 0.7rem; font-weight: 600; color: #9a3412;
  background: #ffedd5; border: 1px solid #fdba74; border-radius: 12px;
  vertical-align: middle;
}
.materialliste-annahmen {
  background: #f8fafc; border: 1px solid #e5e9f0; border-radius: 6px;
  padding: 0.5rem 0.8rem; margin-bottom: 0.7rem;
}
.materialliste-annahmen summary {
  cursor: pointer; font-size: 0.85rem; font-weight: 600; color: #1a3a5c;
  padding: 0.2rem 0;
}
.materialliste-annahmen-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.7rem; margin-top: 0.7rem;
}
.ml-annahme-group {
  background: #fff; border: 1px solid #e5e9f0; border-radius: 5px;
  padding: 0.5rem 0.7rem;
}
.ml-annahme-head {
  font-size: 0.72rem; font-weight: 700; color: #6c757d;
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.4rem;
}
.ml-annahme-group label {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.5rem; font-size: 0.78rem; color: #555; margin-bottom: 0.25rem;
}
.ml-annahme-group input {
  width: 70px; padding: 2px 5px; font-size: 0.8rem;
  border: 1px solid #d1d5db; border-radius: 4px;
}
.materialliste-table-wrap { overflow-x: auto; }
.materialliste-table {
  width: 100%; border-collapse: collapse; font-size: 0.82rem;
}
.materialliste-table th, .materialliste-table td {
  text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid #f1f3f5;
}
.materialliste-table th {
  background: #fff4e3; font-weight: 700; color: #9a3412;
  position: sticky; top: 0;
}
.materialliste-table td.num {
  text-align: right; font-variant-numeric: tabular-nums; font-weight: 600;
}
.materialliste-table tr.bauteil-head td {
  background: #f8fafc; font-weight: 700; color: #1a3a5c;
  border-top: 2px solid #e5e9f0;
}
.materialliste-table td.formel {
  color: #6c757d; font-size: 0.74rem; font-style: italic;
}
.materialliste-konf-badge {
  display: inline-block; padding: 1px 6px; border-radius: 8px;
  font-size: 0.7rem; font-weight: 600;
}
.materialliste-konf-badge.hoch { background: #dcfce7; color: #166534; }
.materialliste-konf-badge.mittel { background: #fef9c3; color: #854d0e; }
.materialliste-konf-badge.niedrig { background: #fee2e2; color: #991b1b; }

/* Plans-Count-Badge im Section-Titel */
.plans-count-badge {
  display: inline-block; margin-left: 0.4rem; padding: 2px 9px;
  font-size: 0.72rem; font-weight: 600; border-radius: 12px;
  vertical-align: middle;
}
.plans-count-badge.ok { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.plans-count-badge.work { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }

/* Ergebnis-Section: Filter-Drawer + Tabs */
.ergebnis-filter {
  background: #f8fafc; border: 1px solid #e5e9f0; border-radius: 6px;
  padding: 0; margin-bottom: 0.9rem;
}
.ergebnis-filter > summary {
  cursor: pointer; padding: 0.6rem 0.9rem;
  font-size: 0.85rem; font-weight: 600; color: #1a3a5c;
  list-style: none;
}
.ergebnis-filter > summary::before {
  content: "▸"; display: inline-block; margin-right: 0.4rem;
  transition: transform 0.15s ease;
}
.ergebnis-filter[open] > summary::before { transform: rotate(90deg); }
.ergebnis-filter-body {
  display: flex; flex-direction: column; gap: 0.8rem;
  padding: 0.7rem 0.9rem 0.9rem;
  border-top: 1px solid #e5e9f0;
}
.ergebnis-tabs {
  display: flex; gap: 0.3rem; margin-bottom: 0.9rem;
  border-bottom: 2px solid #e5e9f0;
}
.ergebnis-tab {
  background: none; border: none; cursor: pointer;
  padding: 0.55rem 1.1rem; font-size: 0.92rem; font-weight: 600;
  color: #6c757d; border-bottom: 3px solid transparent;
  margin-bottom: -2px; transition: all 0.15s ease;
}
.ergebnis-tab:hover { color: #1a3a5c; }
.ergebnis-tab.active {
  color: #1a3a5c; border-bottom-color: #f39301;
}
.ergebnis-panel { display: none; }
.ergebnis-panel.active { display: block; }

/* Status-Banner: was die App weiß / nicht weiß */
.ergebnis-status-banner {
  display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.9rem;
}
.ergebnis-status-banner > div {
  padding: 0.5rem 0.8rem; border-radius: 6px; font-size: 0.82rem;
  border: 1px solid; flex: 1 1 220px;
}
.ergebnis-status-banner .status-ok {
  background: #dcfce7; border-color: #86efac; color: #166534;
}
.ergebnis-status-banner .status-warn {
  background: #fef3c7; border-color: #fcd34d; color: #92400e;
}
.ergebnis-status-banner .status-info {
  background: #e0f2fe; border-color: #7dd3fc; color: #075985;
}
.ergebnis-status-banner .status-room-count {
  background: #f1f5f9; border-color: #cbd5e1; color: #334155;
}

/* Materialliste: Konfidenz-Erklärung */
.materialliste-konfidenz-hint {
  background: #fff7ed; border: 1px solid #fdba74; border-radius: 6px;
  padding: 0.7rem 0.9rem; margin-bottom: 0.9rem; font-size: 0.82rem;
  color: #555;
}
.materialliste-konfidenz-hint ul {
  margin: 0.4rem 0; padding-left: 1.4rem;
}
.materialliste-konfidenz-hint li { margin-bottom: 0.15rem; }
.pv-gw-baudaten {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  padding: 0.5rem 0.75rem; background: #f8fafc; font-size: 0.72rem;
  border-bottom: 1px solid #e5e9f0;
}
.pv-gw-bd-item {
  background: #fff; border: 1px solid #e5e9f0; border-radius: 4px;
  padding: 2px 6px; color: #6c757d; white-space: nowrap;
}
.pv-gw-bd-item strong { color: #1a3a5c; }
.pv-gw-tabs {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  padding: 0.55rem 0.75rem; background: #f8fafc;
  border-bottom: 1px solid #e5e9f0;
}
.pv-gw-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.76rem; padding: 3px 9px; border-radius: 14px;
  border: 1px solid #cbd5e1; background: #fff; color: #6c757d;
  cursor: pointer; user-select: none;
}
.pv-gw-chip.active { background: #1a3a5c; color: #fff; border-color: #1a3a5c; }
.pv-gw-chip input { margin: 0; cursor: pointer; }
.pv-gw-block { margin: 0.4rem 0.5rem; }
.pv-gw-block-head {
  font-size: 0.8rem; font-weight: 700; color: #9a3412;
  padding: 0.35rem 0.25rem;
}
.pv-gw-pos {
  border: 1px solid #e5e9f0; border-radius: 6px; background: #fff;
  margin-bottom: 0.35rem;
}
.pv-gw-pos > summary {
  display: flex; align-items: center; gap: 0.4rem; cursor: pointer;
  padding: 0.5rem 0.6rem; font-size: 0.8rem; list-style: none;
}
.pv-gw-pos > summary::-webkit-details-marker { display: none; }
.pv-gw-pos-nr { font-weight: 700; color: #6c757d; font-size: 0.74rem; }
.pv-gw-pos-txt { flex: 1; color: #1a3a5c; }
.pv-gw-pos-sum {
  font-weight: 700; color: #1a3a5c; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pv-gw-konf {
  font-size: 0.68rem; font-weight: 700; padding: 1px 5px; border-radius: 4px;
}
.pv-gw-konf.hoch { background: #dcfce7; color: #166534; }
.pv-gw-konf.mittel { background: #fef3c7; color: #92400e; }
.pv-gw-konf.niedrig { background: #fee2e2; color: #991b1b; }
.pv-gw-detail {
  padding: 0.35rem 0.6rem 0.55rem; border-top: 1px dashed #e5e9f0;
  background: #fafbfc;
}
.pv-gw-quelle {
  font-size: 0.7rem; color: #6c757d; font-style: italic;
  margin-bottom: 0.3rem;
}
.pv-gw-zeile {
  display: flex; gap: 0.5rem; font-size: 0.74rem; padding: 1px 0;
  color: #4b5563; font-variant-numeric: tabular-nums;
}
.pv-gw-zeile > span:first-child { flex: 1; }
.pv-gw-zeile-dim { color: #94a3b8; white-space: nowrap; }
.pv-gw-zeile-wert {
  font-weight: 600; color: #1a3a5c; white-space: nowrap; min-width: 56px;
  text-align: right;
}

/* Klickbare Plan-Karten (done = fertig) */
.plan-card-clickable {
  cursor: pointer; transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  border: 1px solid transparent;
}
.plan-card-clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(26, 58, 92, 0.12);
  border-color: rgba(26, 58, 92, 0.2);
}

/* Details-Toggle für Detail-Tabellen (collapsable) */
.results-details summary { list-style: none; }
.results-details summary::-webkit-details-marker { display: none; }
.results-details summary::before {
  content: "▸ "; color: #6c757d; font-weight: 400;
  transition: transform 0.2s;
}
.results-details[open] summary::before { content: "▾ "; }

/* Room card v2 (replaces pv-room when source info exists) */
.pv-room-v2 {
  margin: 0.4rem 0.5rem; padding: 0.6rem 0.75rem;
  border: 1px solid #e5e9f0; border-radius: 8px; background: #fff;
  font-size: 0.83rem; cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.pv-room-v2:hover { background: #f5f7fa; border-color: #cbd5e1; }
.pv-room-v2.active { background: #f8fafc; border-left: 2px solid #1a3a5c; }
.pv-room-v2-head {
  display: flex; align-items: center; gap: 0.5rem; margin-bottom: 4px;
}
.pv-room-v2-name {
  font-weight: 600; color: #1a3a5c; font-size: 0.92rem;
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv-room-v2-top {
  font-size: 0.7rem; padding: 1px 7px; border-radius: 10px;
  background: #eef2f7; color: #6b7280; text-transform: uppercase;
  letter-spacing: 0.04em; font-weight: 600;
}
.pv-room-v2-kpis {
  display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px;
}
.kpi-chip {
  display: inline-flex; align-items: center; gap: 3px;
  font-variant-numeric: tabular-nums; font-size: 0.78rem;
  padding: 2px 7px; border-radius: 5px; background: #f5f7fa; color: #1a3a5c;
}
.kpi-chip .kpi-label { color: #6b7280; font-weight: 500; margin-right: 1px; }
.kpi-chip .kpi-val { font-weight: 600; }
.kpi-chip.empty { background: transparent; border: 1px dashed #e5e9f0; color: #cbd5e1; }
.pv-room-v2-bod {
  font-size: 0.74rem; color: #6b7280; display: flex; align-items: center; gap: 4px;
}

/* Filter strip in sidebar */
.pv-filter-strip {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: 4px; padding: 0.5rem 0.75rem;
  background: #f8fafc; border-bottom: 1px solid #e5e9f0;
}
.pv-filter-pill {
  flex: 1; text-align: center; font-size: 0.74rem; padding: 4px 6px;
  border-radius: 5px; cursor: pointer; color: #6b7280;
  background: #fff; border: 1px solid #e5e9f0;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.pv-filter-pill.active { background: #1a3a5c; color: #fff; border-color: #1a3a5c; }
.pv-filter-pill .filter-count { font-weight: 600; opacity: 0.8; }

/* Sort/Filter dropdown row */
.pv-filter-controls {
  display: flex; gap: 6px; padding: 0.5rem 0.75rem;
  background: #fff; border-bottom: 1px solid #e5e9f0;
  flex-wrap: wrap;
}
.pv-filter-controls select {
  flex: 1; min-width: 0; font-size: 0.74rem; padding: 4px 6px;
  border: 1px solid #e5e9f0; border-radius: 5px; background: #fff;
  color: #1a3a5c;
}

/* Detail drawer */
.pv-drawer-backdrop {
  position: fixed; inset: 0; background: transparent; z-index: 1000;
  pointer-events: none;
}
.pv-drawer {
  position: fixed; top: 0; right: -460px; width: 440px; height: 100vh;
  background: #fff; box-shadow: -8px 0 24px rgba(0,0,0,0.12);
  z-index: 1001; transition: right 0.28s ease-out;
  display: flex; flex-direction: column;
}
.pv-drawer.open { right: 0; }
.pv-drawer-header {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid #e5e9f0;
}
.pv-drawer-title { font-size: 1.05rem; font-weight: 600; color: #1a3a5c; flex: 1; }
.pv-drawer-close {
  border: none; background: transparent; font-size: 1.4rem; cursor: pointer;
  color: #6b7280; padding: 0 6px;
}
.pv-drawer-close:hover { color: #1a3a5c; }
.pv-drawer-body { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; }
.pv-drawer-source-row {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.85rem; color: #6b7280;
  padding: 0.6rem 0.85rem; background: #f5f7fa;
  border-radius: 6px; margin-bottom: 1rem;
}
.pv-drawer-field {
  margin-bottom: 0.85rem;
}
.pv-drawer-field-label {
  font-size: 0.78rem; color: #6b7280; font-weight: 600;
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 5px;
}
.pv-drawer-field input,
.pv-drawer-field select {
  width: 100%; padding: 8px 10px; font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  border: 1px solid #e5e9f0; border-radius: 6px; color: #1a3a5c;
  background: #fff; transition: border-color 0.15s;
}
.pv-drawer-field input:focus,
.pv-drawer-field select:focus {
  outline: none; border-color: #1a3a5c;
}
.pv-drawer-field input.changed {
  border-color: #f39301; background: #fff7ed;
}
.pv-drawer-actions {
  display: flex; gap: 0.5rem; padding: 1rem 1.25rem;
  border-top: 1px solid #e5e9f0;
}
.pv-drawer-actions .btn { flex: 1; }
.btn-danger {
  background: transparent; border: 1px solid #fecaca; color: #b91c1c;
}
.btn-danger:hover { background: #fee2e2; }

/* Empty state */
.pv-empty-state {
  text-align: center; padding: 3rem 1.5rem; color: #6b7280;
}
.pv-empty-state-icon {
  width: 56px; height: 56px; margin: 0 auto 1rem;
  border-radius: 50%; background: #f5f7fa;
  display: flex; align-items: center; justify-content: center;
  color: #cbd5e1; font-size: 28px;
}
.pv-empty-state h4 { margin: 0 0 0.5rem; color: #1a3a5c; font-size: 1rem; }
.pv-empty-state p { margin: 0 0 1rem; font-size: 0.85rem; line-height: 1.5; }

/* Trust-bar action buttons */
.trust-bar-actions {
  margin-left: auto; display: flex; gap: 6px;
}
.trust-bar-actions .btn {
  font-size: 0.78rem; padding: 4px 12px;
}

/* Per-value source dot inside KPI chip */
.kpi-chip .kpi-src {
  display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  margin-right: 3px; vertical-align: middle;
}
.kpi-chip .kpi-src.text { background: #0f766e; }
.kpi-chip .kpi-src.matched { background: #1a3a5c; }
.kpi-chip .kpi-src.inferred { background: #fff; border: 1.5px solid #b45309; width: 4px; height: 4px; }
.kpi-chip .kpi-src.manual { background: #6366f1; }
.plan-canvas-container { flex: 1; overflow: auto; background: #e5e7eb; cursor: grab; position: relative; }
.plan-canvas-container:active { cursor: grabbing; }
#pv-pdf-canvas { display: block; margin: 1rem auto; box-shadow: 0 2px 10px rgba(0,0,0,0.2); }

/* --- Inline Edit Row --- */
.edit-row { background: #f0f4ff; padding: 0.5rem; }
.edit-input { border: 1px solid #1a3a5c; border-radius: 4px; padding: 4px 8px; font-size: 0.85rem; width: auto; }
.edit-actions { display: flex; gap: 0.5rem; margin-top: 0.25rem; }
.btn-icon { width: 28px; height: 28px; border-radius: 50%; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; background: transparent; }
.btn-icon:hover { background: #e8eef4; }
.recalc-btn { margin-bottom: 1rem; }
.summary-total-row { font-weight: 700; background: #f0f4ff; border-top: 2px solid #1a3a5c; }

/* --- Summary Card --- */
.summary-card { background: var(--white); border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow); }
.summary-card h3 { margin: 0 0 1rem; color: var(--primary); font-size: 1.1rem; }
.summary-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.summary-table th { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 2px solid var(--primary); color: var(--primary); font-weight: 600; }
.summary-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }
.summary-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.summary-confidence { display: inline-flex; align-items: center; gap: 0.4rem; }
.summary-confidence-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.summary-confidence-dot.green { background: var(--green); }
.summary-confidence-dot.yellow { background: var(--yellow); }
.summary-confidence-dot.red { background: var(--red); }

/* --- Trust Banner (Login) --- */
.trust-banner { text-align: center; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.trust-banner p { font-size: 0.85rem; color: var(--text-light); letter-spacing: 0.02em; }

/* ============================================================
   ERGEBNIS V2 — aufgeräumte Material-Ansicht (Hero · Facts · Board)
   Ziel: ein Blick, ein Vertrauenswert, die Material-Liste als Herzstück.
   ============================================================ */

/* HERO ------------------------------------------------------- */
.result-hero {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap;
  background:
    radial-gradient(140% 120% at 100% 0%, rgba(239, 125, 18, 0.18) 0%, rgba(239, 125, 18, 0) 55%),
    linear-gradient(135deg, var(--primary-dark), var(--primary-light));
  color: #fff; border-radius: var(--radius-lg);
  padding: 1.6rem 1.8rem; margin-bottom: 1.25rem;
  box-shadow: var(--shadow-lg);
}
.result-hero-text { min-width: 0; }
.result-hero-kicker {
  font-size: 0.76rem; letter-spacing: 0.07em; text-transform: uppercase;
  opacity: 0.85; margin-bottom: 0.2rem;
}
.result-hero-title { font-size: 1.5rem; margin: 0; font-weight: 700; line-height: 1.15; color: #fff; }
.result-hero-sub { font-size: 0.86rem; opacity: 0.92; margin-top: 0.4rem; }
.result-hero-side { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.result-hero-side .btn-export { white-space: nowrap; }

/* TRUST RING — Anteil verlässlicher Positionen als Donut ------ */
.trust-ring {
  --ring-pct: 0; --ring-color: #f39301;
  width: 82px; height: 82px; border-radius: 50%; flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative;
  background: conic-gradient(var(--ring-color) calc(var(--ring-pct) * 1%), rgba(255,255,255,0.18) 0);
}
.trust-ring::before {
  content: ""; position: absolute; inset: 7px; border-radius: 50%;
  background: var(--primary-dark);
}
.trust-ring.high { --ring-color: #34d399; }
.trust-ring.mid  { --ring-color: #fbbf24; }
.trust-ring.low  { --ring-color: #f87171; }
.trust-ring-num { position: relative; font-size: 1.18rem; font-weight: 700; color: #fff; }
.trust-ring-cap { position: relative; font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.85; color: #fff; }

/* FACT-STRIP — was byte-exakt aus dem Plan gelesen wurde ------ */
.fact-strip { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.1rem; }
.fact {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--white); border: 1px solid var(--border); border-radius: 999px;
  padding: 0.32rem 0.75rem; font-size: 0.8rem; box-shadow: var(--shadow);
}
.fact-ico { font-size: 0.92rem; line-height: 1; }
.fact-k { color: var(--text-light); }
.fact-v { font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
.fact-src { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.03em; padding: 1px 6px; border-radius: 999px; }
.fact-src.read { background: #ccfbf1; color: #0f766e; }
.fact-src.measured { background: #dbeafe; color: #1e40af; }
.fact-src.assumed { background: #f1f5f9; color: #64748b; }

/* MATERIAL-BOARD --------------------------------------------- */
.ml-board-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  flex-wrap: wrap; margin-bottom: 0.6rem;
}
.ml-board-title { font-size: 1.05rem; font-weight: 700; color: var(--primary); }
.ml-formel-toggle {
  font-size: 0.8rem; color: var(--text-light);
  display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer;
}
.ml-board {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0.9rem;
}
.ml-empty {
  grid-column: 1 / -1; padding: 2rem; text-align: center; color: var(--text-light);
  background: var(--white); border: 1px dashed var(--border); border-radius: var(--radius);
}
.ml-group {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm); align-self: start;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.ml-group:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.ml-group-head {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.7rem 0.95rem; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.ml-group-ico { font-size: 1.1rem; line-height: 1; }
.ml-group-name { font-weight: 700; color: var(--primary); flex: 1; }
.ml-group-meta { font-size: 0.72rem; color: var(--text-light); }
.ml-rows { padding: 0.15rem 0; }
.ml-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.55rem;
  padding: 0.42rem 0.9rem; border-bottom: 1px solid #f1f3f5;
}
.ml-row:last-child { border-bottom: none; }
.ml-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.ml-dot.hoch { background: #16a34a; }
.ml-dot.mittel { background: #f59e0b; }
.ml-dot.niedrig { background: #ef4444; }
.ml-mat { color: var(--text); font-size: 0.86rem; min-width: 0; }
.ml-formel { display: block; font-size: 0.72rem; color: var(--text-light); margin-top: 2px; }
.ml-qty { font-weight: 700; color: var(--primary); white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; }
.ml-qty em { font-style: normal; font-weight: 500; color: var(--text-light); font-size: 0.8rem; margin-left: 2px; }

/* ERWEITERT-DRAWER — alles Optionale gebündelt ---------------- */
.advanced-drawer {
  margin-top: 1.5rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--white);
}
.advanced-drawer > summary {
  cursor: pointer; padding: 0.8rem 1rem; font-weight: 600; color: var(--text-light); list-style: none;
}
.advanced-drawer > summary::-webkit-details-marker { display: none; }
.advanced-drawer > summary::before {
  content: "\25B8"; display: inline-block; margin-right: 0.5rem; transition: transform var(--transition);
}
.advanced-drawer[open] > summary::before { transform: rotate(90deg); }
.advanced-body { padding: 0.25rem 1rem 1.2rem; border-top: 1px solid var(--border); }
.advanced-block { margin-top: 1.1rem; }
.advanced-h { font-size: 0.92rem; color: var(--primary); margin-bottom: 0.5rem; }

@media (max-width: 640px) {
  .result-hero { padding: 1.1rem 1.2rem; }
  .result-hero-title { font-size: 1.25rem; }
  .ml-board { grid-template-columns: 1fr; }
}

/* Gelesene Elemente — Untertitel je Tabelle (Räume/Fenster/Türen) */
.read-sub {
  font-size: 0.8rem; font-weight: 700; color: var(--primary);
  margin: 0.9rem 0 0.3rem;
}
.read-sub:first-child { margin-top: 0; }

/* Doppelcheck: von zwei unabhängigen Quellen bestätigt */
.fact-confirm {
  margin-left: 4px; color: #15803d; font-weight: 700; font-size: 0.72rem;
  letter-spacing: -1px;
}

/* GEOMETRIE-KASTEN — kritische Maße mit Sicherungs-Flag (Dashboard) */
.geo-box {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 0.6rem; margin-bottom: 1.1rem;
}
.geo-tile {
  background: var(--white); border: 1px solid var(--border); border-left: 4px solid var(--border);
  border-radius: var(--radius); padding: 0.55rem 0.8rem; box-shadow: var(--shadow);
}
.geo-tile.ok2 { border-left-color: #16a34a; }
.geo-tile.ok  { border-left-color: #65a30d; }
.geo-tile.warn { border-left-color: #f39301; background: #fffaf0; }
.geo-tile.grey { border-left-color: #cbd5e1; }
.geo-tile-head { display: flex; align-items: center; gap: 0.35rem; font-size: 0.76rem; color: var(--text-light); }
.geo-label { flex: 1; }
.geo-ico { font-size: 0.92rem; line-height: 1; }
.geo-flag { font-weight: 700; color: #15803d; letter-spacing: -1px; }
.geo-tile.warn .geo-flag { color: #b45309; }
.geo-tile.grey .geo-flag { color: #94a3b8; }
.geo-val { font-size: 1.25rem; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; margin: 0.1rem 0; }
.geo-note { font-size: 0.71rem; color: var(--text-light); line-height: 1.25; }

/* HERO-Status (3-Stufen-Bau-Signal) auf dem navy Hero */
.result-hero-title.st-green { color: #bbf7d0; }
.result-hero-title.st-yellow { color: #fde68a; }
.result-hero-title.st-red { color: #fecaca; }

/* Material-Board: Konfidenz-Legende + Tier-Rand oben */
.ml-legende {
  grid-column: 1 / -1; font-size: 0.76rem; color: var(--text-light);
  display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; margin-bottom: 0.1rem;
}
.ml-legende .ml-dot { display: inline-block; }
.ml-group.tier-hoch { border-top: 3px solid #16a34a; }
.ml-group.tier-mittel { border-top: 3px solid #f59e0b; }
.ml-group.tier-niedrig { border-top: 3px solid #ef4444; }

/* ── Selbst-Kalibrierung (Moat) ───────────────────────────────────────── */
.kalib-status { margin: .25rem 0 .5rem; }
.kalib-badge { display: inline-block; padding: .25rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.kalib-badge.kalib-on { background: #dcfce7; color: #166534; }
.kalib-badge.kalib-off { background: #f1f5f9; color: #64748b; }
.kalib-hint { font-size: .78rem; color: #64748b; line-height: 1.45; margin: .3rem 0 .5rem; }
.kalib-textarea { width: 100%; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .8rem;
  border: 1px solid #cbd5e1; border-radius: 8px; padding: .55rem .7rem; resize: vertical; }
.kalib-textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.kalib-result { margin-top: .6rem; }
.kalib-table { width: 100%; border-collapse: collapse; margin-top: .45rem; font-size: .8rem; }
.kalib-table th, .kalib-table td { text-align: left; padding: .3rem .5rem; border-bottom: 1px solid #eef2f7; }
.kalib-table th { color: #64748b; font-weight: 600; }
.kalib-table td:nth-child(n+2), .kalib-table th:nth-child(n+2) { text-align: right; }

/* ── Referenz-Upload CTA (prominent) + "merken" ───────────────────────── */
.referenz-cta { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap; margin: 1rem 0; padding: 1rem 1.25rem; border-radius: 12px;
  background: linear-gradient(135deg, #eff6ff, #f0fdf4); border: 1px solid #bfdbfe; }
.referenz-cta-text { display: flex; flex-direction: column; gap: .15rem; }
.referenz-cta-text strong { font-size: .95rem; color: #1e3a8a; }
.referenz-cta-text span { font-size: .8rem; color: #475569; }
.referenz-cta .btn { white-space: nowrap; }
.ml-merken-label { font-size: .8rem; color: #334155; display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; }
.ml-merken-status { font-size: .78rem; color: #16a34a; }
.dashboard-tipp { margin: 0 0 1.25rem; padding: .7rem 1rem; border-radius: 10px; font-size: .82rem;
  color: #475569; background: #f8fafc; border: 1px solid #e2e8f0; line-height: 1.5; }

/* ── Warte-Hinweis (Ergebnis erst wenn alle Pläne fertig) ─────────────── */
.ergebnis-warte { display: flex; align-items: center; gap: .6rem; margin: 1.25rem 0;
  padding: 1rem 1.25rem; border-radius: 12px; font-size: .9rem; color: #475569;
  background: #f8fafc; border: 1px solid #e2e8f0; }
.ergebnis-warte .spinner { flex: none; }
.export-group { display: flex; flex-direction: column; gap: .35rem; align-items: stretch; }
.export-group .btn-sm { font-size: .74rem; padding: .3rem .5rem; }

/* ===== Dedizierter Kalibrierungs-Bereich ===== */
.kalib-page { max-width: 880px; }
.kalib-sub { font-size: .9rem; color: var(--text-light); line-height: 1.5; margin: .35rem 0 0; max-width: 64ch; }
.kalib-card { margin-bottom: 1.25rem; }
.kalib-card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.kalib-card-head .section-title { margin: 0; }
.kalib-empty { font-size: .85rem; color: var(--text-light); line-height: 1.5; margin: .2rem 0; }
.kalib-opt { font-weight: 400; color: var(--text-faint); font-size: .8rem; }

/* Lernstand */
.kalib-stand-block { margin-bottom: .9rem; }
.kalib-stand-titel { font-size: .8rem; font-weight: 600; color: var(--text); margin-bottom: .4rem; }
.kalib-chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.kalib-chip { display: inline-flex; align-items: center; background: var(--accent-soft); color: var(--accent-hover);
  border: 1px solid #f6d9b8; border-radius: 999px; padding: .22rem .6rem; font-size: .78rem; font-weight: 600; }
.kalib-chip-label { font-size: .76rem; color: var(--text-light); margin-left: .3rem; }
.kalib-chip-label:first-child { margin-left: 0; }
.kalib-foot { margin-top: .8rem; padding-top: .7rem; border-top: 1px solid var(--border);
  font-size: .76rem; color: var(--text-light); line-height: 1.45; }

/* Formular */
.kalib-form .form-group { margin-bottom: 1rem; }
.kalib-form label { display: block; font-size: .82rem; font-weight: 600; color: var(--text); margin-bottom: .35rem; }
.kalib-or { text-align: center; font-size: .74rem; color: var(--text-faint); margin: .45rem 0; }
.kalib-progress { display: flex; align-items: center; gap: .55rem; margin-top: .8rem;
  font-size: .85rem; color: var(--primary-light); font-weight: 500; }
.kalib-result-ok { margin-top: .8rem; padding: .7rem .9rem; border-radius: var(--radius); line-height: 1.5;
  background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; font-size: .84rem; }
.kalib-result-err { margin-top: .8rem; padding: .7rem .9rem; border-radius: var(--radius); line-height: 1.5;
  background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; font-size: .84rem; }

/* Referenzliste */
.kalib-ref-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem .1rem; border-bottom: 1px solid var(--border); }
.kalib-ref-row:last-child { border-bottom: none; }
.kalib-ref-titel { font-size: .9rem; font-weight: 600; color: var(--text); }
.kalib-ref-meta { font-size: .77rem; color: var(--text-light); margin-top: .15rem; }
.kalib-ref-del { position: static; flex-shrink: 0; }

/* ===== Kennzahlen-Block (immer sichtbar am Ende der Auswertung) ===== */
.auswertung-kennzahlen { margin: 1.4rem 0 0.5rem; }
.kz-title { font-size: .82rem; font-weight: 700; color: var(--text); letter-spacing: .01em;
  text-transform: uppercase; margin-bottom: .6rem; }
.kz-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; }
.kz-tile { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .8rem .9rem; }
.kz-head { display: flex; align-items: center; gap: .4rem; margin-bottom: .35rem; }
.kz-ico { font-size: 1rem; }
.kz-label { font-size: .76rem; color: var(--text-light); font-weight: 600; }
.kz-val { font-size: 1.4rem; font-weight: 700; color: var(--primary); line-height: 1.1; }
.kz-sub { font-size: .72rem; color: var(--text-faint); margin-top: .2rem; }

/* ===== Projekt-Chatbot (read-only Erklärschicht) ===== */
.projekt-chat { margin: 1.4rem 0 0.5rem; padding: 1.1rem 1.2rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.chat-head { font-size: 1rem; font-weight: 700; color: var(--primary); }
.chat-sub { font-size: .8rem; color: var(--text-light); line-height: 1.45; margin: .25rem 0 .8rem; }
.chat-log { display: flex; flex-direction: column; gap: .55rem; max-height: 360px; overflow-y: auto;
  margin-bottom: .7rem; }
.chat-log:empty { margin-bottom: 0; }
.chat-msg { max-width: 85%; padding: .6rem .85rem; border-radius: 14px; font-size: .86rem; line-height: 1.5;
  white-space: normal; word-wrap: break-word; }
.chat-user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-assistant { align-self: flex-start; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-pending { color: var(--text-faint); }
.chat-suggest { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .7rem; }
.chat-chip { background: var(--accent-soft); color: var(--accent-hover); border: 1px solid #f6d9b8;
  border-radius: 999px; padding: .3rem .7rem; font-size: .78rem; font-weight: 600; cursor: pointer; }
.chat-chip:hover { background: #fde7cc; }
.chat-input-row { display: flex; gap: .5rem; }
.chat-input-row .form-control { flex: 1; }

/* ===== Prüf-Liste (wo der Polier nachschauen sollte) ===== */
.pruefliste { margin: 1.2rem 0 0.5rem; }
.pruefliste:empty { margin: 0; }
.pl-title { font-size: .82rem; font-weight: 700; color: var(--text); text-transform: uppercase;
  letter-spacing: .01em; margin-bottom: .5rem; display: flex; align-items: center; gap: .5rem; }
.pl-count { background: var(--accent); color: #fff; border-radius: 999px; font-size: .72rem;
  padding: .05rem .5rem; font-weight: 700; }
.pl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.pl-row { display: flex; gap: .55rem; align-items: flex-start; padding: .55rem .7rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
  font-size: .83rem; line-height: 1.45; }
.pl-row.pl-hoch { border-left: 3px solid #dc2626; }
.pl-row.pl-mittel { border-left: 3px solid var(--accent); }
.pl-row.pl-niedrig { border-left: 3px solid var(--border-strong); }
.pl-ico { flex-shrink: 0; font-size: .7rem; margin-top: .15rem; }
.pl-body strong { color: var(--text); }
.pl-more { font-size: .76rem; color: var(--text-light); margin-top: .4rem; }

/* ===== Gemessene Genauigkeit (Kalibrierungs-Seite) ===== */
.kalib-gen { margin-bottom: 1.2rem; padding: .9rem 1rem; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius); }
.kalib-gen-head { display: flex; align-items: center; justify-content: space-between;
  font-size: .82rem; font-weight: 700; color: var(--text); }
.kalib-gen-big { font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.kalib-gen-sub { font-size: .76rem; color: var(--text-light); margin: .25rem 0 .7rem; line-height: 1.45; }
.gen-row { display: flex; align-items: center; gap: .6rem; margin-bottom: .4rem; }
.gen-label { flex: 0 0 38%; font-size: .78rem; color: var(--text); }
.gen-bar { flex: 1; height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.gen-fill { display: block; height: 100%; border-radius: 999px; }
.gen-fill.gen-ok { background: #16a34a; }
.gen-fill.gen-mid { background: var(--accent); }
.gen-fill.gen-low { background: #dc2626; }
.gen-pct { flex: 0 0 3rem; text-align: right; font-size: .78rem; font-weight: 700; color: var(--text); }

/* ===== Herkunfts-Ledger (woher kommen die Zahlen) ===== */
.hk-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.hk-table td { padding: .45rem .5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.hk-table tr:last-child td { border-bottom: none; }
.hk-g { color: var(--text-light); }
.hk-v { font-weight: 700; color: var(--text); white-space: nowrap; }
.hk-q { color: var(--text-light); font-size: .78rem; }
.hk-kc { text-align: right; white-space: nowrap; }
.hk-k { font-size: .74rem; font-weight: 700; padding: .12rem .45rem; border-radius: 999px; }
.hk-k.hk-ok { background: #ecfdf5; color: #047857; }
.hk-k.hk-mid { background: var(--accent-soft); color: var(--accent-hover); }
.hk-k.hk-low { background: #fef2f2; color: #b91c1c; }

/* ===== Entschlackte Auswertung: Material-Board Tools + Abdeckung ===== */
.ml-board-tools { display: flex; gap: .9rem; align-items: center; }
.ml-tool { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; color: var(--text-light); cursor: pointer; }
/* Tier-Rand je Bauteil-Gruppe: sofort-bestellbar (grün) vs am-Bau-klären (grau) */
.ml-group { border-top: 3px solid var(--border-strong); }
.ml-group.tier-hoch { border-top-color: #16a34a; }
.ml-group.tier-mittel { border-top-color: var(--accent); }
.ml-group.tier-niedrig { border-top-color: var(--border-strong); }
.ml-group-head { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.ml-group-name { font-weight: 700; }
.ml-cover { flex: 0 0 84px; height: 7px; border-radius: 999px; overflow: hidden; display: inline-flex;
  background: var(--border); }
.ml-cover-seg { display: block; height: 100%; }
.ml-cover-seg.hoch { background: #16a34a; }
.ml-cover-seg.mittel { background: var(--accent); }
.ml-cover-seg.niedrig { background: var(--border-strong); }
.ml-group-meta { font-size: .74rem; color: var(--text-light); margin-left: auto; }
.ml-copy { background: none; border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
  font-size: .85rem; color: var(--text-light); padding: .1rem .4rem; line-height: 1; }
.ml-copy:hover { background: var(--surface-2); color: var(--primary); }
.ml-row-empty { color: var(--text-faint); font-size: .8rem; font-style: italic; padding: .3rem .2rem; }

/* Einklappbare Reste (Prüf-Liste + Status-Banner) */
.pl-rest > summary, .status-rest > summary { cursor: pointer; font-size: .8rem; color: var(--text-light);
  padding: .35rem 0; list-style: none; font-weight: 600; }
.pl-rest > summary::before, .status-rest > summary::before { content: '▸ '; }
.pl-rest[open] > summary::before, .status-rest[open] > summary::before { content: '▾ '; }
.status-rest { margin-top: .4rem; border-top: 1px dashed var(--border); padding-top: .3rem; }

/* ===== Kalibrierung kinderleicht ===== */
.kalib-steps { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.kalib-step { flex: 1; min-width: 160px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .6rem .8rem; font-size: .82rem; color: var(--text);
  display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.kalib-step-n { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 999px; background: var(--accent); color: #fff; font-weight: 800; font-size: .8rem; flex-shrink: 0; }
.kalib-step-dot { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
  border-radius: 999px; background: var(--primary); color: #fff; font-weight: 700; font-size: .72rem; margin-right: .35rem; }
.kalib-add { border: 2px solid var(--accent-soft); }
.btn-lg { padding: .7rem 1.4rem; font-size: .95rem; font-weight: 700; }

/* ── ÖNORM-LV Buchform (prüfbare Massenermittlung — Phase 3) ── */
.lv-gewerk { margin-bottom: 1.1rem; }
.lv-gewerk-titel { font-weight: 700; font-size: .95rem; color: #1a3a5c;
  border-bottom: 2px solid #e2e8f0; padding-bottom: .3rem; margin-bottom: .5rem; }
.lv-pos { padding: .45rem 0; border-bottom: 1px solid #f1f5f9; }
.lv-pos-kopf { display: flex; align-items: baseline; gap: .6rem; }
.lv-pos-nr { font-variant-numeric: tabular-nums; color: #64748b; font-size: .82rem; min-width: 2.2rem; }
.lv-pos-text { flex: 1; font-size: .9rem; color: #1e293b; }
.lv-pos-summe { font-weight: 700; font-variant-numeric: tabular-nums; color: #0f172a; white-space: nowrap; }
.lv-pos-summe em { font-style: normal; font-weight: 500; color: #64748b; font-size: .8rem; }
.lv-pos-konf { font-size: .72rem; font-weight: 600; padding: .05rem .4rem; border-radius: 999px; white-space: nowrap; }
.lv-pos-konf.sicher { background: #dcfce7; color: #166534; }
.lv-pos-konf.mittel { background: #fef9c3; color: #854d0e; }
.lv-pos-konf.unsicher { background: #fee2e2; color: #991b1b; }
.lv-pos-quelle { font-size: .74rem; color: #94a3b8; margin: .15rem 0 0 2.8rem; }
.lv-aufmass { margin: .3rem 0 0 2.8rem; }
.lv-aufmass > summary { font-size: .76rem; color: #2563eb; cursor: pointer; }
.lv-aufmass-tab { width: 100%; margin-top: .3rem; font-size: .78rem; border-collapse: collapse; }
.lv-aufmass-tab td { padding: .18rem .4rem; border-bottom: 1px solid #f1f5f9; color: #475569; }
.lv-aufmass-tab td.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.lv-z-quelle { color: #94a3b8; font-size: .72rem; }

/* Druck: nur die Massenermittlung sauber; Aufmaß-Zeilen werden per beforeprint
   (JS) aufgeklappt — robuster als CSS-Tricks gegen <details>. */
@media print {
  .navbar, .btn, .ml-board-tools { display: none !important; }
  #projekt-massen-detail-wrap { display: block !important; }
  .lv-aufmass > summary { display: none; }
  .lv-pos, .lv-gewerk { break-inside: avoid; }
}
