:root {
  --ww-red: #e30813;
  --ww-red-dark: #b4060f;
  --ww-red-soft: #fde8e9;
  --ww-green: #007830;
  --ww-green-dark: #005c26;
  --ww-green-soft: #e5f6ec;
  --ww-ink: #1b2433;
  --ww-heading: #222833;
  --ww-muted: #62718d;
  --ww-line: #e4e8ef;
  --ww-bg: #f4f6fa;
  --ww-white: #fff;
  --ww-shadow: 0 12px 40px rgba(27, 36, 51, 0.08);
  --ww-radius: 10px;
  --font-head: "Fira Sans", "Avenir Next", sans-serif;
  --font-body: "Nunito Sans", "Avenir Next", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ww-ink);
  background: var(--ww-bg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}
a { color: var(--ww-red); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #fff;
  border-bottom: 1px solid var(--ww-line);
  box-shadow: 0 6px 24px rgba(27, 36, 51, 0.06);
}
.header-stripe, .app-footer .stripe {
  height: 6px;
  background: linear-gradient(90deg, var(--ww-red) 0 50%, var(--ww-green) 50% 100%);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 12px 22px;
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand img { height: 42px; width: auto; }
.brand-text small {
  display: block;
  color: var(--ww-muted);
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.brand-text strong {
  display: block;
  font-family: var(--font-head);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ww-heading);
}
body.hat-menu { flex-direction: row; align-items: stretch; }
.seite {
  width: 232px;
  flex: none;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 40;
  height: 100vh;
  background: #1b2433;
  color: #e7edf5;
  display: flex;
  flex-direction: column;
  overflow: auto;
  transform: translateX(0);
  transition: transform 0.18s ease;
}
body.hat-menu .spalte { margin-left: 232px; transition: margin-left 0.18s ease; }
body.menu-zu .seite { width: 76px; transform: none; }
body.menu-zu .spalte { margin-left: 76px; }
body.menu-zu .brand-text,
body.menu-zu .nav-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
body.menu-zu .seite .brand { justify-content: center; padding-left: 10px; padding-right: 10px; }
body.menu-zu .mainnav a,
body.menu-zu .who,
body.menu-zu .btn-quiet { justify-content: center; gap: 0; padding-left: 0; padding-right: 0; }
body.menu-zu .yearbox { align-items: center; padding-left: 8px; padding-right: 8px; }
body.menu-zu .menu-knopf { left: 60px; }
.menu-knopf {
  position: fixed;
  top: 18px;
  left: 214px;
  z-index: 50;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--ww-line);
  background: #fff;
  box-shadow: 0 4px 14px rgba(27, 36, 51, 0.12);
  transition: left 0.18s ease;
}
.menu-knopf::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  margin: 0 auto;
  border-left: 2px solid var(--ww-ink);
  border-bottom: 2px solid var(--ww-ink);
  transform: rotate(45deg) translate(1px, -1px);
}
body.menu-zu .menu-knopf::before { transform: rotate(-135deg) translate(1px, -1px); }
.seite .header-stripe { height: 4px; flex: none; }
.seite .brand { padding: 18px 18px 6px; align-items: flex-start; }
.seite .brand img { height: 34px; background: #fff; border-radius: 8px; padding: 4px 6px; }
.seite .brand-text small { color: #93a0b5; }
.seite .brand-text strong { color: #fff; font-size: 16px; }
.mainnav { display: flex; flex-direction: column; gap: 2px; padding: 12px; }
.nav-gruppe {
  margin: 14px 8px 4px;
  color: #93a0b5;
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.nav-gruppe-eingabe { color: #8fd0a8; }
.nav-eingabe { color: #d7ffe6; }
.mainnav a.nav-eingabe.active { color: var(--ww-green-dark); }
body.menu-zu .nav-gruppe { display: none; }
body.ist-eingabe .pagehead { border-left: 4px solid var(--ww-green); padding-left: 14px; }
body.ist-anzeige .pagehead { border-left: 4px solid transparent; }
.anlage-felder {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}
.anlage-felder label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ww-muted); }
.anlage-felder input {
  width: 100%;
  border: 1px solid var(--ww-line);
  border-radius: 8px;
  padding: 8px 10px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  background: #fff;
}
.anlage-notiz input { text-align: left; }
.anlage-felder em { font-style: normal; color: var(--ww-green-dark); }
.maske-speichern { position: sticky; top: 0; z-index: 5; background: var(--ww-bg); padding: 8px 0; }
.btn-klein { display: inline-block; padding: 6px 10px; font-size: 13px; text-decoration: none; }
.btn-klein:hover { text-decoration: none; }
.nav-ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mainnav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #d7e0ec;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 14.5px;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
}
.mainnav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.mainnav a.active { color: var(--ww-red); background: #fff; box-shadow: none; }
.yearbox {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-top: auto;
  padding: 12px;
}
.spalte { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.ypills { display: flex; flex-wrap: wrap; background: var(--ww-bg); border-radius: 12px; padding: 3px; }
.ypills a {
  color: var(--ww-heading);
  font-family: var(--font-head);
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 999px;
  text-decoration: none;
}
.ypills a.on { background: var(--ww-red); color: #fff; }
.who {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-head);
  font-weight: 650;
  color: #fff;
  text-decoration: none;
  padding: 4px 8px;
}
.seite .btn-quiet {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: auto;
  align-self: flex-start;
  background: transparent;
  color: #c5d0de;
  border-color: rgba(255, 255, 255, 0.18);
}
.btn-quiet {
  background: #fff;
  color: var(--ww-heading);
  border: 1px solid var(--ww-line);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: var(--font-head);
  font-weight: 700;
}
.login { max-width: 460px; margin: 24px auto; }
.login-card .field.solo { grid-template-columns: 1fr; }
.login-card input { text-align: left; }
.people-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.einstellungen-form { grid-template-columns: minmax(140px, 220px) auto; max-width: 420px; }
.people-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ww-muted); min-width: 160px; flex: 1; }
.people-form input, .people-form select {
  border: 1px solid var(--ww-line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}
.people-form .check { flex-direction: row; align-items: center; gap: 8px; color: var(--ww-ink); }
.card.narrow { max-width: 520px; }
.adminnav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.adminnav a {
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--ww-muted);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 6px 0;
  margin-right: 18px;
  text-decoration: none;
}
.adminnav a.on { background: transparent; color: var(--ww-red); border-bottom-color: var(--ww-red); }
.admintiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.tile {
  display: block;
  background: #fff;
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: var(--ww-shadow);
  color: inherit;
  text-decoration: none;
}
.tile:hover { text-decoration: none; outline: 2px solid var(--ww-red); }
.tile span { display: block; color: var(--ww-muted); font-family: var(--font-head); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.tile b { display: block; margin-top: 6px; font-family: var(--font-head); font-size: 32px; font-weight: 800; letter-spacing: -0.03em; }
.tile small { display: block; margin-top: 4px; color: var(--ww-muted); }
.iban-form { display: flex; gap: 8px; align-items: center; }
.iban-form input { flex: 1; border: 1px solid var(--ww-line); border-radius: 10px; padding: 8px 10px; min-width: 220px; font-variant-numeric: tabular-nums; }
.yearbox form { width: 100%; }
.btn-year, .btn {
  background: var(--ww-green);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font-family: var(--font-head);
  font-weight: 700;
}
.btn-year:hover, .btn:hover { background: var(--ww-green-dark); }
.btn { background: var(--ww-red); border-radius: 10px; padding: 12px 18px; }
.btn:hover { background: var(--ww-red-dark); }

.main { flex: 1; width: 100%; padding: 28px 32px 40px; }
.pagehead { margin-bottom: 16px; }
.kicker {
  margin: 0 0 4px;
  color: var(--ww-red);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
h1, h2 { font-family: var(--font-head); color: var(--ww-heading); letter-spacing: -0.03em; }
h1 { margin: 0; font-size: 30px; font-weight: 750; line-height: 1.1; }
h2 { margin: 0; font-size: 18px; font-weight: 700; }
.lead, .quiet, .meta { color: var(--ww-muted); }
.lead { max-width: 78ch; margin-top: 8px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; }
.meta span { background: #fff; border: 1px solid var(--ww-line); border-radius: 999px; padding: 4px 10px; }
.note {
  background: #fff6f6;
  border-left: 4px solid var(--ww-red);
  padding: 10px 14px;
  border-radius: 0 10px 10px 0;
}
.flash {
  background: var(--ww-green);
  color: #fff;
  padding: 12px 14px;
  border-radius: 10px;
  margin: 0 0 16px;
  font-family: var(--font-head);
  font-weight: 700;
}

.firms, .months, .tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.chip, .months a, .tabs a {
  border-radius: 999px;
  padding: 7px 12px;
  background: #fff;
  border: 1px solid var(--ww-line);
  color: var(--ww-heading);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
}
.chip.on, .months a.on, .tabs a.on { background: var(--ww-red); color: #fff; border-color: var(--ww-red); }
.months a.has { box-shadow: inset 0 -2px 0 var(--ww-green); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 8px 0 16px; }
.kpi {
  background: #fff;
  border: 1px solid var(--ww-line);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: none;
}
.kpi span {
  display: block;
  color: var(--ww-muted);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.kpi b {
  display: block;
  margin-top: 6px;
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.kpi small { display: block; margin-top: 4px; color: var(--ww-muted); }

.card {
  background: #fff;
  border: 1px solid var(--ww-line);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: none;
  margin: 14px 0;
}
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--ww-line); stroke-width: 1; }
.chart .tick { fill: var(--ww-muted); font-size: 11px; font-family: var(--font-body); }
.legend { display: flex; gap: 14px; color: var(--ww-muted); font-size: 13px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 99px; margin-right: 6px; }
.swatch.green, .swatch.teal { background: var(--ww-green); }
.swatch.red, .swatch.copper { background: var(--ww-red); }
.swatch.mute { background: #8aa0a8; }

.split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.8fr); gap: 14px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack .card { margin: 0; }
.scroller { overflow: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px 10px; text-align: left; vertical-align: baseline; border-bottom: 1px solid var(--ww-line); }
th {
  color: var(--ww-muted);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td small, .num small { display: block; color: var(--ww-muted); font-size: 12px; }
.grid tbody tr:hover { background: #f7f9fc; }
.sum { font-weight: 800; }
.note-cell { color: var(--ww-muted); font-size: 13px; max-width: 280px; }

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  font-family: var(--font-head);
  font-weight: 700;
}
a.pill:hover { text-decoration: none; }
.tone-ok { background: var(--ww-green-soft); color: var(--ww-green-dark); }
.tone-warn { background: #fff3d6; color: #9a6708; }
.tone-bad { background: var(--ww-red-soft); color: var(--ww-red-dark); }
.tone-none { background: #eef2f6; color: var(--ww-muted); }
.tone-text.tone-ok { background: none; color: var(--ww-green); }
.tone-text.tone-warn { background: none; color: #9a6708; }
.tone-text.tone-bad { background: none; color: var(--ww-red); }
.tone-text.tone-none { background: none; }

.firm {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-family: var(--font-head);
  font-weight: 700;
  background: var(--ww-green-soft);
  color: var(--ww-green-dark);
}
.f-smr { background: #e5eef8; color: #1d4e89; }
.f-mrm { background: #f8efd8; color: #8a5a00; }
.f-mmr { background: #f6e8f1; color: #7a3e6d; }
.f-roto { background: var(--ww-red-soft); color: var(--ww-red-dark); }

.list { list-style: none; margin: 8px 0 0; padding: 0; }
.list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--ww-line);
}
.foot { margin-top: 8px; font-size: 13px; }
.inline { display: inline; }
.search {
  border: 1px solid var(--ww-line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  min-width: 180px;
}
.textlink {
  font-family: var(--font-head);
  font-weight: 700;
  background: none;
  border: 0;
  padding: 0;
  color: var(--ww-red);
}

.heat { min-width: 860px; }
.heat th, .heat td { text-align: center; padding: 0; }
.heat th:first-child, .heat tbody th {
  text-align: left;
  padding: 6px 8px;
  position: sticky;
  left: 0;
  background: #fff;
}
.heat td a {
  display: block;
  padding: 8px 4px;
  color: var(--ww-heading);
  text-decoration: none;
  background: rgba(0, 120, 48, calc(var(--shade) * 0.85));
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
}
.heat td.neg a { background: var(--ww-red-soft); color: var(--ww-red-dark); }
.heat td a:hover { outline: 2px solid var(--ww-red); outline-offset: -2px; }

.matrix { min-width: 1100px; }
.matrix th:first-child, .matrix tbody th {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  font-size: 14.5px;
  color: var(--ww-heading);
}
.matrix td.num { font-size: 13.5px; }

.sheet { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.field {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(140px, 0.8fr) 120px;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--ww-line);
}
.field span { display: flex; flex-direction: column; }
.field small, .field em { color: var(--ww-muted); font-style: normal; font-size: 12.5px; }
.field input, .field textarea {
  width: 100%;
  border: 1px solid var(--ww-line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
}
.field input[inputmode="decimal"] {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.field textarea { text-align: left; }
.field input[type="password"],
.field input[type="text"],
.login-card input,
.people-form input {
  text-align: left;
}
.field input:focus, .field textarea:focus, .search:focus {
  outline: 2px solid rgba(227, 8, 19, 0.25);
  border-color: var(--ww-red);
}
.zaehler-edit, .verbrauch-fest { display: flex; flex-direction: column; gap: 2px; }
.zaehler-edit em, .verbrauch-fest em {
  font-style: normal;
  font-family: var(--font-head);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ww-muted);
}
.zaehler-edit input { width: 100%; }
.verbrauch-fest {
  align-items: flex-end;
  justify-content: center;
  min-height: 52px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px dashed #b7c3d4;
  background: #eef2f6;
  cursor: not-allowed;
}
.live { text-align: right; font-variant-numeric: tabular-nums; color: var(--ww-green); font-family: var(--font-head); font-weight: 700; }
.live.down { color: var(--ww-red); }
.ist-nein { display: none; }
.show-all .ist-nein { display: grid; }
.upload {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  border: 1px dashed var(--ww-red);
  background: #fff8f8;
  border-radius: 14px;
  padding: 16px;
}
.upload input[type="file"] { max-width: 100%; }
.kind-einzahlung { color: var(--ww-green-dark); font-weight: 800; }
.kind-spesen { color: #9a6708; font-weight: 800; }
.kind-sonst { color: var(--ww-muted); }
.actions { margin: 8px 0 24px; }
.receipt {
  position: sticky;
  top: 18px;
  background: var(--ww-heading);
  color: #fff;
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--ww-shadow);
}
.receipt .kicker { color: #ffb3b8; }
.receipt h2 { color: #fff; }
.receipt ul { list-style: none; margin: 12px 0; padding: 0; }
.receipt li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; color: #d5deea; font-size: 14px; }
.receipt dl { margin: 8px 0; }
.receipt dl div { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; }
.receipt .sum { border-top: 1px solid rgba(255, 255, 255, 0.2); margin-top: 6px; padding-top: 8px; font-family: var(--font-head); font-size: 22px; font-weight: 800; }
.receipt .formula, .receipt .quiet { color: #b7c3d4; font-size: 13px; }
.equips { display: flex; flex-wrap: wrap; gap: 8px; }
.equip { background: var(--ww-green-soft); color: var(--ww-green-dark); border-radius: 999px; padding: 6px 10px; font-size: 13.5px; }
.equip.st-ausser { background: #fff3d6; color: #9a6708; }
.equip.st-fremd { background: #eee8f8; color: #5b3f86; }

.app-footer { margin-top: auto; background: transparent; }
.vs-love {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  margin: 0;
  padding: 8px 28px 18px;
  color: var(--ww-muted);
  font-size: 13px;
}
.vs-love .heart { color: var(--ww-red); }
.vs-love img { height: 22px; width: auto; background: #fff; border-radius: 6px; padding: 3px 8px; }

@media (max-width: 1100px) {
  .kpis, .split, .sheet { grid-template-columns: 1fr; }
  h1 { font-size: 32px; }
  .receipt { position: static; }
}
@media (max-width: 860px) {
  body.hat-menu .spalte,
  body.menu-zu .spalte { margin-left: 0; }
  body.hat-menu .seite,
  body.menu-zu .seite { width: 232px; transform: translateX(-100%); }
  body.hat-menu.menu-offen .seite { transform: none; }
  body.menu-zu .nav-text,
  body.menu-zu .brand-text { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  body.menu-zu .mainnav a,
  body.menu-zu .who,
  body.menu-zu .btn-quiet { justify-content: flex-start; gap: 10px; padding-left: 12px; padding-right: 12px; }
}
.menu-grund {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 35;
  border: 0;
  background: rgba(27, 36, 51, 0.35);
}
body.menu-offen .menu-grund { display: block; }
