/* Profito – eigenes Styling auf Basis von Bootstrap 5 */

:root {
  --sidebar-breite: 15rem;
  --sidebar-breite-klein: 4.4rem;
  --sidebar-bg: #172033;
  --sidebar-text: #c3cbd8;
  --sidebar-trenner: rgba(255, 255, 255, 0.08);
  --marke: #34d399;
  --inhalt-bg: #f3f5f9;
  --karte-schatten: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
}

body {
  background: var(--inhalt-bg);
}

/* --- Layout ------------------------------------------------------------------------------------ */

.app {
  display: flex;
  min-height: 100vh;
}

.inhalt {
  flex-grow: 1;
  min-width: 0;
  padding: 1.75rem 1.5rem 2.5rem;
}

/* --- Navigation -------------------------------------------------------------------------------- */

.sidebar {
  position: sticky;
  top: 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: var(--sidebar-breite);
  height: 100vh;
  overflow-x: hidden;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  transition: width 0.2s ease;
}

.sidebar-kopf {
  padding: 1.1rem 1.15rem;
  border-bottom: 1px solid var(--sidebar-trenner);
}

.marke {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.marke i {
  font-size: 1.45rem;
  color: var(--marke);
}

.sidebar-menue {
  flex-grow: 1;
  gap: 0.2rem;
  padding: 0.85rem 0.65rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 0;
  border-radius: 0.55rem;
  background: none;
  color: var(--sidebar-text);
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-link i {
  flex-shrink: 0;
  width: 1.5rem;
  font-size: 1.15rem;
  text-align: center;
  transition: transform 0.2s ease;
}

.sidebar-link:hover,
.sidebar-link:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-link.aktiv {
  background: var(--bs-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.35);
}

.sidebar-fuss {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem;
  border-top: 1px solid var(--sidebar-trenner);
}

.sidebar-benutzer {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.5rem 0.8rem;
  color: #8d99ad;
  font-size: 0.9rem;
  white-space: nowrap;
}

.sidebar-benutzer i {
  width: 1.5rem;
  font-size: 1.15rem;
  text-align: center;
}

html.sidebar-klein .sidebar {
  width: var(--sidebar-breite-klein);
}

html.sidebar-klein .sidebar .beschriftung {
  display: none;
}

html.sidebar-klein #sidebar-umschalten i {
  transform: rotate(180deg);
}

.mobil-kopf,
.sidebar-hintergrund {
  display: none;
}

@media (max-width: 767.98px) {
  .sidebar {
    position: fixed;
    left: 0;
    width: var(--sidebar-breite) !important;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  html.sidebar-klein .sidebar .beschriftung {
    display: inline; /* mobil immer mit Text */
  }

  html.sidebar-offen .sidebar {
    transform: none;
  }

  html.sidebar-offen .sidebar-hintergrund {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1030;
    background: rgba(15, 23, 42, 0.45);
  }

  #sidebar-umschalten {
    display: none;
  }

  .mobil-kopf {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: -1rem -1rem 1rem;
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: #fff;
    font-weight: 600;
  }

  .mobil-kopf .btn {
    font-size: 1.5rem;
  }

  .inhalt {
    padding: 1rem;
  }
}

/* --- Seiteninhalt ------------------------------------------------------------------------------ */

.seitenkopf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.seitenkopf h1 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  font-size: 1.55rem;
  font-weight: 600;
}

.seitenkopf h1 i {
  color: var(--bs-primary);
}

.seitenkopf .untertitel {
  color: var(--bs-secondary-color);
  font-size: 0.95rem;
}

.karte {
  padding: 1.25rem 1.15rem;
  border-radius: 0.8rem;
  background: #fff;
  box-shadow: var(--karte-schatten);
}

.karte + .karte {
  margin-top: 1.25rem;
}

.karte h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.karten-kopf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.karten-unterkopf {
  margin: 1.4rem 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.karten-kopf h2 {
  margin: 0;
}

.nav-tabs .nav-link {
  color: var(--bs-secondary-color);
}

.nav-tabs .nav-link.active {
  color: var(--bs-emphasis-color);
  font-weight: 500;
}

.tab-inhalt {
  padding-top: 1.25rem;
}

.formular-aktionen {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.feld-hinweis {
  color: var(--bs-secondary-color);
  font-size: 0.85rem;
}

/* Fehlertext auch bei Feldern in einer Hülle (Datumsfeld, input-group) */
.feld:has(.is-invalid) > .invalid-feedback {
  display: block;
}

/* Zeitfelder im 15-Minuten-Takt: Stunde und Minute als Auswahl (Profito.zeitfelder) */
.zeit-feld .form-select {
  padding-right: 1.6rem;
  background-position: right 0.35rem center;
}

input.is-invalid + .zeit-feld .form-select {
  border-color: var(--bs-form-invalid-border-color);
}

/* Datumsfelder im ISO-Format mit Kalender-Knopf (Profito.datumsfelder) */
.datum-feld {
  position: relative;
}

.datum-feld .form-control {
  padding-right: 2.25rem;
}

.datum-feld .form-control.is-invalid {
  padding-right: 4rem;
  background-position: right 2.25rem center;
}

.datum-knopf {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 2.25rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--bs-secondary-color);
}

.datum-knopf:hover,
.datum-knopf:focus-visible {
  color: var(--bs-primary);
}

/* unsichtbar, liefert nur den Kalender des Browsers (unter dem Feld) */
.datum-kalender {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.zeitraum {
  width: 9.5rem;
}

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

.bootstrap-table .fixed-table-container {
  border-radius: 0.5rem;
}

.bootstrap-table .table {
  font-size: 0.925rem;
}

.bootstrap-table .table > thead th {
  background: #f8fafc;
  color: #475467;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  white-space: nowrap;
}

.bootstrap-table .table > thead th .th-inner {
  padding: 0.55rem 0.6rem;
}

.bootstrap-table .table td {
  padding: 0.5rem 0.6rem;
  vertical-align: middle;
}

/* kompakte Filterfelder unter den Spaltenköpfen */
.bootstrap-table .filter-control {
  padding: 0 0.35rem 0.4rem;
}

.bootstrap-table .filter-control .form-control,
.bootstrap-table .filter-control .form-select {
  min-width: 4.5rem;
  min-height: 0;
  padding: 0.2rem 0.5rem;
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: normal;
}

.bootstrap-table .filter-control .form-select {
  padding-right: 1.6rem;
  background-position: right 0.4rem center;
}

.text-nowrap-zelle {
  white-space: nowrap;
}

.bootstrap-table .table tbody tr.klickbar {
  cursor: pointer;
}

.tabelle-aktionen {
  white-space: nowrap;
  text-align: right;
}

.tabelle-aktionen .btn {
  padding: 0.15rem 0.45rem;
}

.tabelle-aktionen.mehrzeilig {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.25rem;
  width: 6.9rem; /* drei Knöpfe je Zeile (max-width allein lässt die Tabelle die Zelle schmaler rechnen) */
}

/* Erfassung: Spalte „Bestellung“ so breit wie der Inhalt, höchstens 3 cm */
.text-bestellung {
  display: inline-block;
  max-width: 3cm;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.text-zeile-kurz {
  display: inline-block;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.kunden-logo {
  max-width: 5.5rem;
  max-height: 2rem;
  object-fit: contain;
}

.logo-vorschau {
  max-width: 14rem;
  max-height: 6rem;
  padding: 0.5rem;
  border: 1px dashed var(--bs-border-color);
  border-radius: 0.5rem;
  background: #fff;
  object-fit: contain;
}

.badge-art {
  font-weight: 500;
}

/* --- Dashboard ---------------------------------------------------------------------------------- */

.news-liste {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.news-eintrag {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--bs-border-color);
  border-left-width: 4px;
  border-radius: 0.5rem;
  background: #fff;
}

.news-dringend {
  border-left-color: var(--bs-danger);
  background: var(--bs-danger-bg-subtle);
}

.news-spaeter {
  border-left-color: var(--bs-warning);
  background: var(--bs-warning-bg-subtle);
}

.news-symbol {
  font-size: 1.25rem;
}

.news-dringend .news-symbol {
  color: var(--bs-danger);
}

.news-spaeter .news-symbol {
  color: #b58100;
}

.news-inhalt {
  flex: 1;
  min-width: 0;
}

.news-titel {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.news-details {
  color: var(--bs-secondary-color);
  font-size: 0.85rem;
}

.news-betrag {
  font-weight: 600;
  white-space: nowrap;
}

.news-leer {
  color: var(--bs-secondary-color);
}

.news-leer i {
  margin-right: 0.4rem;
  color: var(--bs-success);
}

.kennzahlen {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.kennzahl-wert {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.kennzahl-text {
  color: var(--bs-secondary-color);
  font-size: 0.85rem;
}

.kacheln {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.kachel {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.75rem;
  background: #fff;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.kachel:hover,
.kachel:focus-visible {
  border-color: var(--bs-primary);
  box-shadow: 0 0.25rem 0.75rem rgba(13, 110, 253, 0.12);
}

.kachel i {
  margin-bottom: 0.35rem;
  color: var(--bs-primary);
  font-size: 1.5rem;
}

.kachel-titel {
  font-weight: 600;
}

.kachel-text {
  color: var(--bs-secondary-color);
  font-size: 0.85rem;
}

@media (max-width: 575.98px) {
  .news-eintrag {
    flex-wrap: wrap;
  }

  .news-inhalt {
    flex-basis: calc(100% - 2.5rem);
  }
}

/* --- Rechnungsbuch -------------------------------------------------------------------------------- */

.auswahl-liste {
  max-height: 24rem;
  overflow-y: auto;
  text-align: left;
}

.auswahl-alle,
.auswahl-zeile {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
}

.auswahl-alle {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--bs-border-color);
  font-weight: 600;
}

.auswahl-zeile {
  padding: 0.4rem 0.5rem;
  border-radius: 0.375rem;
}

.auswahl-zeile:hover {
  background: var(--bs-tertiary-bg);
}

.auswahl-zeile .form-check-input {
  flex-shrink: 0;
  margin-top: 0.2rem;
}

.auswahl-text {
  flex: 1;
  min-width: 0;
}

.auswahl-details {
  display: block;
  color: var(--bs-secondary-color);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.auswahl-wert {
  white-space: nowrap;
  font-size: 0.9rem;
}

.auswahl-gruppe {
  margin: 0.75rem 0 0.15rem;
  padding: 0 0.5rem;
  color: var(--bs-secondary-color);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.auswahl-hinweis {
  margin: 0 0.5rem 0.4rem 2.1rem;
  color: var(--bs-warning-text-emphasis);
  font-size: 0.82rem;
}

.gutschrift-posten {
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
}

.gutschrift-kopf {
  margin-bottom: 0.5rem;
}

.gutschrift-eintraege {
  margin-top: 0.5rem;
  padding-top: 0.25rem;
  border-top: 1px dashed var(--bs-border-color);
}

.gutschrift-abgleich {
  min-height: 2.6rem;
}

.rechnung-ansicht {
  text-align: left;
}

.rechnung-kopf {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.15rem 0.75rem;
  margin: 0;
  font-size: 0.92rem;
}

.rechnung-kopf dt {
  color: var(--bs-secondary-color);
  font-weight: 500;
}

.rechnung-kopf dd {
  margin: 0;
}

.positionen > tfoot td {
  border-bottom: 0;
}

/* Dashboard: Listen unter den Kacheln, Monatswahl der Leistung */
.dashboard-listen {
  margin-top: 0.5rem;
}

.monat-anzeige {
  min-width: 4.5rem;
}

.leistung > tfoot th,
.leistung > tfoot td {
  border-top: 2px solid var(--bs-border-color);
  border-bottom: 0;
  font-weight: 700;
}

/* Dashboard: offene Beträge je Monat (Kopfzeile mit Monatssumme) und Kunde (eingerückt) */
.aussenstaende .aussenstaende-monat > * {
  padding-top: 0.6rem;
  background: #f8fafc;
  font-weight: 600;
}

.aussenstaende .aussenstaende-kunde > td:first-child {
  padding-left: 1.25rem;
}

.aussenstaende > tfoot th,
.aussenstaende > tfoot td {
  border-top: 2px solid var(--bs-border-color);
  border-bottom: 0;
  font-weight: 700;
}

/* „offen“ in Orange (Bootstrap hat nur Gelb); Text dunkler für ausreichenden Kontrast */
.btn-outline-offen {
  --bs-btn-color: #c2410c;
  --bs-btn-border-color: #ea580c;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #ea580c;
  --bs-btn-hover-border-color: #ea580c;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #c2410c;
  --bs-btn-active-border-color: #c2410c;
  --bs-btn-focus-shadow-rgb: 234, 88, 12;
}

.monatsuebersicht > tfoot .gesamt-umsatz th,
.monatsuebersicht > tfoot .gesamt-umsatz td {
  border-top: 0;
  font-weight: 600;
}

/* Laufende Kosten: Summe pro Monat */
.jahr-wahl {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.jahr-anzeige {
  min-width: 3.5rem;
  font-weight: 600;
  text-align: center;
}

.monatssummen > tfoot th,
.monatssummen > tfoot td {
  border-top: 2px solid var(--bs-border-color);
  font-weight: 700;
}

.monatssummen > tbody > tr.aktueller-monat > * {
  background: var(--bs-primary-bg-subtle);
  font-weight: 600;
}

/* Bestellungen als Unter-Tabelle im aufgeklappten Projekt */
.bootstrap-table .table > tbody > tr.detail-view > td {
  padding: 0.25rem 0.75rem 0.85rem 2.75rem;
  background: #f8fafc;
}

.bestellungen .bootstrap-table .table {
  background: #fff;
}

.bestellungen .bootstrap-table .table > thead th {
  background: #eef2f6;
}

.bestellungen-leer {
  padding: 0.35rem 0;
}

@media (max-width: 575.98px) {
  .bootstrap-table .table > tbody > tr.detail-view > td {
    padding-right: 0.25rem;
    padding-left: 0.5rem;
  }
}

/* --- Dialoge (SweetAlert2) --------------------------------------------------------------------- */

.profito-dialog .swal2-title {
  padding-top: 1.25rem;
  font-size: 1.3rem;
}

.profito-dialog .swal2-html-container {
  margin: 1rem 1.6rem 0.25rem;
  font-size: 1rem;
  text-align: left;
}

.profito-dialog .swal2-actions {
  gap: 0.5rem;
}

.profito-dialog .swal2-validation-message {
  justify-content: flex-start;
  margin: 0.75rem 1.6rem 0;
  border-radius: 0.5rem;
  background: var(--bs-danger-bg-subtle);
  color: var(--bs-danger-text-emphasis);
}

.preis-zeile + .preis-zeile {
  margin-top: 0.5rem;
}

/* --- Anmeldung und Fehlerseiten ---------------------------------------------------------------- */

.anmeldung {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background: radial-gradient(circle at top, #23314d 0%, var(--sidebar-bg) 60%);
}

.anmeldung-karte {
  width: 100%;
  max-width: 24rem;
  padding: 2rem;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
}

.anmeldung-marke {
  color: var(--marke);
  font-size: 2.6rem;
}

.code-eingabe {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5em;
}

/* Zeilen in der Farbe des Kunden (Profito.kundenZeilen) – ersetzt dort die grauen Streifen */
.table > tbody > tr.kunde-zeile > * {
  --bs-table-bg: var(--kunde-bg);
}

/* Farbpunkt des Kunden (Kundenliste) */
.kunden-punkt {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  margin-right: 0.4rem;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

/* Gestreifte Tabellen: etwas deutlicher als Bootstraps Grau, im hellen Blau der Rechnung (#dce6f1) */
.table-striped {
  --bs-table-striped-bg: rgba(79, 129, 189, 0.09);
}
