*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: light dark; }
body { margin: 0; background: var(--paper); color: var(--ink-2); font-family: var(--font-body); font-size: var(--font-size-base); line-height: var(--line-height-base); -webkit-font-smoothing: antialiased; }
a { color: var(--terra-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; line-height: 1.5; margin: 0; color: var(--ink); text-wrap: balance; }
h1 { font-size: 1.125rem; }
/* Nur die Anmeldung und die Fehlerseite stehen fuer sich, dort etwas groesser. */
.login-wrap h1, .fehler-seite h1 { font-size: 1.39285rem; }
h2 { font-size: 1.69rem; }
h3 { font-size: 1.39285rem; }
h4 { font-family: var(--font-body); font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }
p { margin: 0 0 10px; }
.num, .tabular, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
td.mono, td .mono { white-space: nowrap; }
.mono, code { font-family: var(--font-mono); font-size: .88em; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.klein { font-size: 11px; color: var(--ink-3); }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }

/* Struktur: feste Seitenleiste links, Kopfzeile darueber rechts, Inhalt
   auf hellgrauem Grund. Das ist Homers Aufbau, nicht eine Seite mit Kopfmenue. */
.wrapper { display: flex; min-height: 100vh; }
.sidenav {
  position: fixed; inset: 0 auto 0 0; width: var(--sidenav-breite); z-index: 20;
  background: var(--sidenav-bg); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow-y: auto; }
.sidenav .logo {
  display: flex; align-items: baseline; gap: 6px; height: var(--topbar-hoehe);
  padding: 0 20px; border-bottom: 1px solid var(--line);
  font-size: 16px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; flex: none;
  white-space: nowrap; overflow: hidden; }
.sidenav .logo:hover { text-decoration: none; }
.sidenav .logo small { font-size: 8.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--terra); font-weight: 600; }
.sidenav-menu { padding: 12px 0 24px; }
.menu-titel {
  padding: 14px 20px 6px; font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ink-3); }
.sidenav-menu a {
  display: flex; align-items: center; gap: var(--sidenav-abstand);
  padding: 10px 20px; font-size: 12px; font-weight: 600;
  color: var(--sidenav-text); border-left: 3px solid transparent; }
.sidenav-menu a:hover { background: var(--sidenav-hover-bg); color: var(--sidenav-hover-text); text-decoration: none; }
.sidenav-menu a.aktiv { background: var(--sidenav-aktiv-bg); color: var(--terra-ink); border-left-color: var(--terra); }
.sidenav-menu a .badge { margin-left: auto; }

/* Die Symbole sind als Maske gezeichnet, damit sie die Farbe des Menuepunkts
   annehmen und keine Symbolschrift nachgeladen werden muss. */
.ikon { width: 16px; height: 16px; flex: none; background: currentColor;
  -webkit-mask: center / contain no-repeat; mask: center / contain no-repeat; }
.ikon-grid { -webkit-mask-image: var(--i-grid); mask-image: var(--i-grid); }
.ikon-ordner { -webkit-mask-image: var(--i-ordner); mask-image: var(--i-ordner); }
.ikon-kalender { -webkit-mask-image: var(--i-kalender); mask-image: var(--i-kalender); }
.ikon-posteingang { -webkit-mask-image: var(--i-posteingang); mask-image: var(--i-posteingang); }
.ikon-zahnrad { -webkit-mask-image: var(--i-zahnrad); mask-image: var(--i-zahnrad); }
.ikon-stecker { -webkit-mask-image: var(--i-stecker); mask-image: var(--i-stecker); }
.ikon-box { -webkit-mask-image: var(--i-box); mask-image: var(--i-box); }
.ikon-markt { -webkit-mask-image: var(--i-markt); mask-image: var(--i-markt); }
.ikon-etikett { -webkit-mask-image: var(--i-etikett); mask-image: var(--i-etikett); }
.ikon-stapel { -webkit-mask-image: var(--i-stapel); mask-image: var(--i-stapel); }

.content-page { flex: 1; min-width: 0; margin-left: var(--sidenav-breite); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 15; height: var(--topbar-hoehe); flex: none;
  background: var(--topbar-bg); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 24px; }
.topbar-titel { font-size: 15px; font-weight: 600; color: var(--ink); }
.topbar-rechts { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.benutzer { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--terra-soft); color: var(--terra-ink);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.benutzer-text { display: flex; flex-direction: column; line-height: 1.2; }
.benutzer-text b { font-size: 12px; font-weight: 600; color: var(--ink); }
.benutzer-text small { font-size: 11px; color: var(--ink-3); }
.menu-knopf { display: none; background: none; border: 0; cursor: pointer; padding: 6px; }
.menu-knopf span, .menu-knopf span::before, .menu-knopf span::after {
  display: block; width: 18px; height: 2px; background: var(--ink-2); border-radius: 2px; content: ""; }
.menu-knopf span::before { transform: translateY(-6px); }
.menu-knopf span::after { transform: translateY(4px); }

main { flex: 1; padding: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .aktionen { display: flex; gap: 8px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.125rem; font-weight: 600; }
.grid { display: grid; gap: var(--ins-spacer, 1.25rem); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* Karte im Homer-Schnitt: Kopf mit Trennlinie, Rumpf mit 15/17 px Innenmass.
   Die erste Ueberschrift in der Karte wird von selbst zum Kartenkopf, damit
   jede vorhandene Seite den Aufbau bekommt. */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9375rem 1.0625rem; box-shadow: var(--shadow); }
/* first-of-type statt first-child: in vielen Karten steht davor noch ein
   verstecktes Feld, etwa das CSRF-Feld eines Formulars. */
.card > h2:first-of-type, .card > h3:first-of-type, .card > .spread:has(h3):first-of-type {
  margin: -0.9375rem -1.0625rem 0.9375rem; padding: 0.703125rem 1.0625rem;
  border-bottom: 1px solid var(--line); font-size: 0.9375rem; font-weight: 600; color: var(--ink); }
.card > .spread:has(h3):first-of-type h3 { font-size: 0.9375rem; margin: 0; padding: 0; border: 0; }
/* Weitere Ueberschriften in derselben Karte sind Abschnitte, keine Kartenkoepfe. */
.card > h3:not(:first-of-type) { font-size: 0.8125rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink-3); margin: 1.25rem 0 0.625rem; }
.card + .card { margin-top: var(--ins-spacer, 1.25rem); }
/* Die letzte Handlung in der Verwaltungskarte ist das Loeschen. Eine Linie
   davor trennt sie von den Alltagsaktionen darueber. */
.card.stack > form:has(.btn.gefahr) { border-top: 1px solid var(--line); padding-top: 0.9375rem; }
/* Im Gitter stehen Karten nebeneinander. Der Abstand von oben schoebe die
   zweite Karte jeder Reihe nach unten, sie laegen nicht mehr auf einer Linie. */
.grid > .card + .card, .grid > * > .card:first-child { margin-top: 0; }
.stack > * + * { margin-top: var(--ins-spacer, 1.25rem); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .sidenav { transform: translateX(-100%); transition: transform .2s ease-in-out; }
  body.sidenav-offen .sidenav { transform: none; box-shadow: var(--shadow); }
  .content-page { margin-left: 0; }
  .menu-knopf { display: block; }
  main { padding: 16px; }
}

/* Kennzahlen */
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: block; color: inherit; }
.kpi:hover { text-decoration: none; border-color: var(--line-strong); }
.kpi .wert { font-size: 22px; font-weight: 600; line-height: 1.2; margin-top: 6px; color: var(--ink); }
.kpi .wert.warn { color: var(--warn-ink); }
.kpi .wert.ok { color: var(--ok-ink); }
.kpi .label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }

/* Tabellen */
.tabelle { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: none; }
/* In einer Karte sitzt die Tabelle buendig im Rumpf, sonst steht ein zweiter
   Kasten im Kasten. Homer fuehrt sie randlos bis an die Kartenkanten. */
.card > .tabelle { border: 0; border-radius: 0; margin: 0 -1.0625rem; width: calc(100% + 2.125rem); }
.card > .tabelle:last-child { margin-bottom: -0.9375rem; }
.card > .tabelle th:first-child, .card > .tabelle td:first-child { padding-left: 1.0625rem; }
.card > .tabelle th:last-child, .card > .tabelle td:last-child { padding-right: 1.0625rem; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; padding: 0.75rem 0.6rem; border-bottom: 1px solid var(--line); background: var(--paper-2); white-space: nowrap; }
td { padding: 0.75rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: var(--paper-2); }
tbody tr:last-child td { border-bottom: 0; }
tr:last-child td { border-bottom: none; }
tr.dim td { color: var(--ink-3); }
tr.hervor td { background: var(--gold-soft); }
td.aktion { white-space: nowrap; text-align: right; }
tfoot td { font-weight: 600; background: var(--paper-2); }

/* Tags */
.tag { display: inline-block; font-size: 10.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; padding: 3px 8px; border-radius: var(--radius); background: var(--paper-3); color: var(--ink-2); white-space: nowrap; vertical-align: middle; }
.tag.ok { background: var(--ok-soft); color: var(--ok-ink); }
.tag.warn { background: var(--warn-soft); color: var(--warn-ink); }
.tag.no { background: var(--gefahr-soft); color: var(--gefahr-ink); }
.tag.terra { background: var(--neutral-soft); color: var(--neutral-ink); }
.badge { display: inline-block; min-width: 18px; padding: 1px 6px; border-radius: 999px; background: var(--terra); color: #fff; font-size: 10px; font-weight: 700; text-align: center; }

/* Formulare */
label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 5px; font-weight: 500; }
/* Ausschliessend statt aufzaehlend: viele Felder stehen als <input name="…">
   ohne type in den Vorlagen, eine Aufzaehlung von [type=text] verfehlt sie. */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=submit]):not([type=button]):not([type=hidden]):not([type=range]):not([type=color]), select, textarea {
  width: 100%; font: inherit; font-size: 13px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0.4532rem 0.77rem;
  transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out; }
input:focus, select:focus, textarea:focus {
  outline: 0; border-color: var(--terra); box-shadow: 0 0 0 .15rem rgba(98, 203, 49, .2); }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
select { appearance: none; padding-right: 2rem;
  background-image: var(--i-pfeil); background-repeat: no-repeat;
  background-position: right .7rem center; background-size: 12px; }
textarea { min-height: 120px; resize: vertical; }
input.klein, td input, td select { padding: 0.3125rem 0.5rem; font-size: 12px; }
td input[type=number], td input.num { width: 90px; text-align: right; }
.feld { margin-bottom: 0.9375rem; }
.check { margin-top: 0; }
.felder { display: grid; gap: 0.9375rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; font-weight: 500;
  padding: 0.4532rem 1.1rem; border-radius: var(--radius); border: 1px solid var(--terra);
  background: var(--terra); color: #fff; cursor: pointer; text-decoration: none; line-height: 1.5;
  transition: var(--ins-transition-btn, all .15s ease-in-out); }
.btn:hover { background: var(--terra-ink); border-color: var(--terra-ink); text-decoration: none; color: #fff; }
/* Ein gruener Schein auf einem gruenen Knopf ist keiner. Zwei Ringe:
   ein heller Absatz zur Flaeche, darum die Markierung. */
.btn:focus-visible, a:focus-visible, .nav a:focus-visible, .sidenav-menu a:focus-visible, .tabs a:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 2px; border-radius: var(--radius); }
.btn.sekundaer { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
.btn.sekundaer:hover { background: var(--paper-2); color: var(--ink); border-color: var(--line); }
/* Hauptaktion einer Seite. Fuehrt bewusst dieselbe Farbe wie .btn: in Homer
   gibt es genau eine Primaerfarbe, nicht zwei konkurrierende. */
.btn.terra { background: var(--terra); border-color: var(--terra); color: #fff; }
.btn.klein { padding: 0.3125rem 0.7rem; font-size: 12px; }
.btn.gefahr { background: transparent; color: var(--wine); border-color: var(--wine); }
.btn.gefahr:hover { background: var(--wine); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); }
.check input { width: auto; }

/* Hinweise */
.flash { padding: 0.8rem 1rem; font-size: 13px; border-radius: var(--radius); margin-bottom: 1.25rem; border: 1px solid var(--line); background: var(--surface); }
.flash.ok { border-color: var(--ok); background: var(--ok-soft); color: var(--ok-ink); }
.flash.fehler { border-color: var(--gefahr); background: var(--gefahr-soft); color: var(--gefahr-ink); }
.note { border-left: 3px solid var(--gold); background: var(--gold-soft); padding: 0.8rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; font-size: 12px; color: var(--ink-2); }
.note.no { border-color: var(--gefahr); }
.note.ok { border-color: var(--ok); }
.warnleiste { background: var(--gefahr-soft); color: var(--gefahr-ink); padding: 0.55rem 24px; font-size: 12px; border-bottom: 1px solid var(--line); }

/* Faktenliste, Reiter, Statuskette */
.fakten { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 18px; margin-top: 12px; }
.fakten div b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 500; }
.fakten div span { font-size: 13px; color: var(--ink); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 1.25rem; flex-wrap: wrap; }
.tabs a { padding: 0.6rem 0.9rem; font-size: 13px; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.aktiv { color: var(--terra-ink); border-bottom-color: var(--terra); }
.status-kette { display: flex; gap: 4px; flex-wrap: wrap; font-size: 11px; font-weight: 600; }
.status-kette span { padding: 2px 8px; border-radius: 2px; background: var(--paper-3); color: var(--ink-3); }
.status-kette span.aktiv { background: var(--terra); color: #fff; }
.status-kette span { background: var(--paper-3); color: var(--ink-2); }
.status-kette span.erledigt { background: var(--ok-soft); color: var(--ok-ink); }

/* Diverse */
pre.kopie { background: var(--paper-2); border: 1px solid var(--line); padding: 12px; overflow-x: auto; font-size: 12.5px; }
details summary { cursor: pointer; color: var(--ink-2); font-weight: 500; }
.login-wrap { max-width: 420px; margin: 8vh auto 0; }
.login-wrap .brand { font-size: 26px; font-weight: 700; color: var(--ink); display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.login-wrap .brand small { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--terra); font-weight: 600; }
.leer { padding: 24px; text-align: center; color: var(--ink-3); }
.abw { color: var(--gefahr-ink); font-weight: 600; }
@media (max-width: 640px) { main { padding-inline: 16px; } .page-head { flex-direction: column; align-items: flex-start; } h1 { font-size: 28px; } }
@media print { .top, .tabs, .btn, form, .flash { display: none !important; } main { max-width: none; } }
