/* NeverMind (XMind, SIL Open Font License 1.1, siehe fonts/OFL-NeverMind.txt) */
@font-face { font-family: "NeverMind"; src: url("fonts/NeverMind-Light.woff") format("woff"); font-weight: 300; font-display: swap; }
@font-face { font-family: "NeverMind"; src: url("fonts/NeverMind-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "NeverMind"; src: url("fonts/NeverMind-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "NeverMind"; src: url("fonts/NeverMind-Extrabold.woff") format("woff"); font-weight: 800; font-display: swap; }

:root {
  color-scheme: light;
  --font: "NeverMind", system-ui, sans-serif;
  --surface-0: #fbf7fa;
  /* Unsichere Werte (Näherung): Warndreieck und Betrag dunkelgelb, Tabellenzeile hellgelb; gilt auch im Verlauf */
  --uncertain-ink: #9a5800; --uncertain-bg: #fdf4d3;
  --surface-1: #ffffff;
  --border: #ead9e5;
  --grid: #f1e6ee;
  --text-primary: #111111;
  --text-secondary: #4b3a47;
  --text-muted: #7a6574;
  --accent: #833572;
  /* FLÖ: Violett #833572, Orange #f89c0e, Schwarz #111111 */
  --band: #833572;
  --band-ink: #ffffff;
  --band-soft: #f3d6ea;
  --highlight: #f89c0e;
  /* Bereichsfarben in fester Reihenfolge der Kategorien, aus den FLÖ-Farben abgeleitet und auf
     Farbfehlsichtigkeit geprüft: Personal, Funktionsgebühren, Sach, Sozialfonds, Projekte, Sonstiges */
  --series-1: #009b95;
  --series-2: #5d52b4;
  --series-3: #833572;
  --series-4: #d83f66;
  --series-5: #f89c0e;
  --series-6: #be73b8;
  --series-7: #6e5f6a;
  --series-8: #b98a3e;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #171216;
    --uncertain-ink: #f2b453; --uncertain-bg: #34290f;
    --surface-1: #211a1f;
    --border: #3a2d36;
    --grid: #2d232a;
    --text-primary: #f5eff3;
    --text-secondary: #d3c4cf;
    --text-muted: #a8949f;
    --accent: #e3a3d2;
    --band: #5c2652;
    --band-ink: #ffffff;
    --band-soft: #f0cfe6;
    --highlight: #f89c0e;
    --series-1: #18a7a1;
    --series-2: #675cbf;
    --series-3: #a14b8d;
    --series-4: #d13760;
    --series-5: #d47b00;
    --series-6: #c075b9;
    --series-7: #9b8b97;
    --series-8: #c99a4c;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #171216;
  --uncertain-ink: #f2b453; --uncertain-bg: #34290f;
  --surface-1: #211a1f;
  --border: #3a2d36;
  --grid: #2d232a;
  --text-primary: #f5eff3;
  --text-secondary: #d3c4cf;
  --text-muted: #a8949f;
  --accent: #e3a3d2;
  --band: #5c2652;
  --band-ink: #ffffff;
  --band-soft: #f0cfe6;
  --highlight: #f89c0e;
  --series-1: #18a7a1;
  --series-2: #675cbf;
  --series-3: #a14b8d;
  --series-4: #d13760;
  --series-5: #d47b00;
  --series-6: #c075b9;
  --series-7: #9b8b97;
  --series-8: #c99a4c;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: var(--font);
  line-height: 1.5;
}

a { color: var(--accent); }

/* Kopfzeile ohne eigene Fläche, nur das Jahresmenü; auf der Jahresseite so breit wie der Inhalt */
.site-header .inner { padding-top: 12px; }
.site-header.narrow .inner { max-width: calc(1040px + 32px); }
/* Jahresseite: Kopfzeile geht nahtlos in das violette Band über */
.site-header.band { background: var(--band); color: var(--band-ink); }
.site-header.band .inner { padding-top: 20px; }
.site-header.band .nav-menu summary { background: #ffffff; color: #833572; border: 0; border-radius: 999px; padding: 10px 18px; min-height: 44px; }
.site-header.band .nav-menu summary:hover { background: var(--band-soft); }
.site-header.band .nav-menu summary:focus-visible { outline: 3px solid var(--highlight); outline-offset: 2px; }
/* Gefüllt ist nur der Knopf der aktuellen Seite: auf der Vergleichsseite ist das Jahresmenü umrandet */
.site-header.band .nav-menu.secondary summary { background: transparent; color: #ffffff; box-shadow: none; }
.site-header.band .nav-menu.secondary summary:hover { background: rgba(255, 255, 255, 0.12); }
.site-header.band .nav-menu.secondary[open] summary { background: #ffffff; color: #833572; box-shadow: none; }
body.page-band main { padding-top: 0; }

.site-footer { border-top: 1px solid var(--border); color: var(--text-secondary); font-size: 0.875rem; }
.site-footer .inner { max-width: 1072px; margin: 0 auto; padding: 24px 16px 32px; display: flex; flex-wrap: wrap; gap: 8px 32px; justify-content: space-between; }
.site-footer p { margin: 0; max-width: 60ch; }
.site-footer a { color: var(--accent); font-weight: 700; text-underline-offset: 2px; }

.site-header .inner,
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.site-header .inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px 10px;
  min-height: 56px;
}


.nav-menu { position: relative; }
/* Zurück zur Startseite: dezentes Haus links in der Kopfzeile (Menüs bleiben rechts) */
/* negativer Rand: das Symbol selbst steht bündig mit dem Inhalt, die Klickfläche ragt in den Rand */
.nav-home { margin-right: auto; margin-left: -12px; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 999px;
  color: var(--text-secondary); font-size: 1.125rem; opacity: 0.8; text-decoration: none; }
.nav-home:hover { opacity: 1; background: var(--grid); }
.nav-home:focus-visible { opacity: 1; outline: 2px solid var(--accent); outline-offset: 2px; }
.site-header.band .nav-home { color: #ffffff; }
.site-header.band .nav-home:hover { background: rgba(255, 255, 255, 0.12); }
.site-header.band .nav-home:focus-visible { outline: 3px solid var(--highlight); }
/* Vergleich als eigener Knopf links neben dem Jahresmenü; beide rechtsbündig */
.nav-compare-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px; font-weight: 700; text-decoration: none;
  color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.nav-compare-btn .short { display: none; }
.nav-compare-btn:hover { background: var(--grid); }
.nav-compare-btn[aria-current="page"] { background: var(--accent); color: var(--surface-1); }
.site-header.band .nav-compare-btn { color: #ffffff; box-shadow: none; }
.site-header.band .nav-compare-btn:hover { background: rgba(255, 255, 255, 0.12); }
.site-header.band .nav-compare-btn[aria-current="page"] { background: #ffffff; color: #833572; box-shadow: none; }
.site-header.band .nav-compare-btn:focus-visible { outline: 3px solid var(--highlight); outline-offset: 2px; }

.nav-menu summary {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  cursor: pointer;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-0);
  color: var(--text-primary);
  font-weight: 600;
  user-select: none;
}
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu summary:hover { border-color: var(--text-muted); }
.nav-menu summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-menu summary .short { display: none; }
.nav-menu .caret { transition: transform 0.15s; }
.nav-menu[open] .caret { transform: rotate(180deg); }

.nav-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  width: min(300px, calc(100vw - 32px));
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  padding: 8px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
}

.nav-heading {
  margin: 4px 8px 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav-panel ul { list-style: none; margin: 0; padding: 0; }

.nav-panel a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 7px 8px;
  border-radius: 6px;
  color: var(--text-primary);
  text-decoration: none;
}
.nav-panel a:hover, .nav-panel a:focus-visible { background: var(--surface-0); outline: none; }
.nav-panel a[aria-current="page"] { background: var(--surface-0); box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; }

/* Projekte: Themenfarben aus den sechs Bereichsfarben (Kacheln, Projektseiten, Projektmenü). Fläche = helle Tönung, Beschriftung so weit
   abgedunkelt, dass sie 4,5:1 erreicht, Symbol = Bereichsfarbe selbst */
.th-notlagen { --tile-c: #f89c0e; --tile-bg: #feefd8; --tile-ink: #905d0f; }
.th-gesundheit { --tile-c: #d83f66; --tile-bg: #f9e0e7; --tile-ink: #b03655; }
.th-wohnen { --tile-c: #be73b8; --tile-bg: #f5e9f4; --tile-ink: #8a5686; }
.th-lernen { --tile-c: #5d52b4; --tile-bg: #e5e3f3; --tile-ink: #5d52b4; }
.th-klima { --tile-c: #009b95; --tile-bg: #d6efee; --tile-ink: #05726d; }
.th-vielfalt { --tile-c: #833572; --tile-bg: #ebdfe8; --tile-ink: #833572; }
.th-mitreden { --tile-c: #6e5f6a; --tile-bg: #e8e5e7; --tile-ink: #6e5f6a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .th-notlagen { --tile-c: #d47b00; --tile-bg: #482f18; --tile-ink: #da8f26; }
  :root:not([data-theme="light"]) .th-gesundheit { --tile-c: #d13760; --tile-bg: #48202d; --tile-ink: #df7390; }
  :root:not([data-theme="light"]) .th-wohnen { --tile-c: #c075b9; --tile-bg: #442e41; --tile-ink: #c98ac4; }
  :root:not([data-theme="light"]) .th-lernen { --tile-c: #675cbf; --tile-bg: #302942; --tile-ink: #958dd2; }
  :root:not([data-theme="light"]) .th-klima { --tile-c: #18a7a1; --tile-bg: #1f393c; --tile-ink: #2fb0aa; }
  :root:not([data-theme="light"]) .th-vielfalt { --tile-c: #a14b8d; --tile-bg: #3d2537; --tile-ink: #bd81af; }
  :root:not([data-theme="light"]) .th-mitreden { --tile-c: #9b8b97; --tile-bg: #3c3339; --tile-ink: #aa9ca7; }
}
:root[data-theme="dark"] .th-notlagen { --tile-c: #d47b00; --tile-bg: #482f18; --tile-ink: #da8f26; }
:root[data-theme="dark"] .th-gesundheit { --tile-c: #d13760; --tile-bg: #48202d; --tile-ink: #df7390; }
:root[data-theme="dark"] .th-wohnen { --tile-c: #c075b9; --tile-bg: #442e41; --tile-ink: #c98ac4; }
:root[data-theme="dark"] .th-lernen { --tile-c: #675cbf; --tile-bg: #302942; --tile-ink: #958dd2; }
:root[data-theme="dark"] .th-klima { --tile-c: #18a7a1; --tile-bg: #1f393c; --tile-ink: #2fb0aa; }
:root[data-theme="dark"] .th-vielfalt { --tile-c: #a14b8d; --tile-bg: #3d2537; --tile-ink: #bd81af; }
:root[data-theme="dark"] .th-mitreden { --tile-c: #9b8b97; --tile-bg: #3c3339; --tile-ink: #aa9ca7; }

/* Projektmenü: nach Thema gruppiert, Projektsymbol vor dem Namen */
.nav-project { display: inline-flex; align-items: baseline; gap: 10px; }
.nav-project svg { flex: none; color: var(--tile-c, var(--accent)); }
.nav-project .no-icon { flex: none; width: 1.25em; }
.nav-projects .nav-heading:not(:first-child) { margin-top: 12px; }
.nav-total { color: var(--text-secondary); font-size: 0.875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

.nav-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  vertical-align: 1px;
}


main { padding-top: 24px; padding-bottom: 48px; }

h1 { font-size: 1.75rem; margin: 0 0 4px; }
h2 { font-size: 1.25rem; margin: 0 0 12px; }

.lead { color: var(--text-secondary); margin: 0 0 24px; }

.panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 12px;
}

.panel-header h2 { margin: 0; }

.muted { color: var(--text-muted); }
.small { font-size: 0.875rem; }

/* Kennzahlen */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.stat .label { color: var(--text-secondary); font-size: 0.875rem; }
.stat .value { font-size: clamp(1.35rem, 1.1rem + 0.8vw, 1.75rem); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat .sub { color: var(--text-secondary); font-size: 0.875rem; }

a.stat { color: inherit; text-decoration: none; }
a.stat:hover { border-color: var(--accent); }

/* Jahresnavigation */
.year-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}

.year-nav .pager { display: flex; gap: 16px; }

/* Diagramme */
.chart { width: 100%; height: 420px; }
.chart.treemap { height: min(75vh, 720px); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: baseline;
}

.c0 { background: var(--series-1); }
.c1 { background: var(--series-2); }
.c2 { background: var(--series-3); }
.c3 { background: var(--series-4); }
.c4 { background: var(--series-5); }
.c5 { background: var(--series-6); }
.c6 { background: var(--series-7); }
.c7 { background: var(--series-8); }

/* Formulare */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

select, button {
  font: inherit;
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  max-width: 100%;
}

button { cursor: pointer; }
button:hover { border-color: var(--accent); }

/* Tabellen */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 0.9375rem;
}

th, td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--grid);
  vertical-align: top;
}

th { color: var(--text-secondary); font-weight: 600; font-size: 0.875rem; }
td.num, th.num { text-align: right; white-space: nowrap; }

tr.group td {
  font-weight: 700;
  background: var(--surface-0);
  border-top: 1px solid var(--border);
}

tr.total td {
  font-weight: 700;
  border-top: 2px solid var(--text-secondary);
  border-bottom: none;
}

td.indent { padding-left: 28px; }
td.indent-2 { padding-left: 48px; }
tr.subgroup td { font-weight: 600; color: var(--text-secondary); }

.note { display: block; color: var(--text-muted); font-size: 0.8125rem; }

.change-up::before { content: "▲ "; font-size: 0.7em; }
.change-down::before { content: "▼ "; font-size: 0.7em; }

details summary { cursor: pointer; color: var(--text-secondary); }

.notes-box { white-space: pre-line; color: var(--text-secondary); }

.empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-secondary);
}

@media (max-width: 480px) {
  .site-header .inner { flex-wrap: nowrap; }
  .nav-menu summary .long { display: none; }
  .nav-menu summary .short { display: inline; }
  /* Menüs öffnen über die ganze Kopfzeile statt am Knopf (sonst links abgeschnitten) */
  .site-header .inner { position: relative; }
  .nav-menu { position: static; }
  .nav-panel, .nav-projects .nav-panel { right: 16px; width: calc(100vw - 32px); }
  .site-header.band .nav-menu summary { padding: 10px 12px; gap: 6px; }
  /* Vier Elemente in 358 px: engere Abstände */
  .site-header .inner { gap: 4px; }
  .nav-compare-btn { padding: 0 12px; }
  .nav-home { width: 40px; margin-left: -10px; }
  .nav-compare-btn .long { display: none; }
  .nav-compare-btn .short { display: inline; }
}
