@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: optional;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
}

:root {
  --navy: #0F1E3A;
  --navy-2: #182B4F;
  --teal: #0D7F74;
  --teal-dark: #0A6A61;
  --teal-light: #2DD4BF;
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --text: #1A2233;
  --muted: #4B5568;
  --border: #D9DEE7;
  --focus: #0D7F74;

  --krit-bg: #FDE2E2; --krit-fg: #991B1B; --krit-bar: #DC2626;
  --hoch-bg: #FFEDD5; --hoch-fg: #9A3412; --hoch-bar: #EA580C;
  --mitt-bg: #FEF3C7; --mitt-fg: #854D0E; --mitt-bar: #D97706;
  --nied-bg: #EEF0F3; --nied-fg: #374151; --nied-bar: #6B7280;
  --ok-bg: #DCFCE7; --ok-fg: #166534;

  --banner-h: 3rem;
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--teal-dark); }
a:hover { color: var(--navy); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

h1, h2, h3 { line-height: 1.25; color: var(--navy); }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1.05rem; margin: 1.25rem 0 .5rem; }
p { margin: 0 0 .9rem; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--teal); color: #fff; padding: .6rem 1rem; z-index: 100;
}
.skip-link:focus { left: .5rem; top: .5rem; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ── Demo-Banner (DEMO-02) ───────────────────────────────────────────── */
.demo-banner {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  min-height: var(--banner-h);
  display: flex; align-items: center; justify-content: center; gap: .5rem 1rem;
  flex-wrap: wrap; padding: .4rem 1rem;
  background: var(--teal); color: #fff; font-size: .9rem; text-align: center;
}
.demo-banner strong { font-weight: 600; }
.demo-banner a {
  color: var(--navy); background: #fff; border-radius: 999px;
  padding: .2rem .8rem; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.demo-banner a:hover { background: #E6F7F5; }
.demo-banner a.back { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .7); font-weight: 600; }
.demo-banner a.back:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.back-site {
  display: block; margin: 1.5rem .25rem 0; padding: .6rem .75rem; border-top: 1px solid var(--navy-2);
  color: #C9D3E3; text-decoration: none; font-size: .9rem;
}
.back-site:hover { color: #fff; }
.back-site:focus-visible { outline-color: var(--teal-light); }
.demo-banner a:focus-visible { outline-color: #fff; }

/* ── Layout ──────────────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; padding-top: var(--banner-h); }

.sidebar {
  width: 16rem; flex: 0 0 16rem;
  background: var(--navy); color: #fff;
  position: sticky; top: var(--banner-h); height: calc(100vh - var(--banner-h));
  overflow-y: auto; padding: 1.25rem 1rem;
}
.sidebar .brand { display: block; margin: 0 .25rem 1.5rem; }
.sidebar .brand img { width: 11rem; height: auto; display: block; }
.sidebar .tenant { font-size: .8rem; color: #C9D3E3; margin: -1rem .25rem 1.25rem; }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list a {
  display: flex; align-items: center; gap: .6rem;
  color: #E5EBF5; text-decoration: none; padding: .55rem .75rem; border-radius: 8px;
  font-size: .95rem;
}
.nav-list a:hover { background: var(--navy-2); color: #fff; }
.nav-list a[aria-current="page"] { background: var(--navy-2); color: var(--teal-light); font-weight: 600; }
.nav-list a:focus-visible { outline-color: var(--teal-light); }
.nav-list .sub a { padding-left: 2.35rem; font-size: .9rem; }
.nav-list svg { width: 1.1rem; height: 1.1rem; flex: 0 0 auto; }
.nav-group { margin: 1rem .75rem .35rem; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: #AFBBD0; }

.menu-toggle {
  display: none; align-items: center; gap: .5rem;
  background: var(--navy); color: #fff; border: 0; border-radius: 8px;
  padding: .55rem .85rem; font: inherit; font-weight: 600; cursor: pointer;
}
.menu-toggle svg { width: 1.2rem; height: 1.2rem; }

.main { flex: 1 1 auto; min-width: 0; padding: 1.25rem 2rem 3rem; max-width: 72rem; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }

.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem; font-size: .85rem; color: var(--muted); }
.breadcrumb li + li::before { content: "›"; margin-right: .25rem; color: var(--muted); }
.breadcrumb a { color: var(--muted); }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head .lead { color: var(--muted); margin: 0; }

/* ── Deaktivierte Aktionen (DEMO-10) ─────────────────────────────────── */
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  font: inherit; font-size: .9rem; font-weight: 600; line-height: 1.2;
  padding: .6rem 1rem; border-radius: 8px; border: 1px solid transparent;
  text-decoration: none; cursor: pointer;
}
.btn svg { width: 1rem; height: 1rem; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); color: #fff; }
.btn-secondary { background: #fff; color: var(--navy); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--navy); color: var(--navy); }
.btn[aria-disabled="true"] { background: #EEF0F3; color: #555F70; border-color: #D3D8E0; cursor: not-allowed; }
.demo-hint { font-size: .8rem; color: var(--muted); margin: .35rem 0 0; width: 100%; }
.demo-hint[data-active] { color: var(--navy); font-weight: 600; }

/* ── Karten ──────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); }

.kpi { display: flex; flex-direction: column; gap: .2rem; border-left: 5px solid var(--border); }
.kpi .label { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.kpi .value { font-size: 2rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.kpi .sub { font-size: .8rem; color: var(--muted); }
.kpi.kritisch { border-left-color: var(--krit-bar); }
.kpi.hoch { border-left-color: var(--hoch-bar); }
.kpi.mittel { border-left-color: var(--mitt-bar); }
.kpi.niedrig { border-left-color: var(--nied-bar); }

.overview { display: grid; grid-template-columns: auto 1fr; gap: 1.5rem; align-items: center; }

/* Ampel (DEMO-03): Farbe + Text + Position */
.ampel { display: flex; flex-direction: column; gap: .45rem; background: var(--navy); padding: .6rem; border-radius: 999px; width: 3.4rem; }
.ampel span { display: block; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: #2B3A57; border: 2px solid #3A4A69; }
.ampel .on.rot { background: #EF4444; border-color: #FCA5A5; }
.ampel .on.gelb { background: #F59E0B; border-color: #FCD34D; }
.ampel .on.gruen { background: #22C55E; border-color: #86EFAC; }
.ampel-text .status { font-size: 1.35rem; font-weight: 700; color: var(--navy); margin: 0 0 .2rem; }
.ampel-text p { margin: 0 0 .35rem; color: var(--muted); }

/* ── Schweregrad-Badges (nie nur Farbe: Icon + Text) ─────────────────── */
.sev {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .8rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap;
}
.sev svg { width: .85rem; height: .85rem; }
.sev.kritisch { background: var(--krit-bg); color: var(--krit-fg); }
.sev.hoch { background: var(--hoch-bg); color: var(--hoch-fg); }
.sev.mittel { background: var(--mitt-bg); color: var(--mitt-fg); }
.sev.niedrig { background: var(--nied-bg); color: var(--nied-fg); }

.status-pill { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap; }
.status-pill svg { width: .85rem; height: .85rem; }
.status-pill.offen { background: #FDE8E8; color: #8A1C1C; }
.status-pill.behoben { background: var(--ok-bg); color: var(--ok-fg); }

/* ── Perspektiven-Kacheln ────────────────────────────────────────────── */
.tile { display: flex; flex-direction: column; gap: .5rem; text-decoration: none; color: inherit; transition: border-color .15s; }
.tile:hover { border-color: var(--teal); color: inherit; }
.tile h3 { margin: 0; display: flex; align-items: center; gap: .5rem; }
.tile h3 svg { width: 1.3rem; height: 1.3rem; color: var(--teal); }
.tile .meta { font-size: .85rem; color: var(--muted); }
.tile .more { margin-top: auto; font-weight: 600; color: var(--teal-dark); font-size: .9rem; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .75rem; margin: 0 0 1rem; }
.facts div { background: var(--bg); border-radius: 8px; padding: .6rem .8rem; }
.facts dt { font-size: .8rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; color: var(--navy); }

/* ── Tabellen (DEMO-05) ──────────────────────────────────────────────── */
.filters { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: flex-end; margin-bottom: 1rem; }
.filters label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; font-weight: 600; color: var(--navy); }
.filters select {
  font: inherit; font-size: .95rem; padding: .5rem 2rem .5rem .7rem; border: 1px solid #8A94A6; border-radius: 8px; background: #fff; color: var(--text);
  min-width: 11rem;
}
.result-count { font-size: .9rem; color: var(--muted); margin: 0 0 .5rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
table { border-collapse: collapse; width: 100%; min-width: 40rem; font-size: .92rem; }
th, td { text-align: left; padding: .7rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { background: #F0F3F7; font-size: .82rem; color: var(--navy); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #F8FAFC; }
th .sort { font: inherit; font-weight: 700; background: none; border: 0; padding: 0; color: inherit; cursor: pointer; display: inline-flex; gap: .3rem; align-items: center; }
th .sort::after { content: "↕"; color: var(--muted); font-weight: 400; }
th[aria-sort="ascending"] .sort::after { content: "↑"; color: var(--teal-dark); }
th[aria-sort="descending"] .sort::after { content: "↓"; color: var(--teal-dark); }
td a { font-weight: 600; }
.nr { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.chip { display: inline-flex; align-items: center; font-size: .8rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px; border: 1px solid var(--border); background: #fff; color: var(--navy); }

/* ── Fund-Detail (DEMO-06) ───────────────────────────────────────────── */
.detail-head { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.detail-section { margin-bottom: 1rem; }
.detail-section h2 { margin-top: 0; font-size: 1.05rem; display: flex; align-items: center; gap: .5rem; }
.detail-section h2 svg { width: 1.2rem; height: 1.2rem; color: var(--teal); }
.systems { list-style: none; margin: 0; padding: 0; }
.systems li { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px dashed var(--border); flex-wrap: wrap; }
.systems li:last-child { border-bottom: 0; }
.systems code, .tech code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .88rem; background: var(--bg); padding: .1rem .35rem; border-radius: 4px; overflow-wrap: anywhere; }

details.tech { border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
details.tech summary { cursor: pointer; padding: 1rem 1.25rem; font-weight: 600; color: var(--navy); }
details.tech summary span { font-weight: 400; color: var(--muted); font-size: .88rem; }
details.tech dl { margin: 0; padding: 0 1.25rem 1.25rem; display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1rem; }
details.tech dt { color: var(--muted); font-size: .88rem; }
details.tech dd { margin: 0; overflow-wrap: anywhere; }

.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; flex-wrap: wrap; }

/* ── Massnahmenplan (DEMO-07) ────────────────────────────────────────── */
.progress { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.progress-bar { flex: 1 1 12rem; height: .7rem; background: #E4E8EE; border-radius: 999px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 0; background: var(--teal); transition: width .2s; }
.measures { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.measure { display: grid; grid-template-columns: auto 1fr; gap: .25rem 1rem; align-items: start; }
.measure .prio { font-weight: 700; color: var(--navy); font-size: 1.1rem; min-width: 1.6rem; text-align: center; padding-top: .1rem; }
.measure label { display: flex; gap: .65rem; align-items: flex-start; cursor: pointer; font-weight: 600; color: var(--navy); }
.measure input[type="checkbox"] { width: 1.25rem; height: 1.25rem; margin-top: .15rem; accent-color: var(--teal); flex: 0 0 auto; }
.measure .text { grid-column: 2; color: var(--text); margin: 0; }
.measure .meta { grid-column: 2; display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .85rem; color: var(--muted); align-items: center; }
.measure.done label > span { text-decoration: line-through; color: var(--muted); }
.note { background: #E6F4F2; border: 1px solid #B6DDD8; border-radius: var(--radius); padding: .8rem 1rem; font-size: .9rem; color: #0B3D38; }

/* ── Bericht (DEMO-08) ───────────────────────────────────────────────── */
.report-preview { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
.paper {
  background: #fff; aspect-ratio: 210 / 297; border: 1px solid var(--border);
  box-shadow: 0 6px 20px rgba(15, 30, 58, .12); padding: 8% 9%;
  font-size: .75rem; line-height: 1.5; overflow: hidden; display: flex; flex-direction: column;
}
.paper h3 { font-size: 1.5em; margin: 0 0 .6em; }
.paper h4 { font-size: 1.15em; margin: 1.2em 0 .4em; color: var(--navy); }
.paper p { margin: 0 0 .6em; }
.paper .cover-logo { width: 55%; margin-bottom: 25%; }
.paper .cover-title { font-size: 2.2em; font-weight: 700; color: var(--navy); line-height: 1.2; margin-bottom: .4em; }
.paper .cover-sub { font-size: 1.15em; color: var(--muted); }
.paper .cover-foot { margin-top: auto; border-top: 2px solid var(--teal); padding-top: .8em; color: var(--muted); }
.paper table { min-width: 0; font-size: 1em; }
.paper th, .paper td { padding: .35em .5em; }
.paper-label { text-align: center; font-size: .85rem; color: var(--muted); margin-top: .5rem; }

/* ── Verlauf (DEMO-09) ───────────────────────────────────────────────── */
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.compare .card h2 { margin-top: 0; font-size: 1.05rem; }
.bars { display: grid; gap: .5rem; margin: .75rem 0 0; }
.bar-row { display: grid; grid-template-columns: 5.5rem 1fr 2rem; align-items: center; gap: .6rem; font-size: .88rem; }
.bar-track { height: .9rem; background: #EEF1F5; border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; }
.bar-fill.kritisch { background: var(--krit-bar); }
.bar-fill.hoch { background: var(--hoch-bar); }
.bar-fill.mittel { background: var(--mitt-bar); }
.bar-fill.niedrig { background: var(--nied-bar); }
.w-0 { width: 0; } .w-1 { width: 33.3%; } .w-2 { width: 66.6%; } .w-3 { width: 100%; }
.bar-row .count { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.delta { font-size: 1.1rem; font-weight: 700; color: var(--ok-fg); }
tr.is-fixed td:not(:last-child) { color: var(--muted); }
tr.is-fixed .title-cell { text-decoration: line-through; text-decoration-color: #9AA3B2; }

/* ── Abschluss-CTA (DEMO-12) ─────────────────────────────────────────── */
.cta {
  margin-top: 2.5rem; background: var(--navy); color: #fff; border-radius: var(--radius);
  padding: 1.5rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.cta h2 { color: #fff; margin: 0 0 .25rem; font-size: 1.15rem; }
.cta p { margin: 0; color: #D5DDEA; }
.cta .btn-primary { background: var(--teal-light); color: var(--navy); }
.cta .btn-primary:hover { background: #fff; color: var(--navy); }
.cta .btn-primary:focus-visible { outline-color: #fff; }

.footer { margin-top: 2rem; font-size: .8rem; color: var(--muted); }

/* ── Glossar-Hinweis ─────────────────────────────────────────────────── */
.term { font-weight: 600; }

/* ── 404 ─────────────────────────────────────────────────────────────── */
.notfound { text-align: center; padding: 4rem 1rem; }

/* ── Mobil (DEMO-11, NF-09) ──────────────────────────────────────────── */
@media (max-width: 60rem) {
  .layout { display: block; }
  .menu-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; top: var(--banner-h); left: 0; bottom: 0; height: auto; z-index: 40;
    transform: translateX(-100%); transition: transform .2s ease; visibility: hidden;
    box-shadow: 4px 0 20px rgba(0, 0, 0, .25);
  }
  .sidebar.open { transform: none; visibility: visible; }
  .main { padding: 1rem 1rem 3rem; }
  h1 { font-size: 1.35rem; }
  .overview { grid-template-columns: 1fr; }
  .ampel { flex-direction: row; width: auto; display: inline-flex; }
}

@media (max-width: 30rem) {
  :root { --banner-h: 6.6rem; }
  .demo-banner { font-size: .82rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
