:root {
    /* epu CI (Platzhalter — finale Farbwerte laut 07-roadmap noch offen) */
    --epu-primary: #123a5e;      /* tiefes Sicherheits-Blau */
    --epu-primary-dark: #0d2c47;
    --epu-accent: #e8702a;       /* Signal-Orange */
    /* Ampel / Risikogruppen (1:1 aus Röhll DESIGN.md, = BG-BAU-Codierung) */
    --ampel-gruen: #16a34a;
    --ampel-gelb: #f59e0b;
    --ampel-rot: #dc2626;

    --text-dark: #1f2933;
    --text-muted: #66707a;
    --bg-light: #f3f5f7;
    --bg-white: #ffffff;
    --border-color: #e1e5ea;
    --shadow: 0 1px 3px rgba(18, 58, 94, 0.08), 0 1px 2px rgba(18, 58, 94, 0.06);
    --shadow-md: 0 4px 16px rgba(18, 58, 94, 0.10);
    --radius: 10px;
    --transition: all 0.18s ease-in-out;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text-dark);
    background: var(--bg-light);
    line-height: 1.55;
    min-height: 100vh;
}

h1, h2, h3, h4 { font-family: 'Oswald', sans-serif; font-weight: 700; text-transform: uppercase; line-height: 1.15; }

.container-full { display: flex; flex-direction: column; min-height: 100vh; }
.hidden { display: none !important; }

/* ---------- Header ---------- */
header {
    background: var(--bg-white);
    position: sticky; top: 0; z-index: 1000;
    border-bottom: 3px solid var(--epu-primary);
    padding: 0.9rem 0;
}
.header-content {
    max-width: 1240px; margin: 0 auto; padding: 0 2rem;
    display: flex; justify-content: space-between; align-items: center;
}
.brand { text-decoration: none; display: flex; flex-direction: column; line-height: 1; }
.brand-mark {
    font-family: 'Oswald', sans-serif; font-weight: 700; font-size: 1.8rem;
    letter-spacing: 2px; color: var(--epu-primary); text-transform: lowercase;
}
.brand-sub { font-size: 0.72rem; letter-spacing: 1.5px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; }
.env-badge {
    background: var(--epu-accent); color: #fff; font-size: 0.7rem; font-weight: 700;
    letter-spacing: 1.5px; padding: 4px 10px; border-radius: 4px;
}

/* ---------- Hero ---------- */
.hero-strip {
    background: linear-gradient(120deg, var(--epu-primary-dark), var(--epu-primary));
    color: #fff; padding: 3.2rem 2rem;
}
.hero-content { max-width: 1240px; margin: 0 auto; }
.hero-eyebrow { font-size: 0.8rem; letter-spacing: 2px; text-transform: uppercase; color: var(--epu-accent); font-weight: 700; margin-bottom: 0.6rem; }
.hero-content h1 { font-size: 2.3rem; max-width: 22ch; margin-bottom: 0.8rem; }
.hero-lead { max-width: 60ch; color: rgba(255,255,255,0.82); font-size: 1rem; }
.hero-info-btn {
    margin-top: 1.1rem; background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.4);
    padding: 0.5rem 1rem; border-radius: 7px; font-size: 0.85rem; cursor: pointer; transition: var(--transition);
}
.hero-info-btn:hover { background: rgba(255,255,255,0.22); }

/* So funktioniert's — Prozessband */
.process-band { background: var(--bg-white); border-bottom: 1px solid var(--border-color); }
.process-inner {
    max-width: 1240px; margin: 0 auto; padding: 1.6rem 2rem; display: flex; align-items: stretch; gap: 1rem;
}
.process-step { flex: 1; display: flex; gap: 0.8rem; align-items: flex-start; }
.process-step .ps-num {
    flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--epu-primary); color: #fff;
    font-family: 'Oswald'; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.process-step h3 { font-size: 0.98rem; color: var(--epu-primary); margin-bottom: 0.2rem; }
.process-step p { font-size: 0.84rem; color: var(--text-muted); line-height: 1.45; }
.process-arrow { align-self: center; color: var(--epu-accent); font-size: 1.5rem; font-weight: 700; flex-shrink: 0; }
@media (max-width: 860px) {
    .process-inner { flex-direction: column; }
    .process-arrow { transform: rotate(90deg); align-self: flex-start; margin-left: 8px; }
}

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(13,44,71,0.55); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 1.5rem; }
.modal { background: #fff; border-radius: var(--radius); max-width: 680px; width: 100%; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border-color); }
.modal-header h3 { font-size: 1.2rem; color: var(--epu-primary); }
.modal-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-muted); width: 36px; height: 36px; border-radius: 50%; }
.modal-close:hover { background: var(--bg-light); }
.modal-body { padding: 1.2rem 1.4rem 1.6rem; overflow-y: auto; }
.modal-intro { font-size: 0.92rem; margin-bottom: 1rem; color: var(--text-dark); }
.info-acc { border: 1px solid var(--border-color); border-radius: 8px; margin-bottom: 0.6rem; overflow: hidden; }
.info-acc-head { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1rem; cursor: pointer; font-weight: 600; font-size: 0.92rem; background: #fafbfc; }
.info-acc-head:hover { background: #f0f6fb; }
.info-acc-head .chev { color: var(--text-muted); transition: transform 0.2s; }
.info-acc-head.open .chev { transform: rotate(180deg); }
.info-acc-body { padding: 0.9rem 1rem; font-size: 0.86rem; line-height: 1.55; border-top: 1px solid var(--border-color); }
.info-acc-body ol, .info-acc-body ul { padding-left: 1.2rem; }
.info-acc-body li { margin-bottom: 0.4rem; }
.info-acc-body code { background: var(--bg-light); padding: 1px 5px; border-radius: 4px; font-size: 0.82rem; }
.info-acc-body .muted { color: var(--text-muted); margin-top: 0.5rem; }
.info-table { width: 100%; border-collapse: collapse; }
.info-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border-color); vertical-align: top; font-size: 0.86rem; }
.info-table .dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }
.dot.rot { background: var(--ampel-rot); } .dot.gelb { background: var(--ampel-gelb); } .dot.gruen { background: var(--ampel-gruen); }
/* Report-Modal */
.report-modal { max-width: 760px; }
.modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; padding: 0.9rem 1.4rem; border-top: 1px solid var(--border-color); flex-wrap: wrap; }
.modal-actions button { font-size: 0.82rem; padding: 0.55rem 0.9rem; }
.report-preview { font-size: 0.86rem; line-height: 1.55; }
.report-preview h1 { font-size: 1.3rem; color: var(--epu-primary); margin-bottom: 0.3rem; }
.report-preview h2 { font-size: 1rem; margin: 1rem 0 0.4rem; color: var(--epu-primary); }
.report-preview table { width: 100%; border-collapse: collapse; margin: 0.5rem 0; font-size: 0.8rem; }
.report-preview th, .report-preview td { border: 1px solid var(--border-color); padding: 0.4rem 0.5rem; text-align: left; vertical-align: top; }
.report-preview th { background: #fafbfc; }
.report-preview .rep-meta { color: var(--text-muted); }
.report-preview .rep-foot { font-style: italic; color: var(--text-muted); margin-top: 1rem; border-top: 1px solid var(--border-color); padding-top: 0.6rem; }

/* Soll-Ist */
.sollist-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.9rem; margin-bottom: 1.2rem; }
.sollist-stat { border: 1px solid var(--border-color); border-radius: 8px; padding: 0.9rem; text-align: center; }
.sollist-stat .ss-val { font-family: 'Oswald'; font-size: 1.7rem; font-weight: 700; color: var(--epu-primary); }
.sollist-stat .ss-label { font-size: 0.76rem; color: var(--text-muted); margin-top: 0.2rem; }
.sollist-section h4 { font-size: 0.95rem; margin: 1rem 0 0.5rem; color: var(--epu-primary); }

/* Coverage */
.cov-bauart { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; font-size: 0.88rem; }
.cov-bauart select { font-family: 'Inter'; padding: 0.4rem 0.6rem; border: 1px solid var(--border-color); border-radius: 6px; }
.cov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.8rem; }
.cov-card { border: 1px solid var(--border-color); border-left: 5px solid var(--ampel-gruen); border-radius: 8px; padding: 0.8rem 1rem; }
.cov-card.fehlt { border-left-color: var(--ampel-gelb); background: #fffbeb; }
.cov-card .cc-code { font-family: 'Oswald'; font-weight: 700; color: var(--epu-primary); }
.cov-card .cc-status { font-size: 0.78rem; margin-top: 0.3rem; }
.cc-ok { color: var(--ampel-gruen); font-weight: 600; }
.cc-miss { color: #b45309; font-weight: 600; }

.footer-links { margin-top: 0.4rem; }
.footer-info-link { color: rgba(255,255,255,0.7); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: 0.8rem; }
.footer-info-link:hover { color: #fff; }

/* ---------- Layout ---------- */
.dashboard-container { max-width: 1240px; margin: 0 auto; padding: 1.6rem 2rem 3rem; width: 100%; }
.ai-notice {
    background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
    border-radius: var(--radius); padding: 0.7rem 1rem; font-size: 0.86rem;
    margin-bottom: 1.4rem; display: flex; gap: 0.6rem; align-items: center;
}
.dashboard { display: grid; grid-template-columns: 320px 1fr; gap: 1.6rem; align-items: start; }
@media (max-width: 960px) { .dashboard { grid-template-columns: 1fr; } }

/* ---------- Sidebar ---------- */
.controls-card {
    background: var(--bg-white); border: 1px solid var(--border-color);
    border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow);
    position: sticky; top: 90px;
}
.upload-block { margin-bottom: 1.1rem; }
.upload-label { display: block; font-size: 0.8rem; font-weight: 700; margin-bottom: 0.4rem; color: var(--text-dark); }
.upload-label span { color: var(--text-muted); font-weight: 500; }
.upload-area {
    border: 2px dashed var(--border-color); border-radius: 8px; padding: 1rem;
    text-align: center; cursor: pointer; transition: var(--transition); color: var(--epu-primary);
    display: flex; flex-direction: column; align-items: center; gap: 0.45rem;
}
.upload-area:hover, .upload-area.dragover { border-color: var(--epu-primary); background: #f0f6fb; }
.upload-area.filled { border-style: solid; border-color: var(--ampel-gruen); background: #f0fdf4; color: var(--text-dark); }
.upload-icon { flex-shrink: 0; }
.file-name { font-size: 0.82rem; word-break: break-word; }

.action-buttons { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.4rem; }
.primary-btn, .secondary-btn {
    font-family: 'Oswald', sans-serif; font-weight: 500; letter-spacing: 0.6px;
    border-radius: 7px; padding: 0.75rem 1rem; cursor: pointer; font-size: 0.92rem;
    border: 2px solid var(--epu-primary); transition: var(--transition); text-transform: uppercase;
}
.primary-btn { background: var(--epu-primary); color: #fff; }
.primary-btn:hover:not(:disabled) { background: var(--epu-primary-dark); }
.primary-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.secondary-btn { background: #fff; color: var(--epu-primary); }
.secondary-btn:hover { background: #f0f6fb; }
.status-msg { margin-top: 0.9rem; font-size: 0.84rem; color: var(--text-muted); min-height: 1.2em; }
.status-msg.error { color: var(--ampel-rot); }

/* ---------- Content card / tabs ---------- */
.content-card { background: var(--bg-white); border: 1px solid var(--border-color); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.tabs-nav { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--border-color); background: #fafbfc; }
.tab-btn {
    font-family: 'Oswald', sans-serif; font-weight: 500; letter-spacing: 0.5px;
    background: none; border: none; padding: 1rem 1.3rem; cursor: pointer; font-size: 0.9rem;
    color: var(--text-muted); border-bottom: 3px solid transparent; transition: var(--transition);
    display: flex; align-items: center; gap: 0.5rem;
}
.tab-btn:hover { color: var(--epu-primary); }
.tab-btn.active { color: var(--epu-primary); border-bottom-color: var(--epu-accent); }
.tab-badge { background: var(--ampel-rot); color: #fff; border-radius: 999px; font-size: 0.72rem; padding: 1px 8px; font-family: 'Inter'; font-weight: 700; }
.tab-badge:empty { display: none; }
.tab-content { padding: 1.6rem; position: relative; min-height: 320px; }
.placeholder-msg { color: var(--text-muted); padding: 2.5rem 1rem; text-align: center; font-size: 0.95rem; }

/* ---------- Loader ---------- */
.loader { position: absolute; inset: 0; background: rgba(255,255,255,0.75); display: flex; align-items: center; justify-content: center; z-index: 5; }
.loader::after { content: ""; width: 42px; height: 42px; border: 4px solid var(--border-color); border-top-color: var(--epu-primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Übersicht / Score ---------- */
.score-header { margin-bottom: 1.4rem; }
.score-header h2 { font-size: 1.5rem; }
.score-header .meta-line { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.2rem; }
.score-grid { display: grid; grid-template-columns: 240px 1fr; gap: 1.4rem; }
@media (max-width: 720px) { .score-grid { grid-template-columns: 1fr; } }

.ampel-card { border-radius: var(--radius); padding: 1.4rem; color: #fff; text-align: center; box-shadow: var(--shadow-md); }
.ampel-card.rot { background: linear-gradient(140deg, #ef4444, var(--ampel-rot)); }
.ampel-card.gelb { background: linear-gradient(140deg, #fbbf24, var(--ampel-gelb)); }
.ampel-card.gruen { background: linear-gradient(140deg, #22c55e, var(--ampel-gruen)); }
.ampel-card .ampel-lights { display: flex; justify-content: center; gap: 0.5rem; margin-bottom: 0.8rem; }
.ampel-light { width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,0.25); }
.ampel-light.on { background: #fff; box-shadow: 0 0 14px rgba(255,255,255,0.9); }
.ampel-card .ampel-label { font-family: 'Oswald'; font-size: 1.6rem; font-weight: 700; }
.ampel-card .ampel-reason { font-size: 0.82rem; margin-top: 0.5rem; opacity: 0.95; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.9rem; }
.kpi { background: #fafbfc; border: 1px solid var(--border-color); border-radius: 8px; padding: 1rem; }
.kpi .kpi-value { font-family: 'Oswald'; font-size: 1.9rem; font-weight: 700; color: var(--epu-primary); line-height: 1; }
.kpi .kpi-value.danger { color: var(--ampel-rot); }
.kpi .kpi-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.35rem; text-transform: uppercase; letter-spacing: 0.5px; }
.quote-bar { height: 10px; background: var(--border-color); border-radius: 999px; overflow: hidden; margin-top: 0.6rem; }
.quote-bar > span { display: block; height: 100%; background: var(--ampel-gruen); }

/* ---------- Mängel-Karten ---------- */
.findings-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.6rem; }
.findings-toolbar h3 { font-size: 1.15rem; }
.findings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1rem; }
.finding-card { border: 1px solid var(--border-color); border-left: 5px solid var(--ampel-rot); border-radius: 8px; overflow: hidden; background: #fff; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.finding-card .fc-head { padding: 0.9rem 1rem 0.4rem; }
.fc-prio { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--ampel-rot); }
.fc-loc { font-size: 0.76rem; color: var(--text-muted); margin: 0.3rem 0; }
.fc-title { font-weight: 600; font-size: 0.98rem; margin-bottom: 0.5rem; }
.fc-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.5rem; }
.chip { font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; background: #eef2f6; color: var(--text-dark); border: 1px solid var(--border-color); }
.chip.status { background: #fef2f2; color: var(--ampel-rot); border-color: #fecaca; }
.chip.frist { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.fc-legal { font-size: 0.74rem; color: var(--text-muted); padding: 0 1rem 0.8rem; }
.fc-photo { width: 100%; height: 180px; object-fit: cover; cursor: pointer; border-top: 1px solid var(--border-color); background: #f3f5f7; }
.fc-nophoto { font-size: 0.74rem; color: var(--text-muted); padding: 0.5rem 1rem 0.9rem; font-style: italic; }

.rg-badge { display: inline-block; width: 20px; height: 20px; border-radius: 50%; text-align: center; line-height: 20px; font-size: 0.74rem; font-weight: 700; color: #fff; }
.rg-1 { background: var(--ampel-rot); }
.rg-2 { background: var(--ampel-gelb); }
.rg-3 { background: var(--ampel-gruen); }

/* ---------- Tabellen / Filter ---------- */
.filter-bar { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-bar select, .filter-bar input {
    font-family: 'Inter'; font-size: 0.85rem; padding: 0.45rem 0.7rem;
    border: 1px solid var(--border-color); border-radius: 6px; background: #fff;
}
.filter-bar input { flex: 1; min-width: 180px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th { text-align: left; background: #fafbfc; padding: 0.6rem 0.7rem; border-bottom: 2px solid var(--border-color); font-weight: 600; position: sticky; top: 0; }
.data-table td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border-color); vertical-align: top; }
.data-table tr.is-mangel { background: #fef2f2; }
.bool-yes { color: var(--ampel-gruen); font-weight: 700; }
.bool-no { color: var(--ampel-rot); font-weight: 700; }
.bool-null { color: var(--text-muted); }
.w-pill { font-size: 0.72rem; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border-color); }
.w-Hoch { background: #fef2f2; color: var(--ampel-rot); border-color: #fecaca; }
.w-Mittel { background: #fffbeb; color: #b45309; border-color: #fde68a; }

/* ---------- Gefährdungen ---------- */
.module-block { border: 1px solid var(--border-color); border-radius: 8px; margin-bottom: 0.9rem; overflow: hidden; }
.module-head { background: #fafbfc; padding: 0.8rem 1rem; font-family: 'Oswald'; font-weight: 600; display: flex; justify-content: space-between; cursor: pointer; }
.module-head .mh-code { color: var(--epu-primary); }
.bereich-block { padding: 0.5rem 1rem 0.8rem; border-top: 1px solid var(--border-color); }
.bereich-name { font-weight: 600; font-size: 0.9rem; margin: 0.5rem 0 0.4rem; }
.gef-row { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.4rem 0; border-bottom: 1px dashed var(--border-color); font-size: 0.86rem; }
.gef-row:last-child { border-bottom: none; }
.gef-row .gef-name { flex: 1; }
.gef-row .gef-count { font-size: 0.74rem; color: var(--text-muted); }

/* ---------- Footer ---------- */
.main-footer { margin-top: auto; background: var(--epu-primary-dark); color: rgba(255,255,255,0.75); text-align: center; padding: 1.2rem; font-size: 0.82rem; }
.app-version { margin-left: 0.8rem; font-weight: 600; color: rgba(255,255,255,0.55); }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.85); display: flex; align-items: center; justify-content: center; z-index: 2000; }
.lightbox img { max-width: 90vw; max-height: 86vh; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
#lightbox-close { position: absolute; top: 1.2rem; right: 1.5rem; background: #fff; border: none; width: 44px; height: 44px; border-radius: 50%; font-size: 1.2rem; cursor: pointer; }
