:root {
  /* ---- Modernes, frisches Farbsystem ---- */
  --ink: #10151b;
  --ink-soft: #5b6472;
  --ink-faint: #97a0ab;

  --bg: #f3f6f4;
  --surface: #ffffff;
  --border: #e7ebe8;

  --green-700: #047857;
  --green-600: #059669;
  --green-500: #10b981;
  --green-100: #d1fae5;
  --green-50: #ecfdf5;

  --amber-500: #f59e0b;
  --amber-100: #fef3c7;

  --blue-500: #3b82f6;
  --blue-100: #dbeafe;

  --clay-500: #d97757;
  --clay-100: #fbe4d8;

  --danger: #dc2626;
  --danger-bg: #fee2e2;

  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --shadow-sm: 0 1px 2px rgba(16,21,27,0.04), 0 1px 3px rgba(16,21,27,0.06);
  --shadow-md: 0 8px 24px rgba(16,21,27,0.08);
  --shadow-green: 0 10px 24px rgba(5,150,105,0.28);

  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
}

#app { min-height: 100vh; display: flex; flex-direction: column; }

a { color: inherit; }

:focus-visible {
  outline: 2.5px solid var(--green-500);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Login / Auth --- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background: #0b1f17;
}
.auth-screen::before,
.auth-screen::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
}
.auth-screen::before {
  width: 480px; height: 480px;
  background: radial-gradient(circle, var(--green-500), transparent 70%);
  top: -160px; left: -120px;
}
.auth-screen::after {
  width: 420px; height: 420px;
  background: radial-gradient(circle, var(--amber-500), transparent 70%);
  bottom: -160px; right: -100px;
  opacity: 0.35;
}
.auth-card {
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 32px 26px 26px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 30px 70px rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.5);
}
.auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--green-700);
  background: var(--green-100);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: 14px;
}
.auth-card h1 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.9rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.auth-card p.sub { margin: 0 0 24px; color: var(--ink-soft); font-size: 0.92rem; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: 1rem;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 4px var(--green-100);
  background: var(--surface);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 20px;
  border-radius: var(--radius-pill);
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.18s ease, opacity 0.15s ease;
  text-decoration: none;
}
.btn:active { transform: scale(0.96); }
.btn-primary {
  background: linear-gradient(135deg, var(--green-500), var(--green-600));
  color: white;
  width: 100%;
  box-shadow: var(--shadow-green);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
}
.btn-danger { background: var(--danger); color: white; box-shadow: 0 8px 20px rgba(220,38,38,0.28); }
.btn-small { padding: 9px 16px; font-size: 0.85rem; }
.error-msg {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 14px;
  font-weight: 600;
}

/* --- App Shell --- */
.topbar {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(14px);
  color: var(--ink);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
}
.topbar .brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 9px;
}
.topbar .brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--green-500);
  box-shadow: 0 0 0 4px var(--green-100);
}
.topbar .user {
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar .user button {
  background: var(--bg);
  border: none;
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-family: var(--font-body);
  font-weight: 700;
  cursor: pointer;
}

main { flex: 1; padding: 18px; padding-bottom: 32px; max-width: 720px; margin: 0 auto; width: 100%; }

@media (min-width: 1100px) {
  main { max-width: 1400px; padding: 28px 32px; }
}

/* Mehrspaltiges Widget-Raster fuer breite Bildschirme (Tiere, Silo, Produktion etc.) */
.widget-grid { display: block; }
@media (min-width: 1100px) {
  .widget-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; align-items: start; }
  .widget-grid .card { margin-bottom: 0; }
}

/* Icon-Badges (Stall-Hauptsymbol) und kleinere Avatare (pro Zeile) */
.icon-badge {
  width: 52px; height: 52px; min-width: 52px; border-radius: var(--radius);
  background: var(--green-50); display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem;
}
.icon-avatar {
  width: 40px; height: 40px; min-width: 40px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
}

/* Pill-Badge (z.B. Gesundheit) im Bootstrap-Stil */
.pill-badge {
  display: inline-block; padding: 5px 12px; border-radius: var(--radius-pill);
  color: white; font-size: 0.75rem; font-weight: 700; white-space: nowrap;
}

/* --- Seitenleiste (ersetzt die alte Bottom-Tabbar) --- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: stretch;
  padding: 16px 12px calc(16px + env(safe-area-inset-bottom));
  gap: 4px;
  overflow-y: auto;
  z-index: 15;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  box-shadow: 0 0 30px rgba(0,0,0,0.25);
}
.sidebar.sidebar-open { transform: translateX(0); }
.sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 14;
}
.sidebar-brand {
  display: flex; align-items: center; justify-content: flex-start; gap: 9px;
  padding: 4px 6px 16px;
  font-family: var(--font-display); font-weight: 700; color: var(--ink);
}
.sidebar-brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green-500); box-shadow: 0 0 0 4px var(--green-100); }
.sidebar-brand-text { display: inline; font-size: 1.05rem; }
.sidebar button {
  width: 100%;
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: row; align-items: center; justify-content: flex-start;
  gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--ink-faint); font-size: 0.85rem; font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar button .icon { font-size: 1.1rem; }
.sidebar button.active {
  color: white;
  background: linear-gradient(135deg, var(--green-500), var(--green-600));
}
.content-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sidebar-hidden-brand { display: flex; }
.menu-toggle {
  background: var(--bg); border: none; border-radius: var(--radius-sm);
  width: 38px; height: 38px; font-size: 1.15rem; cursor: pointer; color: var(--ink);
  margin-right: 8px;
}

@media (min-width: 820px) {
  .sidebar { width: 210px; transform: none; box-shadow: none; padding: 16px 12px; }
  .sidebar-backdrop { display: none; }
  .content-col { margin-left: 210px; }
  .menu-toggle { display: none; }
  .sidebar-hidden-brand { display: none; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.card h2, .card h3 { margin-top: 0; font-family: var(--font-display); font-weight: 700; color: var(--ink); }
.section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  font-weight: 700;
  margin: 24px 0 10px;
}
.section-title:first-child { margin-top: 0; }

.task-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--border);
}
.task-item.task-mine {
  background: var(--green-50);
  border-radius: var(--radius-sm);
  padding: 13px 12px;
  margin: 2px 0;
  border-top: none;
  border-left: 3px solid var(--green-500);
}
.task-item:first-child { border-top: none; }
.check {
  width: 25px; height: 25px; min-width: 25px; border-radius: var(--radius-pill);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.85rem; color: white;
  margin-top: 2px;
  font-weight: 700;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}
.check:active { transform: scale(0.88); }
.check.done { background: var(--green-500); border-color: var(--green-500); }
.task-body { flex: 1; }
.task-title { font-weight: 600; }
.task-title.done { text-decoration: line-through; color: var(--ink-faint); }
.task-desc { font-size: 0.85rem; color: var(--ink-soft); margin-top: 2px; }
.task-meta {
  font-size: 0.72rem;
  color: var(--ink-faint);
  margin-top: 7px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  font-weight: 500;
}

/* Klare Farb-Pills statt Stempel-Optik */
.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}
.badge.cat-feld { background: var(--green-100); color: var(--green-700); }
.badge.cat-tiere { background: var(--amber-100); color: #92400e; }
.badge.cat-fahrzeuge { background: var(--blue-100); color: #1d4ed8; }
.badge.cat-allgemein { background: var(--clay-100); color: #9a3412; }

.task-delete {
  background: none; border: none; color: var(--ink-faint);
  font-size: 1.05rem; cursor: pointer; padding: 4px;
  border-radius: 6px;
}
.task-delete:hover { color: var(--danger); background: var(--danger-bg); }

.fab {
  position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%;
  background: linear-gradient(135deg, var(--green-500), var(--green-600));
  color: white; font-size: 1.8rem;
  border: none; box-shadow: var(--shadow-green);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  z-index: 9;
  font-weight: 500;
}
.fab:active { transform: scale(0.92); }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 15px;
}
.stat-box .label {
  font-size: 0.68rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}
.stat-box .value {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--ink);
  margin-top: 4px;
}

.list-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}
.list-row:first-child { border-top: none; }
.list-row .name { font-weight: 600; }
.list-row .sub { font-size: 0.74rem; color: var(--ink-faint); font-weight: 500; }
.health-bar { width: 72px; height: 7px; border-radius: var(--radius-pill); background: var(--border); overflow: hidden; }
.health-bar > div { height: 100%; background: linear-gradient(90deg, var(--green-500), var(--green-600)); border-radius: var(--radius-pill); }

.empty-state { text-align: center; padding: 44px 16px; color: var(--ink-faint); }
.empty-state .emoji {
  font-size: 1.9rem;
  margin-bottom: 12px;
  width: 60px; height: 60px;
  display: flex; align-items: center; justify-content: center;
  margin-left: auto; margin-right: auto;
  background: var(--green-50);
  border-radius: 50%;
}

.sync-note { font-size: 0.75rem; color: var(--ink-faint); text-align: center; margin-top: 12px; font-weight: 500; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16,21,27,0.5);
  display: flex; align-items: flex-end; justify-content: center; z-index: 20;
  backdrop-filter: blur(2px);
}
.modal-sheet {
  background: var(--surface); width: 100%; max-width: 480px;
  border-radius: 24px 24px 0 0; padding: 22px; padding-bottom: max(22px, env(safe-area-inset-bottom));
  max-height: 85vh; overflow-y: auto;
}
.modal-sheet h3 { margin-top: 0; font-family: var(--font-display); font-weight: 700; color: var(--ink); }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

@media (min-width: 640px) {
  .modal-backdrop { align-items: center; }
  .modal-sheet { border-radius: var(--radius-lg); }
}

/* ============================================================
   THEME: Neon Harvest — dunkler, mutigerer Zweit-Look
   Wird per body.theme-neon aktiviert (siehe Einstellungen-Menue)
   ============================================================ */
body.theme-neon {
  --ink: #eef4f0;
  --ink-soft: #a9b8ae;
  --ink-faint: #6d7d73;

  --bg: #0a0f0c;
  --surface: #121a15;
  --surface-2: #182219;
  --border: #223327;

  --green-700: #0fa055;
  --green-600: #16c26a;
  --green-500: #22e07a;
  --green-100: #123321;
  --green-50: #0f2318;

  --amber-500: #ffb020;
  --amber-100: #2e2410;

  --blue-500: #4da3ff;
  --blue-100: #10202e;

  --clay-500: #ff8a5c;
  --clay-100: #2c1a12;

  --danger: #ff5470;
  --danger-bg: #2b0f16;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 12px 32px rgba(0,0,0,0.55);
  --shadow-green: 0 0 28px rgba(34,224,122,0.35), 0 10px 24px rgba(0,0,0,0.5);

  background: var(--bg);
  color: var(--ink);
}

body.theme-neon .surface,
body.theme-neon .card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

body.theme-neon .topbar,
body.theme-neon .sidebar {
  background: var(--surface);
  border-color: var(--border);
}
body.theme-neon .menu-toggle {
  background: var(--surface-2);
  color: var(--ink);
}
body.theme-neon .topbar .user button {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--border);
}

body.theme-neon .sidebar button.active {
  color: white;
  text-shadow: 0 0 12px rgba(34,224,122,0.6);
}

body.theme-neon .field input,
body.theme-neon .field select,
body.theme-neon .field textarea {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--ink);
}
body.theme-neon .field input:focus,
body.theme-neon .field select:focus,
body.theme-neon .field textarea:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 4px rgba(34,224,122,0.18);
  background: var(--surface);
}

body.theme-neon .btn-primary {
  background: linear-gradient(135deg, var(--green-500), var(--green-600));
  color: #06170d;
}
body.theme-neon .btn-ghost { color: var(--ink-soft); }
body.theme-neon .task-delete { color: var(--ink-faint); }
body.theme-neon .task-delete:hover { color: var(--danger); background: var(--danger-bg); }

body.theme-neon .check { border-color: var(--border); }
body.theme-neon .check.done { background: var(--green-500); border-color: var(--green-500); box-shadow: 0 0 12px rgba(34,224,122,0.5); }

body.theme-neon .task-title.done,
body.theme-neon .stat-box .label,
body.theme-neon .list-row .sub,
body.theme-neon .task-meta { color: var(--ink-faint); }

body.theme-neon .stat-box,
body.theme-neon .modal-sheet {
  background: var(--surface);
  border-color: var(--border);
}

body.theme-neon .stat-box .value { color: var(--green-500); text-shadow: 0 0 16px rgba(34,224,122,0.35); }

body.theme-neon .health-bar { background: var(--border); }
body.theme-neon .health-bar > div { background: linear-gradient(90deg, var(--green-600), var(--green-500)); box-shadow: 0 0 8px rgba(34,224,122,0.5); }

body.theme-neon .fab {
  background: linear-gradient(135deg, var(--green-500), var(--green-600));
  color: #06170d;
  box-shadow: var(--shadow-green);
}

body.theme-neon .auth-screen { background: #05080a; }
body.theme-neon .auth-screen::before { background: radial-gradient(circle, #22e07a, transparent 70%); opacity: 0.4; }
body.theme-neon .auth-screen::after { background: radial-gradient(circle, #ffb020, transparent 70%); opacity: 0.22; }
body.theme-neon .auth-card {
  background: rgba(18,26,21,0.92);
  border-color: var(--border);
  color: var(--ink);
}
body.theme-neon .auth-card p.sub { color: var(--ink-soft); }
body.theme-neon .auth-eyebrow { background: var(--green-100); color: var(--green-500); }

body.theme-neon .modal-backdrop { background: rgba(0,0,0,0.7); }
