/* Stallplan – Design
   Mobil zuerst: große Tippflächen, hoher Kontrast (Stall, Handschuhe, Sonnenlicht).
   Farben sind oben als Variablen definiert und können dort zentral geändert werden. */

:root {
  --ink: #1c2a23;          /* Text */
  --muted: #5f6f66;        /* Nebentext */
  --bg: #edf0ea;           /* Seitenhintergrund */
  --card: #ffffff;
  --line: #d8dfd4;
  --green: #25503c;        /* Hauptfarbe: Weide */
  --green-soft: #dcebe2;
  --hay: #e9c25a;          /* Akzent: Heu, markiert "offen" */
  --hay-soft: #faf0cc;
  --danger: #a8362c;
  --radius: 14px;
  --nav-h: 60px;
  font-size: 17px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

h1, h2 { margin: 0; line-height: 1.15; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.1rem; }
p { margin: 0; }
a { color: var(--green); }
img { max-width: 100%; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--hay); outline-offset: 2px; }

/* ---------- Navigation: unten auf dem Handy, oben am Rechner ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--green);
}
.nav .brand { display: none; }
.nav a {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: #cfe2d6; text-decoration: none; font-weight: 600; font-size: 1.05rem;
  border-top: 4px solid transparent;
}
.nav a.on { color: #fff; border-top-color: var(--hay); }

.page {
  max-width: 760px; margin: 0 auto;
  padding: 20px 16px calc(var(--nav-h) + 32px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 720px) {
  .nav {
    position: sticky; top: 0; bottom: auto; height: 56px; padding: 0 24px;
    justify-content: flex-start; gap: 8px;
  }
  .nav .brand { display: block; color: #fff; font-weight: 700; font-size: 1.15rem; margin-right: 24px; align-self: center; }
  .nav a { flex: 0 0 auto; padding: 0 16px; border-top: 0; border-bottom: 4px solid transparent; }
  .nav a.on { border-bottom-color: var(--hay); }
  .page { padding: 32px 24px 48px; }
}

/* ---------- Kopfbereiche ---------- */
.page-head { margin-bottom: 16px; }
.page-head.row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.sub, .muted { color: var(--muted); }
.back { display: inline-block; margin-bottom: 12px; padding: 6px 0; text-decoration: none; font-weight: 600; }
.section-title { margin: 24px 0 10px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 20px;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  color: #fff; background: var(--green);
  border: 2px solid var(--green); border-radius: 12px;
}
.btn:hover { background: #1c3d2e; }
.btn.ghost { background: transparent; color: var(--green); }
.btn.ghost:hover { background: var(--green-soft); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: #fbe9e7; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: .95rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

/* ---------- Fortschritt und Filter (Startseite) ---------- */
.progress { margin: 4px 0 14px; }
.progress p { font-weight: 600; margin-bottom: 8px; }
.bar { height: 12px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; background: var(--green); border-radius: 99px; transition: width .25s ease; }

.seg { display: flex; gap: 6px; margin-bottom: 18px; }
.seg button {
  flex: 1; min-height: 44px; font: inherit; font-weight: 600; cursor: pointer;
  color: var(--ink); background: var(--card); border: 2px solid var(--line); border-radius: 10px;
}
.seg button[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }

/* ---------- Tageszeit-Gruppen ---------- */
.slot { margin-bottom: 22px; }
.slot h2 {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 8px 14px; margin-bottom: 8px;
  background: var(--hay-soft); border-left: 6px solid var(--hay); border-radius: 8px;
}
.slot-count { font-size: .95rem; font-weight: 600; color: var(--muted); }
.slot.complete h2 { background: var(--green-soft); border-left-color: var(--green); }

/* ---------- Aufgabenzeilen ---------- */
.tasks { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.tasks.card { margin-bottom: 0; }

.task {
  display: flex; align-items: center; gap: 14px;
  min-height: 72px; padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer; user-select: none;
}
.task:last-child { border-bottom: 0; }
.task.setup { cursor: default; user-select: auto; }

.check {
  flex: none; width: 44px; height: 44px; padding: 0; cursor: pointer;
  display: grid; place-items: center;
  background: #fff; border: 3px solid var(--green); border-radius: 50%;
}
.check svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.task.done .check { background: var(--green); }
.task:not(.done) .check svg { stroke: transparent; }

.task-body { flex: 1; min-width: 0; }
.task-main { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 1.1rem; }
.task-what { color: var(--muted); overflow-wrap: anywhere; }
.task-what strong { color: var(--ink); }
.horse-link { font-weight: 700; color: var(--ink); text-decoration: none; }
.horse-link:hover { text-decoration: underline; }
.box-tag { font-size: .85rem; font-weight: 600; padding: 2px 8px; color: var(--green); background: var(--green-soft); border-radius: 99px; }

.done-time { flex: none; font-size: .85rem; color: var(--muted); text-align: right; }

/* Erledigte Aufgaben treten zurück */
.task.done .task-main strong,
.task.done .horse-link { color: var(--muted); text-decoration: line-through; }
.task.done .task-what { opacity: .75; }
.task.done { background: #f7f9f6; }

/* Filter der Startseite */
#today[data-filter="open"] .task.done { display: none; }
#today[data-filter="done"] .task:not(.done) { display: none; }

/* ---------- Pferdeliste ---------- */
.horse-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .horse-grid { grid-template-columns: 1fr 1fr; } }

.horse-card {
  display: flex; align-items: center; gap: 14px; min-height: 84px; padding: 12px 14px;
  color: inherit; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.horse-card:hover { border-color: var(--green); }
.horse-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.horse-info strong { font-size: 1.15rem; }

.chip { flex: none; font-size: .85rem; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--line); color: var(--muted); }
.chip.open { background: var(--hay-soft); color: #6b5410; border: 1px solid var(--hay); }
.chip.ok { background: var(--green-soft); color: var(--green); }

/* ---------- Foto / Avatar ---------- */
.avatar {
  flex: none; width: 56px; height: 56px; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center;
  background: var(--green-soft); color: var(--green); font-weight: 700; font-size: 1.5rem;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.big { width: 88px; height: 88px; font-size: 2.2rem; }

.horse-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }

.notes { margin: 8px 0 0; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.notes h2 { margin-bottom: 6px; font-size: 1rem; color: var(--muted); }
.notes p { white-space: pre-wrap; }

/* ---------- Formulare ---------- */
.card.form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; margin-bottom: 16px; }
.card.form .section-title { margin-top: 0; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; margin-bottom: 6px; font-weight: 600; }
.field small { font-weight: 400; color: var(--muted); }
input[type="text"], input[type="password"], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px;
  font: inherit; color: var(--ink); background: #fff;
  border: 2px solid var(--line); border-radius: 10px;
}
input[type="text"]:focus, input[type="password"]:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); }
input[type="file"] { width: 100%; font: inherit; }
.current-photo { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.check-inline { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.check-inline input { width: 22px; height: 22px; }

.error { margin-bottom: 14px; padding: 12px 14px; background: #fbe9e7; color: var(--danger); border: 1px solid var(--danger); border-radius: 10px; font-weight: 600; }
.danger-zone { margin-top: 28px; }

/* ---------- Leere Zustände ---------- */
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 20px 16px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty-filter { padding: 20px 4px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .bar > div { transition: none; }
}

/* ---------- Anmeldung ---------- */
.login { max-width: 420px; margin: 0 auto; padding-top: 8vh; }
.login .page-head, .login .sub { margin-bottom: 16px; }
.login .btn { width: 100%; }

.page-foot { margin-top: 32px; text-align: center; }
.page-foot button { font: inherit; color: var(--muted); background: none; border: 0; padding: 12px; cursor: pointer; text-decoration: underline; }
