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

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0;
}

.container { max-width: 1100px; margin: 0 auto; padding: 16px; }

.footer { padding: 18px 0; text-align: center; opacity: 0.7; }

.card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

.success { border-color: #77c27a; }
.error { border-color: #d77; }

.muted { opacity: 0.75; font-size: 14px; }

.kpi { font-size: 28px; font-weight: 700; margin: 6px 0; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

label { display: block; margin: 10px 0 6px; font-size: 14px; opacity: 0.85; }
input, button, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #ccc;
  font-size: 14px;
}
button { cursor: pointer; font-weight: 600; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #eee; }
th { font-size: 13px; opacity: 0.8; }

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid #eee;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-left { display: flex; align-items: center; gap: 10px; }

.nav .brand {
  font-weight: 800;
  letter-spacing: 0.3px;
  text-decoration: none;
  color: #111;
  padding: 8px 10px;
  border-radius: 10px;
}

.nav-pill {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #eee;
  background: #fafafa;
  opacity: 0.9;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.nav a {
  text-decoration: none;
  color: #111;
  padding: 8px 10px;
  border-radius: 10px;
}

.nav a.active { background: #f2f2f2; }
.nav a.logout { margin-left: auto; }

.contract-switch { display: inline-flex; align-items: center; }
.contract-switch select { width: auto; max-width: 360px; padding: 8px 10px; }

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid #ddd;
  width: 44px;
  height: 40px;
  border-radius: 12px;
  padding: 0;
}

.nav-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: #111;
  margin: 4px auto;
  border-radius: 2px;
}

@media (max-width: 799px) {
  .grid.cols-3 { grid-template-columns: 1fr; }
  .grid.cols-2 { grid-template-columns: 1fr; }

  .nav { justify-content: space-between; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }

  .nav-links {
    position: absolute;
    left: 14px;
    right: 14px;
    top: 58px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 14px;
    padding: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  }

  .nav-links.open { display: flex; }
  .nav a.logout { margin-left: 0; }

  .contract-switch { width: 100%; }
  .contract-switch select { width: 100%; max-width: none; }
}

/* Aktuellen Monat in Monatsübersicht hervorheben */
tr.is-current-month {
  background-color: #f3f4f6;
}

/* Monatswerte: km-Spalten rechts ausrichten (Header + Werte) */
.monthly-values th:nth-child(2),
.monthly-values th:nth-child(3),
.monthly-values th:nth-child(4),
.monthly-values td:nth-child(2),
.monthly-values td:nth-child(3),
.monthly-values td:nth-child(4) {
  text-align: right;
}

/* Optional: saubere Zahlen-Ausrichtung */
.monthly-values td,
.monthly-values th {
  font-variant-numeric: tabular-nums;
}