* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 15px;
  color: #2c2c2a;
  background: #f6f5f2;
}

/* Navigation */
.topnav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: #fff; border-bottom: 1px solid #ddd;
}
.topnav .titel { font-weight: 600; }
.topnav a { color: #1a6fb0; text-decoration: none; }

main { padding: 16px; }

/* Login */
.login-seite { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.login-box {
  background: #fff; border: 1px solid #ddd; border-radius: 12px;
  padding: 24px; width: 320px;
}
.login-box h1 { margin: 0 0 16px; font-size: 20px; }

/* Formulare allgemein */
label { display: block; margin: 10px 0 4px; font-size: 13px; color: #555; }
input[type=text], input[type=password], input[type=date], select {
  width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 6px; font-size: 15px;
}
label.check { display: flex; align-items: center; gap: 6px; }
label.check input { width: auto; }
button {
  padding: 8px 14px; border: 1px solid #ccc; border-radius: 6px;
  background: #fff; font-size: 15px; cursor: pointer;
}
button[type=submit] { background: #1a6fb0; border-color: #1a6fb0; color: #fff; }
button.gefahr { color: #b03030; }
.fehler { color: #b03030; font-size: 14px; }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.tab {
  padding: 8px 16px; border: 1px solid #ccc; border-bottom: none;
  border-radius: 8px 8px 0 0; background: #eee; cursor: pointer;
}
.tab.aktiv { background: #fff; font-weight: 600; }

/* Grid */
.plan-scroll { overflow: auto; max-height: calc(100vh - 140px); }
#grid { display: grid; min-width: fit-content; background: #fff; }
.monthlabel {
  font-size: 12px; font-weight: 600; color: #555;
  display: flex; align-items: center; padding-left: 4px;
  border-bottom: 1px solid #ddd;
}
.daylabel {
  font-size: 11px; color: #888; display: flex;
  align-items: center; justify-content: center;
}
.rowlabel {
  font-size: 12px; color: #555; display: flex;
  align-items: center; padding-left: 8px;
  position: sticky; left: 0; background: #fff; z-index: 2;
}
.cell {
  border: 0.5px solid #e2e0dc; cursor: pointer;
  user-select: none; touch-action: none;
}
.cell.free:hover { background: #eef2f5; }
.cell.preview { background: #cfe3f5 !important; }

/* Wochenend-Rahmen: links vom Samstag, rechts vom Sonntag */
.cell.sa, .daylabel.sa { border-left: 2px solid #999; }
.cell.so, .daylabel.so { border-right: 2px solid #999; }

/* Modal */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 10;
}
.overlay[hidden] { display: none; }
.modalbox {
  background: #fff; border-radius: 12px; padding: 20px;
  width: 300px; max-height: 92vh; overflow-y: auto;
}
.modalbox h2 { margin: 0; font-size: 17px; }
.modalbox .buttons { display: flex; gap: 8px; margin-top: 16px; }
.modalbox .buttons button { flex: 1; }

/* Querformat auf kleinen Geräten: Modal breit, Felder zweispaltig */
@media (orientation: landscape) and (max-height: 500px) {
  .modalbox { width: min(90vw, 620px); }
  .formfelder { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
}

/* Rechnung */
.rechnung { max-width: 640px; margin: 0 auto; background: #fff; padding: 24px; }
.rechnung h1 { font-size: 22px; }
.rechnung .datum { color: #666; }
.rechnung-details { margin: 16px 0; border-collapse: collapse; }
.rechnung-details th { text-align: left; padding: 4px 16px 4px 0; color: #555; font-weight: 500; }
.rechnung-details td { padding: 4px 0; }
.rechnung-posten { width: 100%; border-collapse: collapse; margin-top: 16px; }
.rechnung-posten th, .rechnung-posten td {
  text-align: left; padding: 8px; border-bottom: 1px solid #ddd;
}
.rechnung-posten th:last-child, .rechnung-posten td:last-child { text-align: right; }
.rechnung-posten tfoot td { font-weight: 600; border-bottom: none; }
.rechnung-actions { display: flex; gap: 8px; margin-bottom: 16px; }

@media print {
  .rechnung-actions, .topnav { display: none; }
  body { background: #fff; }
}