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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #eef1f5;
  color: #1f2933;
}

.card {
  width: 100%;
  max-width: 380px;
  padding: 2rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .08);
}

h1 { margin: 0 0 1.5rem; font-size: 1.5rem; }

label { display: block; margin: 1rem 0 .35rem; font-size: .9rem; font-weight: 600; }

input[type=text], input[type=password] {
  width: 100%;
  padding: .65rem .75rem;
  font-size: 1rem;
  border: 1px solid #cbd2d9;
  border-radius: 8px;
}

input:focus { outline: 2px solid #3b82f6; outline-offset: 1px; border-color: transparent; }

.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 400; }

button {
  width: 100%;
  margin-top: 1.5rem;
  padding: .7rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: #3b82f6;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
button:hover { background: #2563eb; }
button.secondary { background: #64748b; }
button.secondary:hover { background: #475569; }

.menu { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  padding: 1rem .5rem;
  font-weight: 600;
  color: inherit;
  text-decoration: none;
  background: #f1f5f9;
  border-radius: 10px;
}
.menu-item:hover { background: #e2e8f0; }
.menu-item:last-child:nth-child(odd) { grid-column: span 2; }
.menu-icon { font-size: 2rem; line-height: 1; }

.geraet { padding: 1rem 0; border-top: 1px solid #e2e8f0; }
.geraet h2 { margin: 0 0 .25rem; font-size: 1.1rem; }
.geraet .status { margin: 0; font-size: .9rem; color: #64748b; }
.geraet label { margin-top: .75rem; font-weight: 400; }
input[type=range] { width: 100%; accent-color: #3b82f6; }
.soll { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .75rem; margin-top: .25rem; }
.soll button { margin-top: .5rem; padding: .5rem; font-size: 1.6rem; line-height: 1; }
.soll-wert { margin-top: .5rem; font-size: 1.1rem; white-space: nowrap; }
.soll-wert output { font-size: 1.5rem; font-weight: 700; }
.btn-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.btn-row button { margin-top: .75rem; padding: .6rem .25rem; font-size: .9rem; }
.btn-row-1 { grid-template-columns: 1fr; }
.btn-row button { white-space: nowrap; }

.behaelter { padding-bottom: 1rem; }
.behaelter h2 { margin: 0 0 .25rem; font-size: 1.1rem; }
.behaelter .status { margin: .5rem 0 0; font-size: .9rem; color: #64748b; }
.behaelter-wert { margin: 0; font-size: 2.5rem; font-weight: 700; text-align: center; }
.balken { height: 1rem; overflow: hidden; background: #e2e8f0; border-radius: 999px; }
.balken div { height: 100%; background: #16a34a; border-radius: 999px; }
.behaelter-wert.leer { color: #dc2626; }
.balken.leer div { background: #dc2626; }
.messen-btn { margin-top: .75rem; padding: .5rem; font-size: .9rem; }

.garage-btn { padding: 1.5rem .7rem; font-size: 1.2rem; }

.zaehler-titel { margin: 0; text-align: center; font-weight: 400; color: #64748b; }
.zaehler { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; }
.zaehler button { margin-top: .5rem; font-size: 2rem; line-height: 1; padding: .6rem; }
button:disabled { opacity: .5; cursor: default; }
.zaehler-wert {
  width: 2.2em; padding: 0; font: inherit; font-size: 3.5rem; font-weight: 700; text-align: center;
  color: inherit; background: transparent; border: 0; border-radius: 8px; -moz-appearance: textfield;
}
.zaehler-wert::-webkit-outer-spin-button, .zaehler-wert::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.zaehler-info { margin: .75rem 0 0; text-align: center; color: #64748b; }
.zaehler-info .ungespeichert { color: #b45309; font-weight: 600; }

@media (max-width: 420px) {
  .card { padding: 1.25rem; }
}

.back { display: inline-block; margin-bottom: 1rem; color: #3b82f6; text-decoration: none; }
.back:hover { text-decoration: underline; }

.flash { padding: .65rem .75rem; margin-bottom: 1rem; border-radius: 8px; font-size: .9rem; }
.flash-error { background: #fde8e8; color: #9b1c1c; }
.flash-info  { background: #e1effe; color: #1e429f; }

.version { margin-top: 1.5rem; text-align: center; font-size: .7rem; color: #94a3b8; }

@media (prefers-color-scheme: dark) {
  body { background: #111827; color: #e5e7eb; }
  .card { background: #1f2937; box-shadow: none; }
  input[type=text], input[type=password] { background: #111827; color: #e5e7eb; border-color: #374151; }
  .menu-item { background: #111827; }
  .menu-item:hover { background: #374151; }
  .back { color: #60a5fa; }
  .geraet { border-color: #374151; }
  .geraet .status, .zaehler-titel, .zaehler-info { color: #9ca3af; }
  .zaehler-info .ungespeichert { color: #fbbf24; }
  .behaelter .status { color: #9ca3af; }
  .balken { background: #374151; }
  .behaelter-wert.leer { color: #f87171; }
  .version { color: #6b7280; }
}
