:root {
  --bg: #f4f1ea;
  --card: #fff;
  --primary: #8b4a1f;
  --primary-light: #a66230;
  --accent: #c97a3a;
  --text: #1d211f;
  --muted: #6b716e;
  --border: #e2dfd6;
  --danger: #b94343;
  --success: #2c8a4a;
  --warn: #c99a1c;
  --radius: 10px;
  --shadow: 0 2px 6px rgba(0,0,0,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
body { padding-bottom: 70px; }

header.app {
  position: sticky; top: 0; z-index: 10;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: .5rem 1rem;
  min-height: 56px;
}
header.app .brand { display: flex; align-items: center; gap: .65rem; min-width: 0; }
header.app .brand img.logo-round {
  width: 38px; height: 38px; border-radius: 50%;
  background: #f4f1ea; padding: 2px; flex-shrink: 0;
}
header.app .brand img.logo-text {
  height: 30px; width: auto; display: none;
}
header.app .brand .sp-name {
  font-size: 1rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
header.app select, header.app button.menu-btn {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
  color: #fff; padding: .35rem .6rem; border-radius: 6px; font-size: .9rem;
}

@media (min-width: 768px) {
  header.app { padding: .65rem 1.5rem; min-height: 64px; }
  header.app .brand img.logo-round { display: none; }
  header.app .brand img.logo-text { display: block; height: 36px; }
  header.app .brand .sp-name { font-size: 1.05rem; margin-left: .5rem; padding-left: .75rem; border-left: 1px solid rgba(255,255,255,.3); }
}

main { padding: 1rem; max-width: 720px; margin: 0 auto; }
h2 { font-size: 1.25rem; margin: 0 0 1rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

.card {
  background: var(--card); border-radius: var(--radius); padding: 1rem;
  margin-bottom: .75rem; box-shadow: var(--shadow);
}
.card.compact { padding: .75rem 1rem; }
.row { display: flex; gap: .75rem; align-items: center; }
.row.space { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .5rem; }

label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
input, select, textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--border);
  border-radius: 8px; font-size: 1rem; background: #fff; color: var(--text);
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-light); outline-offset: -1px; }
textarea { resize: vertical; min-height: 80px; }
.field { margin-bottom: .75rem; }

button.btn, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  background: var(--primary); color: #fff; border: 0;
  padding: .65rem 1rem; border-radius: 8px; font-size: 1rem; font-weight: 500;
  cursor: pointer; font-family: inherit;
}
.btn:hover { background: var(--primary-light); }
.btn.secondary { background: #fff; color: var(--primary); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); }
.btn.accent { background: var(--accent); }
.btn.small { padding: .35rem .7rem; font-size: .85rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

nav.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(6, 1fr);
  z-index: 20; padding-bottom: env(safe-area-inset-bottom);
}
nav.tabbar a {
  text-align: center; padding: .55rem 0 .4rem;
  text-decoration: none; color: var(--muted); font-size: .65rem;
  display: flex; flex-direction: column; align-items: center; gap: .15rem;
}
nav.tabbar a.active { color: var(--primary); }
nav.tabbar a svg { width: 22px; height: 22px; }

.muted { color: var(--muted); }
.badge { display: inline-block; padding: .15rem .5rem; border-radius: 10px; background: var(--border); font-size: .75rem; }
.badge.success { background: #d6f0dd; color: var(--success); }
.badge.warn { background: #f7ecc7; color: var(--warn); }
.badge.danger { background: #f6d6d6; color: var(--danger); }

.list-item {
  padding: .75rem 0; border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: 0; }
.list-item .title { font-weight: 500; }
.list-item .sub { font-size: .85rem; color: var(--muted); margin-top: .15rem; }

.check {
  display: flex; align-items: center; gap: .6rem;
  padding: .65rem 0; border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.check:last-child { border-bottom: 0; }
.check input[type=checkbox] { width: 22px; height: 22px; flex-shrink: 0; }
.check span.done { text-decoration: line-through; color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }

.fab {
  position: fixed; bottom: 84px; right: 1rem; z-index: 15;
  width: 56px; height: 56px; border-radius: 28px;
  background: var(--accent); color: #fff; border: 0;
  font-size: 1.7rem; box-shadow: 0 4px 12px rgba(0,0,0,.18);
}

.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: flex-end; z-index: 30;
}
.modal {
  background: #fff; width: 100%; max-width: 600px; margin: 0 auto;
  border-radius: 14px 14px 0 0; padding: 1.25rem 1rem 1rem;
  max-height: 90vh; overflow-y: auto;
}
.modal h3 { color: var(--text); text-transform: none; letter-spacing: 0; font-size: 1.1rem; margin: 0 0 1rem; }
.modal .actions { display: flex; gap: .5rem; margin-top: 1rem; }
.modal .actions .btn { flex: 1; }

.auth-wrap { max-width: 380px; margin: 3rem auto; padding: 0 1rem; }
.auth-wrap .logo-hero { text-align: center; margin-bottom: 1.5rem; }
.auth-wrap .logo-hero img { width: 140px; height: 140px; }
.auth-wrap .card { padding: 1.5rem; }
.auth-wrap .switch { text-align: center; margin-top: 1rem; font-size: .9rem; }
.auth-wrap a { color: var(--primary); }

@media (min-width: 768px) {
  .auth-wrap { max-width: 420px; }
  .auth-wrap .logo-hero img { width: 180px; height: 180px; }
}

.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: .65rem 1.1rem;
  border-radius: 8px; font-size: .9rem; z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}

.zaehler-foto { max-width: 100%; max-height: 200px; border-radius: 8px; margin-top: .5rem; }
.thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 6px; }
.thumb-row { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .5rem; }

.weather-card { background: linear-gradient(135deg, #4a8fb4, #2a5f80); color: #fff; }
.weather-card h3 { color: rgba(255,255,255,.85); }
.weather-temp { font-size: 2.4rem; font-weight: 300; }
.frost-alert { background: #2a4f70; padding: .5rem .75rem; border-radius: 6px; margin-top: .5rem; font-size: .85rem; }

.kalender-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-top: .5rem; }
.kalender-day { aspect-ratio: 1; background: #f0ede4; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: .8rem; }
.kalender-day.belegt { background: var(--accent); color: #fff; }
.kalender-day.today { outline: 2px solid var(--primary); }

.update-banner {
  background: var(--accent); color: #fff;
  padding: .65rem 1rem; text-align: center; font-size: .9rem;
}
.update-banner button { background: rgba(255,255,255,.2); color: #fff; border: 0; padding: .25rem .65rem; border-radius: 6px; margin-left: .5rem; cursor: pointer; }

.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid #fff; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.install-banner {
  position: fixed; left: 0; right: 0; bottom: 70px; z-index: 25;
  background: #fff; border-top: 1px solid var(--border);
  box-shadow: 0 -4px 12px rgba(0,0,0,.08);
  padding: .75rem 1rem; padding-bottom: calc(.75rem + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: .5rem;
}
.install-inner { display: flex; align-items: center; gap: .75rem; }
.install-logo { width: 44px; height: 44px; flex-shrink: 0; }
.install-text { flex: 1; min-width: 0; }
.install-actions { display: flex; gap: .5rem; justify-content: flex-end; }
.install-actions .btn { flex: 0 0 auto; }

@media (min-width: 640px) {
  .install-banner { flex-direction: row; align-items: center; bottom: 84px; left: auto; right: 1rem; max-width: 420px; border-radius: 12px; border: 1px solid var(--border); }
}

@media (display-mode: standalone) {
  .install-banner { display: none !important; }
}

@media (min-width: 640px) {
  nav.tabbar a { font-size: .75rem; }
}
