/* Antragsregister — Designsystem „Kontoblatt".
   Ein modernes Ledger: kühles Papier, Bockler-Rot nur als präziser Akzent,
   Beträge in Tabellenziffern, Vertragsnummern in Mono, Status als Stempel.
   Signatur: der rote Registerrücken an den Kennzahl-Karten und der doppelte
   Summenstrich unter Tabellensummen — wie im Kontobuch. */

:root {
  --accent: #e2001a;
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #171a20;
  --muted: #66708a;
  --line: #e6e9ef;
  --line-stark: #cdd3de;
  --gut: #157f3d;
  --gut-hell: #e9f5ee;
  --warn: #9a6300;
  --warn-hell: #fdf3d9;
  --gefahr: #b3261e;
  --gefahr-hell: #fdecea;
  --info-hell: #eef2f9;
  --radius: 14px;
  --radius-klein: 8px;
  --schatten: 0 1px 2px rgba(23, 26, 32, .05), 0 10px 28px -16px rgba(23, 26, 32, .18);
  --schrift: "Avenir Next", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --schrift-mono: "SF Mono", ui-monospace, "Cascadia Code", "Segoe UI Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--schrift);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  min-height: 100dvh;
}

/* ------------------------------------------------------------- Typografie */

h1 {
  margin: 0 0 4px;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -.02em;
}

h2 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 640;
  letter-spacing: -.01em;
}

.eyebrow {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 620;
  text-transform: uppercase;
  letter-spacing: .13em;
  color: var(--muted);
}

.muted { color: var(--muted); }
.klein { font-size: 13px; }
.nowrap { white-space: nowrap; }
.rechts { text-align: right; }

.zahl { font-variant-numeric: tabular-nums lining-nums; }

.vnr {
  display: block;
  font-family: var(--schrift-mono);
  font-size: 11.5px;
  letter-spacing: .02em;
  color: var(--muted);
  margin-top: 1px;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ----------------------------------------------------------------- Gerüst */

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 28px 20px 96px;
}

.container-bare {
  max-width: 480px;
  padding-top: 8vh;
}

.seitenkopf {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 4px 0 22px;
}

/* ----------------------------------------------------------------- Topbar */

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  font-family: Georgia, "Times New Roman", serif;
}

.brand-mark-lg { width: 52px; height: 52px; border-radius: 14px; font-size: 26px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; letter-spacing: -.01em; }
.brand-text small { font-size: 11px; color: var(--muted); }

.mainnav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
  flex: 1;
  min-width: 0;
}

.mainnav a {
  padding: 7px 11px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 520;
  color: var(--muted);
  white-space: nowrap;
  transition: color .15s ease, background .15s ease;
}

.mainnav a:hover { color: var(--ink); background: var(--bg); }

.mainnav a.active {
  color: var(--ink);
  background: var(--bg);
  font-weight: 640;
  box-shadow: inset 0 -2px 0 var(--accent);
}

.cockpit-link { border: 1px solid var(--line); }

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.topbar-right { display: flex; align-items: center; gap: 14px; }
.userbox { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.username { font-size: 13.5px; font-weight: 620; text-decoration: none; }

.linklike {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.linklike:hover { color: var(--accent); }

/* ------------------------------------------------------- Tabbar (Handy) */

.tabbar {
  display: none;
  position: fixed;
  inset: auto 0 0 0;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 4px 6px calc(6px + env(safe-area-inset-bottom));
  z-index: 40;
}

.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 2px;
  text-decoration: none;
  color: var(--muted);
  font-size: 10.5px;
  border-radius: var(--radius-klein);
}

.tabbar a.active { color: var(--accent); font-weight: 640; }
.tab-icon { font-size: 17px; line-height: 1.1; position: relative; }
.tab-punkt {
  position: absolute;
  top: -1px; right: -7px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.tab-neu .tab-icon {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
}

/* ----------------------------------------------------------------- Karten */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 20px 22px;
  margin: 0 0 18px;
}

.card-tabelle { padding: 8px 0 0; overflow: hidden; }
.card-tabelle .card-kopf { padding: 10px 22px 4px; }

.card-kopf {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.card-kopf h2 { margin: 0; }
.mehr { font-size: 13px; font-weight: 560; color: var(--muted); text-decoration: none; }
.mehr:hover { color: var(--accent); }

.form-card { max-width: 720px; }

/* ------------------------------------------- Kennzahlen mit Registerrücken */

.kpi-reihe {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 14px;
  margin: 0 0 18px;
}

.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 16px 18px 14px 22px;
  text-decoration: none;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}

a.kpi:hover {
  color: inherit;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(23, 26, 32, .06), 0 14px 32px -16px rgba(23, 26, 32, .24);
}

/* der Registerrücken */
.kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--accent);
}

.kpi-warn::before { background: var(--warn); }
.kpi-gut::before { background: var(--gut); }

.kpi-label {
  font-size: 11px;
  font-weight: 620;
  text-transform: uppercase;
  letter-spacing: .11em;
  color: var(--muted);
}

.kpi-wert {
  font-size: 27px;
  font-weight: 660;
  letter-spacing: -.02em;
  line-height: 1.15;
}

.kpi-sub { font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------------- Tabellen */

.tabelle-wrap { overflow-x: auto; }

.tabelle {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.tabelle th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 640;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--line-stark);
  white-space: nowrap;
}
.tabelle th.rechts { text-align: right; }

.tabelle td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.tabelle tbody tr { transition: background .12s ease; }
.tabelle tbody tr:hover { background: var(--bg); }
.tabelle tr.storniert td { opacity: .45; text-decoration: line-through; }
.tabelle tr.inaktiv td { opacity: .55; }

/* der doppelte Summenstrich — Erbe des Kontobuchs */
.tabelle tfoot td {
  border-top: 1px solid var(--line-stark);
  border-bottom: 3px double var(--ink);
  font-size: 13px;
  color: var(--muted);
  padding: 9px 12px;
}
.tabelle tfoot strong { color: var(--ink); }

.tabelle-matrix td.zelle-leer { color: var(--line-stark); }

.zeilenlink { text-decoration: none; }
.zeilenlink:hover strong { color: var(--accent); }

.mini-tag {
  display: inline-block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--accent);
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 0 5px;
}

.tage-offen { font-weight: 650; font-variant-numeric: tabular-nums; color: var(--warn); white-space: nowrap; }
.tage-kritisch { color: var(--gefahr); }

/* ----------------------------------------------------------------- Stempel */

.stempel {
  display: inline-block;
  font-size: 10px;
  font-weight: 680;
  text-transform: uppercase;
  letter-spacing: .09em;
  padding: 2px 8px;
  border: 1.5px solid currentColor;
  border-radius: 5px;
  white-space: nowrap;
}

.stempel-gut { color: var(--gut); background: var(--gut-hell); }
.stempel-warn { color: var(--warn); background: var(--warn-hell); }
.stempel-wartend { color: var(--muted); background: var(--bg); border-style: dashed; }
.stempel-neutral { color: var(--muted); background: var(--card); }

.stempel-gruppe { display: flex; gap: 6px; align-items: center; }

.stempel-knopf {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
}
.stempel-knopf:hover .stempel { transform: rotate(-2deg) scale(1.05); }
.stempel-knopf .stempel { transition: transform .12s ease; }

/* ---------------------------------------------------------------- Buttons */

.btn {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--line-stark);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 580;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
}

.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn:active { transform: translateY(1px); }

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-accent:hover { filter: brightness(.92); color: #fff; border-color: var(--accent); }

.btn-still { border-color: transparent; background: none; color: var(--muted); }
.btn-still:hover { color: var(--ink); border-color: var(--line-stark); }

.btn-klein { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-gefahr { color: var(--gefahr); border-color: var(--gefahr-hell); }
.btn-gefahr:hover { border-color: var(--gefahr); color: var(--gefahr); }
.btn-neu { padding: 7px 13px; font-size: 13px; }

/* -------------------------------------------------------------- Formulare */

fieldset {
  border: 0;
  padding: 0 0 6px;
  margin: 0 0 14px;
}

legend {
  font-size: 11px;
  font-weight: 640;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line);
  width: 100%;
  margin-bottom: 14px;
}

.field { display: block; margin: 0 0 14px; }
.field > span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
}

.field-hint { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); margin-top: 5px; }

input[type="text"], input[type="password"], input[type="email"], input[type="url"],
input[type="number"], input[type="date"], input[type="month"], input[type="time"],
input[type="search"], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-stark);
  border-radius: 10px;
  background: var(--card);
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}

input.mono { font-family: var(--schrift-mono); font-size: 14px; letter-spacing: .03em; }
input[type="color"] { padding: 3px; height: 42px; width: 64px; }
textarea { resize: vertical; }

.feldpaar { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; align-items: start; }
.felddrei { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; align-items: start; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0 0 10px;
  font-size: 14px;
  cursor: pointer;
}
.check input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.check-klein { font-size: 12.5px; color: var(--muted); }
.check-spalte { padding-top: 24px; }

.aktionsleiste {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 6px;
}

.provisions-vorschau {
  margin: -4px 0 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--info-hell);
  font-size: 14px;
}
.provisions-vorschau strong { font-size: 16px; }
.provisions-vorschau small { display: block; margin-top: 1px; }

.inline-form { display: inline; }

.status-zeilen { display: flex; flex-direction: column; }
.status-zeile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.status-zeile:last-of-type { border-bottom: 0; }
.status-zeile > span { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* ----------------------------------------------------------- Filterleiste */

.filterleiste {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.filterleiste input, .filterleiste select {
  width: auto;
  min-width: 0;
  padding: 7px 10px;
  font-size: 13.5px;
}
.filterleiste input[type="search"] { flex: 1; min-width: 180px; }

/* --------------------------------------------------- Balken (Forecast-Chart) */

.balken-reihe {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 8px 2px 0;
}

.balken-spalte {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.balken {
  width: 100%;
  max-width: 64px;
  height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: 7px 7px 3px 3px;
  background: var(--bg);
  overflow: hidden;
}

.balken-reihe-gross { overflow-x: auto; padding-bottom: 8px; }
.balken-reihe-gross .balken-spalte { flex: 1 0 56px; }
.balken-reihe-gross .balken { height: 160px; }

.balken-offen { background: color-mix(in srgb, var(--accent) 82%, white); min-height: 0; }
.balken-erhalten { background: var(--gut); min-height: 0; }

.balken-aktuell .balken { box-shadow: inset 0 0 0 2px var(--ink); }
.balken-aktuell .balken-monat { font-weight: 680; color: var(--ink); }

.balken-wert { font-size: 11px; color: var(--muted); white-space: nowrap; }
.balken-monat { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.legende {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}
.punkt { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.punkt-erhalten { background: var(--gut); }
.punkt-offen { background: color-mix(in srgb, var(--accent) 82%, white); margin-left: 10px; }

/* --------------------------------------------------- Hinweise, Flash, Leere */

.flash, .hinweis {
  padding: 11px 15px;
  border-radius: 10px;
  margin: 0 0 14px;
  font-size: 14px;
  border: 1px solid transparent;
}

.flash-ok { background: var(--gut-hell); color: var(--gut); border-color: color-mix(in srgb, var(--gut) 25%, white); }
.flash-fehler { background: var(--gefahr-hell); color: var(--gefahr); border-color: color-mix(in srgb, var(--gefahr) 25%, white); }

.hinweis-warn { background: var(--warn-hell); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, white); }
.hinweis-info { background: var(--info-hell); color: var(--ink); border-color: var(--line); }

.leer { color: var(--muted); margin: 4px 0; }
.leer-gross { text-align: center; padding: 34px 20px 30px; }
.leer-titel { font-size: 16px; font-weight: 640; color: var(--ink); margin: 0 0 4px; }
.leer-gross .btn { margin-top: 12px; }

/* ----------------------------------------------------------------- Diverses */

.unternav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}

.unternav a {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  text-decoration: none;
  font-size: 13px;
  font-weight: 560;
  color: var(--muted);
}
.unternav a:hover { color: var(--ink); border-color: var(--line-stark); }
.unternav a.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.jahr-nav { display: flex; gap: 8px; }

.code {
  display: block;
  font-family: var(--schrift-mono);
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  margin: 6px 0 12px;
  word-break: break-all;
}

.sparten-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.sparten-kopf h2 { margin: 0; }
.sparten-karte.inaktiv, .mitarbeiter-karte.inaktiv { opacity: .6; }

.art-zeile {
  display: grid;
  grid-template-columns: 1fr 180px auto auto;
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.art-zeile:last-of-type { border-bottom: 0; }
.art-zeile.inaktiv input[type="text"] { color: var(--muted); }
.art-zeile .check { margin: 0; }
.art-zeile-neu { border-top: 1px solid var(--line-stark); margin-top: 4px; padding-top: 12px; }

.wettbewerb-liste { list-style: none; margin: 8px 0 16px; padding: 0; }
.wettbewerb-liste li {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.wettbewerb-liste li:last-child { border-bottom: 0; }
.wettbewerb-name { font-weight: 620; }
.wettbewerb-name::before { content: "✓"; color: var(--gut); font-weight: 700; margin-right: 8px; }

.anleitung { margin: 6px 0 18px; padding-left: 20px; }
.anleitung li { margin-bottom: 5px; }

/* ------------------------------------------------------------------- Login */

.login-wrap { display: flex; justify-content: center; }

.login-card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--schatten);
  padding: 34px 32px 28px;
  border-top: 4px solid var(--accent);
}

.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand h1 { font-size: 21px; margin-top: 12px; }
.login-brand .muted { margin: 2px 0 0; font-size: 13px; }
.login-logo { max-width: 200px; max-height: 64px; }

.codes { column-count: 2; font-family: var(--schrift-mono); font-size: 16px; }

/* -------------------------------------------------------------- Responsive */

@media (max-width: 860px) {
  .mainnav, .userbox, .btn-neu { display: none; }
  .topbar-inner { min-height: 54px; justify-content: space-between; }
  .tabbar { display: flex; }
  .container { padding: 18px 14px 96px; }
  h1 { font-size: 22px; }
  .card { padding: 16px; }
  .feldpaar, .felddrei { grid-template-columns: 1fr; }
  .check-spalte { padding-top: 0; }
  .kpi-reihe { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-wert { font-size: 22px; }
  .balken-reihe { gap: 5px; }
  .balken-wert { display: none; }
  .art-zeile { grid-template-columns: 1fr; }
  .status-zeile { align-items: flex-start; flex-direction: column; gap: 8px; }
}

@media (max-width: 400px) {
  .kpi-reihe { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- Bewegung */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------------------- Druck */

@media print {
  body { background: #fff; }
  .topbar, .tabbar, .filterleiste, .btn, .aktionsleiste, .mehr, .unternav { display: none !important; }
  .card, .kpi { box-shadow: none; border-color: #bbb; break-inside: avoid; }
  .container { padding: 0; max-width: none; }
  a { text-decoration: none; color: inherit; }
}
