/* ==========================================================
   100 gute Entscheidungen — Design-System
   Warm, freundlich, mobil zuerst.
   ========================================================== */

:root {
  --bg: #faf5ec;
  --card: #fffdf9;
  --ink: #33302b;
  --muted: #8b8378;
  --line: #e9e1d3;
  --primary: #e07a5f;      /* Terracotta */
  --primary-dark: #c9634a;
  --green: #3d8f83;
  --honey: #e9b44c;
  --danger: #d1495b;
  --radius: 18px;
  --shadow: 0 2px 10px rgba(70, 55, 40, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 1.4rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
a { color: var(--primary-dark); }

.muted { color: var(--muted); font-size: .9rem; text-decoration: none; }

/* ---------- Kopfzeile & Navigation ---------- */

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar__inner {
  max-width: 640px;
  margin: 0 auto;
  padding: .7rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .3rem .75rem;
}

.brand {
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--primary-dark);
  text-transform: uppercase;
  font-size: .95rem;
}

.brand em { color: var(--green); font-style: normal; }

.brand--big {
  font-size: 1.3rem;
  display: block;
  text-align: center;
  margin-bottom: .25rem;
}

.nav { display: flex; align-items: center; gap: .1rem; flex-wrap: wrap; }

/* Burger-Button: nur auf schmalen Screens sichtbar */
.burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}

.burger span {
  display: block;
  height: 2.5px;
  width: 100%;
  border-radius: 2px;
  background: var(--ink);
  transition: transform .2s ease, opacity .2s ease;
}

.burger.is-open span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.burger.is-open span:nth-child(2) { opacity: 0; }
.burger.is-open span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

@media (max-width: 699px) {
  .burger { display: flex; }

  .nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: .2rem;
    padding: .5rem 0 .75rem;
  }

  .nav.is-open { display: flex; }

  .nav__link {
    font-size: 1rem;
    padding: .6rem .8rem;
    border-radius: 12px;
  }

  .nav form:has(> .nav__link--button) { display: block; }

  .nav__link--button {
    display: block;
    width: 100%;
    text-align: left;
  }
}

.nav__link {
  padding: .35rem .6rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 600;
}

.nav__link.is-active { background: var(--bg); color: var(--ink); }
.nav__link:active { background: var(--line); }

.nav__link--button {
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: .88rem;
  font-weight: 600;
  color: var(--muted);
}

form:has(> .nav__link--button) { display: inline; }

/* ---------- Seiten-Layout ---------- */

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.25rem 1rem 4rem;
}

.page--center {
  min-height: 100svh;
  display: grid;
  place-items: center;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
}

.card--login { width: min(92vw, 380px); text-align: center; }
.card--login .form { text-align: left; margin-top: 1.25rem; }

.flash {
  max-width: 640px;
  margin: .75rem auto 0;
  padding: .6rem 1rem;
  border-radius: 12px;
  font-size: .92rem;
}

.flash--notice { background: #e3efe0; color: #2e5d33; }
.flash--alert  { background: #f7e0e0; color: #8f2f3b; }

/* ---------- Formulare ---------- */

.form .field { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .3rem; }

.form label { font-weight: 600; font-size: .9rem; }

.form input[type="text"],
.form input[type="password"],
.form input[type="number"] {
  padding: .65rem .8rem;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font: inherit;
  background: #fff;
}

.form input:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }

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

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  border: 0;
  border-radius: 999px;
  padding: .65rem 1.3rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: transform .06s ease;
}

.btn:active { transform: scale(.97); }

.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); }
.btn--ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--small { padding: .35rem .8rem; font-size: .85rem; }
.btn--block { width: 100%; }

.btn--big {
  display: block;
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1.05rem;
  margin: 1.5rem 0;
  box-shadow: 0 4px 14px rgba(224, 122, 95, .35);
}

/* ---------- Dashboard: Fortschritt & Grid ---------- */

.progress-pill {
  background: var(--green);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  border-radius: var(--radius);
  padding: .6rem;
  margin-bottom: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.dots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .55rem;
  justify-items: center;
  max-width: 360px;
  margin: 0 auto;
  transform: scaleY(-1); /* füllt von unten nach oben */
}

@media (min-width: 700px) {
  .dots {
    grid-template-columns: repeat(10, 1fr);
    max-width: 680px;
  }
}

.dot {
  width: clamp(26px, 9vw, 44px);
  height: clamp(26px, 9vw, 44px);
  border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, var(--member-color, var(--primary)) 55%, var(--line));
  transition: background .25s ease, transform .25s ease;
}

.dot--filled {
  background: var(--member-color, var(--primary));
  border-color: var(--member-color, var(--primary));
}

.dot--latest {
  transform: scale(1.12);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--member-color, var(--primary)) 30%, transparent);
}

/* ---------- Kontext-Sheet (Modal) ---------- */

.sheet {
  border: 0;
  border-radius: 22px 22px 0 0;
  padding: 0;
  width: 100%;
  max-width: 640px;
  margin: auto auto 0;
  background: var(--card);
  box-shadow: 0 -6px 30px rgba(50, 40, 30, .25);
}

@media (min-width: 640px) {
  .sheet { border-radius: 22px; margin: auto; }
}

.sheet::backdrop { background: rgba(50, 40, 30, .45); }

.sheet__inner { padding: 1.25rem 1.25rem 1.5rem; }

.sheet__actions {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
  margin-top: 1rem;
}

.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }

.chip { position: relative; }

.chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.chip span {
  display: inline-block;
  padding: .45rem .9rem;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
}

.chip input:checked + span {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.chip--color span {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  border: 3px solid transparent;
}

.chip--color input:checked + span {
  border-color: var(--ink);
  transform: scale(1.1);
}

/* ---------- Familien-Log ---------- */

.log { margin-top: 2rem; }
.log__title { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }

.log__list { list-style: none; margin: 0 0 .75rem; padding: 0; }

.log__item {
  display: flex;
  align-items: baseline;
  gap: .55rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .95rem;
}

.log__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  align-self: center;
}

.log__text { flex: 1; }
.log__time { color: var(--muted); font-size: .8rem; white-space: nowrap; }

/* ---------- Familien-Seite ---------- */

.family-total {
  text-align: center;
  margin: 1rem 0 1.5rem;
}

.family-total__number {
  display: block;
  font-size: 3rem;
  font-weight: 800;
  color: var(--green);
  line-height: 1.1;
}

.family-total__label { color: var(--muted); }

.member-cards { display: grid; gap: .75rem; }

.member-card__head {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .5rem;
}

.member-card__head .muted { margin-left: auto; font-variant-numeric: tabular-nums; }

.member-card__cycles { margin: .5rem 0 0; }

.meter {
  height: 10px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}

.meter__fill { height: 100%; border-radius: 999px; transition: width .4s ease; }

/* ---------- Historie ---------- */

.cycle-list { list-style: none; padding: 0; display: grid; gap: .75rem; margin-top: 1rem; }

.cycle-list__item { display: flex; align-items: center; gap: 1rem; }

.cycle-list__badge {
  background: var(--honey);
  color: #5c4a14;
  font-weight: 800;
  border-radius: 12px;
  padding: .4rem .6rem;
  white-space: nowrap;
}

.cycle-list__item p { margin: 0; }

/* ---------- Admin ---------- */

.admin-head { margin-bottom: 1rem; }

.subnav { display: flex; gap: .25rem; margin-bottom: 1rem; }

.subnav__link {
  padding: .4rem .8rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: .9rem;
}

.subnav__link.is-active { background: var(--card); border: 1px solid var(--line); color: var(--ink); }

.admin-list { list-style: none; padding: 0; display: grid; gap: .6rem; margin-top: 1rem; }

.admin-list__item { display: flex; align-items: center; gap: .7rem; }

.admin-list__text { flex: 1; display: flex; flex-direction: column; }

.admin-list__actions { display: flex; gap: .4rem; align-items: center; }

.admin-list__actions form { display: inline; }

/* ---------- Konfetti & Feier ---------- */

.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 100;
}

.celebration {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: rgba(50, 40, 30, .55);
  animation: fade-in .3s ease;
}

.celebration__card {
  background: var(--card);
  border-radius: 24px;
  padding: 2rem 1.75rem;
  text-align: center;
  width: min(88vw, 420px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}

.celebration__hundred {
  display: block;
  font-size: 4rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: .5rem;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
