:root {
  --rot: #c8102e;
  --rot-hover: #a80c26;
  --rot-soft: rgba(200, 16, 46, 0.1);
  --surface: #ffffff;
  --surface-subtle: #f5f5f7;
  --text-main: #1d1d1f;
  --text-muted: #55555c;
  --background-color-grey: #e3e3e3;
  --border-hairline: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.18);
  --checkbox-off: #ffe066;
  --checkbox-on: #d1e7dd;
  --feld-hellrot: #fde2e4;
  --feld-hellrot-text: #5c0b16;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.045);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.075);
  --shadow-lg: 0 20px 44px rgba(0, 0, 0, 0.12);
  --ease-apple: cubic-bezier(0.25, 0.1, 0.25, 1);

  --bs-body-font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bs-body-font-size: 1rem;
  --bs-body-bg: #f5f5f7;
  --bs-body-color: #1d1d1f;
  --bs-tertiary-bg: #f5f5f7;
  --bs-border-radius: 10px;
  --bs-border-radius-lg: 18px;
}

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

html {
  font-size: 16px;
}

body,
body.bg-body-tertiary {
  margin: 0;
  font-family: var(--bs-body-font-family);
  font-size: 1rem;
  color: var(--text-main);
  background-color: var(--background-color-grey) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.55;
}

/* Seiteninhalt mittig mit gleichmäßigem Außenabstand links und rechts */
main.container {
  max-width: 1000px;
  margin-inline: auto;
  padding-block: 1.5rem 2.5rem;
  padding-inline: clamp(1rem, 4vw, 3rem) !important;
}

/* Hauptmenü */
.topnav {
  position: sticky;
  top: 0;
  z-index: 900;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  padding-block: 0.5rem;
  padding-inline: clamp(1rem, 4vw, 3.5rem);
  background: rgba(200, 16, 46, 0.94);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--shadow-sm);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.topnav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.topnav > ul:last-of-type {
  margin-left: auto;
}

.topnav form {
  margin: 0;
}

.topnav a,
.topnav button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.62rem 0.95rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #fff;
  font: inherit;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s var(--ease-apple), color 0.2s var(--ease-apple), transform 0.15s var(--ease-apple);
}

.topnav a:hover,
.topnav a:focus-visible,
.topnav button:hover,
.topnav button:focus-visible {
  background: #fff;
  color: var(--rot);
  outline: none;
}

.topnav a:active,
.topnav button:active {
  transform: scale(0.98);
}

.topnav a[aria-current="page"],
.topnav a[aria-current="true"] {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  box-shadow: inset 0 0px 0 #fff;
}

/* Untermenü: rollt beim Überfahren und bei Tastaturfokus weich aus */
.topnav li {
  position: relative;
}

.topnav .submenu {
  display: block;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 13rem;
  padding: 0.45rem;
  border-radius: var(--radius-md);
  z-index: 1000;
  background: var(--rot);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--shadow-md);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  visibility: hidden;
  transform: translateY(-4px);
  transition:
    max-height 0.28s var(--ease-apple),
    opacity 0.2s var(--ease-apple),
    transform 0.22s var(--ease-apple),
    visibility 0s linear 0.28s;
}

.topnav li:hover > .submenu,
.topnav li:focus-within > .submenu {
  max-height: 22rem;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition:
    max-height 0.28s var(--ease-apple),
    opacity 0.2s var(--ease-apple),
    transform 0.22s var(--ease-apple),
    visibility 0s;
}

.topnav .submenu a {
  display: flex;
  width: 100%;
  border-radius: 6px;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .topnav a,
  .topnav button,
  .topnav .submenu,
  .topnav li:hover > .submenu,
  .topnav li:focus-within > .submenu {
    transition: none;
    transform: none;
  }
}

/* Seiten- & Tool-Überschriften */
.page-title,
h1,
h2,
h3 {
  font-family: var(--bs-body-font-family);
  color: var(--text-main);
  letter-spacing: -0.025em;
}

.page-title {
  overflow-wrap: anywhere;
  hyphens: auto;
  margin: 0 0 1.4rem;
  font-size: clamp(2rem, 3.2vw, 2.85rem);
  font-weight: 700;
  line-height: 1.1;
}

.tool-title {
  overflow-wrap: anywhere;
  hyphens: auto;
  margin: 0 0 1.35rem;
  font-family: var(--bs-body-font-family);
  font-size: clamp(1.5rem, 2.3vw, 2.05rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h1 {
  margin-top: 0;
  font-size: clamp(2rem, 3.2vw, 2.85rem);
  font-weight: 700;
  line-height: 1.1;
}

h2 {
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h3 {
  font-size: clamp(1.18rem, 1.55vw, 1.45rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

/* Karten & Formulare in Bootstrap */
.card {
  background-color: #f0f0f0;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.form-label {
  color: var(--text-main);
  font-size: 0.96rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.form-control:not(.tool-input),
.form-select {
  font-size: 1rem;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  border-color: var(--border-strong);
  transition: border-color 0.2s var(--ease-apple), box-shadow 0.2s var(--ease-apple);
}

.form-control-sm {
  font-size: 0.95rem;
  padding: 0.4rem 0.65rem;
}

.form-control:not(.tool-input):focus,
.form-select:focus {
  border-color: var(--rot);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.16);
}

.input-group-text {
  font-size: 0.95rem;
  font-weight: 500;
  background-color: var(--surface-subtle);
  border-color: var(--border-strong);
  color: var(--text-muted);
  border-radius: 10px;
}

.small,
small {
  font-size: 0.9rem;
}

/* Wartung: Kilometer (einfache Strecke) & Geschätzte Fahrzeit (einfach) in Hellrot */
#kilometer,
#kilometer.form-control,
#kilometer.form-control:focus,
#fahrzeit,
#fahrzeit.form-control,
#fahrzeit.form-control:focus,
input[name*="kilometer" i],
input[id*="kilometer" i],
input[name*="fahrzeit" i],
input[id*="fahrzeit" i],
input[name*="strecke" i],
input[id*="strecke" i],
.wartung-hellrot,
.wartung-hellrot.form-control,
.wartung-hellrot.form-control:focus,
.wartung-hellrot.form-control[readonly] {
  background-color: var(--feld-hellrot) !important;
  background-image: none !important;
  color: var(--feld-hellrot-text) !important;
  font-weight: 600;
  border-color: rgba(200, 16, 46, 0.35) !important;
}

/* Tabellen: Breite 1100px, Inhalte oben, Spalten Intervalle & Minuten ausblenden, Zahlen rechts */
main .table-responsive {
  background-color: var(--surface);
  border: 1px solid var(--border-hairline);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

main .table,
#ausgabe .table,
.ausgabe-tabelle {
  width: 1000px;
  max-width: 100%;
  background-color: var(--surface);
  font-size: 0.96rem;
  margin-bottom: 0;
}

main .table thead th {
  background-color: var(--surface-subtle);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.75rem 0.85rem;
  vertical-align: top;
}

main .table th,
main .table td {
  padding: 0.68rem 0.85rem;
  vertical-align: top !important;
  text-align: left;
}

/* Spalte Intervalle (Spalte 5) & Spalte Minuten (Spalte 6) in wartung.php ausblenden; Daten bleiben erhalten */
#wartung-liste table > thead > tr > th:nth-child(5),
#wartung-liste table > tbody > tr > td:nth-child(5),
#wartung-liste table > tfoot > tr > td:nth-child(5),
#wartung-liste table > tfoot > tr > th:nth-child(5),
#wartung-liste table > thead > tr > th:nth-child(6),
#wartung-liste table > tbody > tr > td:nth-child(6),
#wartung-liste table > tfoot > tr > td:nth-child(6),
#wartung-liste table > tfoot > tr > th:nth-child(6),
main .table .spalte-intervall,
main .table .intervall,
main .table .intervalle,
main .table .spalte-minuten,
main .table .minuten,
main .table [data-col="intervall"],
main .table [data-col="intervalle"],
main .table [data-col="minuten"] {
  display: none !important;
}

/* Zeile „Erstellung der Prüfberichte“ optisch als aktiv hervorheben & Checkbox eingeschaltet darstellen */
#wartung-liste tr[data-name*="Prüfbericht" i] td {
/*  background-color: rgba(209, 231, 221, 0.35); */
  font-weight: 500;
}

/* Zeile „die NAV enthält“ optisch hervorheben & Checkbox ausgeschaltet darstellen */
#wartung-liste tr[data-name^="NAV" i] td {
background-color: rgba(255, 204, 255, 0.35);
  font-weight: 500;
}


/* Zeile „Trockenalarmventilstation“ optisch hervorheben & Checkbox ausgeschaltet darstellen */
#wartung-liste tr[data-name^="Trockenalarmventilstation" i] td {
background-color: rgba(255, 204, 255, 0.35);
  font-weight: 500;
}


/* Zeile „TSL“ optisch hervorheben & Checkbox ausgeschaltet darstellen */
#wartung-liste tr[data-name^="TSL" i] td {
  background-color: rgba(173, 216, 230, 0.35); /* hellblau */
  font-weight: 500;
}

/* Zeile „Wandhydranten“ optisch hervorheben & Checkbox ausgeschaltet darstellen */
#wartung-liste tr[data-name^="Wandhydranten" i] td {
  background-color: rgba(173, 216, 230, 0.35); /* hellblau */
  font-weight: 500;
}



#wartung-liste tr[data-name*="Prüfbericht" i] input[type="checkbox"],
#wartung-liste tr[data-name*="Prüfbericht" i] input[type="checkbox"].form-check-input {
  background-color: var(--checkbox-on) !important;
  border-color: #198754 !important;
}

#wartung-liste tr[data-name*="Prüfbericht" i] input[type="checkbox"]::before,
#wartung-liste tr[data-name*="Prüfbericht" i] input[type="checkbox"].form-check-input::before {
  content: "✓";
  color: #0f5132;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
}

/* Zahlen & Summen rechts ausrichten */
#ausgabe .table .zahl,
#ausgabe .table .nummer,
#ausgabe .table .betrag,
#ausgabe .table .km,
#ausgabe .table .fahrzeit,
#ausgabe .table .summe-wert,
#ausgabe .table th.text-end,
#ausgabe .table td.text-end,
main .table .zahl,
main .table .nummer,
main .table .betrag,
main .table .km,
main .table .fahrzeit,
main .table .summe-wert,
main .table th.text-end,
main .table td.text-end {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

/* Ausgabetabelle: Linie oberhalb der Tabelle, Linie ober- und unterhalb der Summe / am Tabellenende */
#ausgabe .table {
  border-top: 2px solid var(--text-main) !important;
  border-bottom: 2px solid var(--text-main) !important;
}

#ausgabe .table thead th {
  border-top: 2px solid var(--text-main) !important;
  border-bottom: 1.5px solid var(--text-main) !important;
}

#ausgabe .table tbody tr:not(.gesamtsumme):not(.summe):not(.total):last-child td {
  border-bottom: 2px solid var(--text-main) !important;
}

main .table tfoot tr,
main .table tbody tr.gesamtsumme,
main .table tbody tr.summe,
main .table tbody tr.total {
  background-color: #fafafc;
  font-weight: 600;
}

main .table tfoot th,
main .table tfoot td,
main .table tbody tr.gesamtsumme th,
main .table tbody tr.gesamtsumme td,
main .table tbody tr.summe th,
main .table tbody tr.summe td,
main .table tbody tr.total th,
main .table tbody tr.total td {
  border-top: 2px solid var(--text-main) !important;
  border-bottom: 2px solid var(--text-main) !important;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  vertical-align: top !important;
  font-variant-numeric: tabular-nums;
}

/* Wartung: beide Aktions-Buttons zusammen unter der Tabelle, je 50 % Breite & deutlich größer */
.wartung-aktionen {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.85rem;
  width: 100%;
  margin-top: 0.85rem;
}

.wartung-aktionen .wartung-btn-gross {
  flex: 1 1 50%;
  width: 50%;
  min-height: 3.6rem;
  padding: 0.95rem 1.3rem !important;
  font-size: 1.12rem !important;
  font-weight: 600 !important;
  line-height: 1.25;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

@media (max-width: 640px) {
  .wartung-aktionen {
    flex-wrap: wrap;
  }
  .wartung-aktionen .wartung-btn-gross {
    flex: 1 1 100%;
    width: 100%;
  }
}

/* Buttons außerhalb der Topnav: rot mit weißer Schrift */
main button:not(.topnav button),
main a.btn,
.login-page button,
.login-page a.btn {
  background-color: var(--rot) !important;
  border-color: var(--rot) !important;
  color: #ffffff !important;
  font-size: 1rem;
  border-radius: 10px;
  font-weight: 600;
  transition: transform 0.15s var(--ease-apple), background-color 0.2s var(--ease-apple), box-shadow 0.2s var(--ease-apple);
}

main button:not(.topnav button):hover,
main button:not(.topnav button):focus-visible,
main a.btn:hover,
main a.btn:focus-visible,
.login-page button:hover,
.login-page button:focus-visible,
.login-page a.btn:hover,
.login-page a.btn:focus-visible {
  background-color: var(--rot-hover) !important;
  border-color: var(--rot-hover) !important;
  color: #ffffff !important;
}

main button:not(.topnav button):active,
main a.btn:active,
.login-page button:active,
.login-page a.btn:active {
  transform: scale(0.98);
}

/* Checkboxen: deaktiviert/ungeprüft = hellgelb (#ffe066), aktiviert/geprüft = hellgrün (#d1e7dd) */
input[type="checkbox"],
input[type="checkbox"].form-check-input {
  appearance: none;
  -webkit-appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 6px;
  border: 1.5px solid rgba(0, 0, 0, 0.28);
  background-color: var(--checkbox-off) !important;
  background-image: none !important;
  display: inline-grid;
  place-content: center;
  vertical-align: middle;
  cursor: pointer;
  transition: background-color 0.18s var(--ease-apple), border-color 0.18s var(--ease-apple), box-shadow 0.18s var(--ease-apple);
}

input[type="checkbox"]:checked,
input[type="checkbox"].form-check-input:checked {
  background-color: var(--checkbox-on) !important;
  border-color: #198754 !important;
  background-image: none !important;
}

input[type="checkbox"]:checked::before,
input[type="checkbox"].form-check-input:checked::before {
  content: "✓";
  color: #0f5132;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
}

input[type="checkbox"]:focus-visible,
input[type="checkbox"].form-check-input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.18);
}

.alert {
  font-size: 0.98rem;
  border-radius: var(--radius-md);
  border-width: 1px;
  box-shadow: var(--shadow-sm);
}

/* Anmeldeseite */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 50% 0%, var(--rot-soft), transparent 55%),
    var(--surface-subtle);
}

.login-card {
  width: 100%;
  max-width: 27rem;
  margin: 2rem auto;
  background: var(--surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.login-card .card-body {
  padding: 2.25rem;
}

@media (max-width: 575.98px) {
  .login-card .card-body {
    padding: 1.5rem;
  }
}

/* Löschen-Bestätigung ohne JavaScript */
summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--rot);
  transition: background-color 0.2s var(--ease-apple);
}

summary:hover,
summary:focus-visible {
  background-color: var(--rot-soft);
  outline: none;
}

summary::-webkit-details-marker {
  display: none;
}

/* Eingabefelder der Tools: Hintergrund #FFE2F0, auch beim Fokussieren */
.tool-input,
.tool-input:focus {
  background-color: #FFE2F0;
  color: var(--text-main);
  font-size: 1rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(200, 16, 46, 0.32);
  border-radius: 10px;
  font-family: var(--bs-body-font-family);
  transition: border-color 0.2s var(--ease-apple), box-shadow 0.2s var(--ease-apple);
}

.tool-input:focus {
  outline: none;
  border-color: var(--rot);
  box-shadow: 0 0 0 3.5px rgba(200, 16, 46, 0.2);
}

/* Ergebnisfelder "Lieferbares Kabel": helles Grün */
.kabel-ergebnis {
  background-color: #D8F3D8;
  color: var(--text-main);
  font-size: 1rem;
  border: 1px solid rgba(22, 101, 52, 0.25);
  border-radius: 10px;
  font-weight: 600;
}