/* Familienplan: Grundlagen (früher von der Umgebung geliefert) */
:root { color-scheme: light; }
html, body { min-height: 100%; }
body { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
/* Layout: one narrow column, big touch targets, four areas (Einkauf, Essen, Aufgaben, Einstellungen) switched by a bottom tab bar. Lists sit in one bordered surface, rows divided by hairlines. */
:root {
  --bg: #EEF2EF;
  --surface: #FFFFFF;
  --surface-2: #E1E9E4;
  --ink: #17211D;
  --muted: #55635D;
  --line: #D0DAD4;
  --accent: #1F6B57;
  --accent-ink: #FFFFFF;
  --accent-soft: #D5EADF;
  --danger: #B3402F;
  --danger-ink: #FFFFFF;
  --warn: #6B4A00;
  --warn-soft: #FBEBC8;
  --toast-bg: #17211D;
  --toast-ink: #EEF2EF;
  --on-member: #14201B;
  --m1: #F08A6C;
  --m2: #F2B84B;
  --m3: #6CC3A0;
  --m4: #7DB4E6;
  --m5: #B996DB;
  --m6: #EE8BB5;
  --font-display: 'Avenir Next', 'Segoe UI Variable Display', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111915;
    --surface: #1A2520;
    --surface-2: #24322C;
    --ink: #E8EFEB;
    --muted: #9AAAA3;
    --line: #2B3A34;
    --accent: #5FBF9F;
    --accent-ink: #0C1A15;
    --accent-soft: #1F3A31;
    --danger: #E58472;
    --danger-ink: #1A0B07;
    --warn: #F2C46B;
    --warn-soft: #3A2E12;
    --toast-bg: #E8EFEB;
    --toast-ink: #111915;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111915;
  --surface: #1A2520;
  --surface-2: #24322C;
  --ink: #E8EFEB;
  --muted: #9AAAA3;
  --line: #2B3A34;
  --accent: #5FBF9F;
  --accent-ink: #0C1A15;
  --accent-soft: #1F3A31;
  --danger: #E58472;
  --danger-ink: #1A0B07;
    --warn: #F2C46B;
    --warn-soft: #3A2E12;
  --toast-bg: #E8EFEB;
  --toast-ink: #111915;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
p { margin: 0; }

.app { max-width: 640px; margin: 0 auto; padding-block: 0 112px; }

.top { padding-block: 22px 14px; }
h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 8vw, 38px);
  line-height: 1.05;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.weeknav { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.weeknav[hidden] { display: none; }
.weeklabel { flex: 1; min-width: 0; text-align: center; line-height: 1.25; }
.weeklabel strong { font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.weeklabel .range { margin-left: 6px; color: var(--muted); font-variant-numeric: tabular-nums; }
.weeklabel .sub { display: block; font-size: 13px; color: var(--muted); }
.weeknav .btn { width: 46px; padding: 0; font-size: 22px; }

.btn {
  min-height: 46px;
  padding: 10px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color .15s;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.sm { min-height: 34px; padding: 4px 12px; font-size: 14px; }
.btn:disabled, .field:disabled { opacity: .55; cursor: not-allowed; }
.linkbtn {
  padding: 6px 4px;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.field {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
select.field { padding-right: 8px; }
.field::placeholder { color: var(--muted); opacity: .85; }
.field:focus { border-color: var(--accent); }
.addrow { display: flex; gap: 8px; }
.addgrid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.addgrid .sel { grid-column: 1 / -1; }

.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.addrow input, .addrow select { min-width: 0; flex: 1 1 auto; }
.h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.rowhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 15px; }
.greet { padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); }

.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.fchip {
  flex: none;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
}
.fchip small { margin-left: 4px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fchip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.fchip[aria-pressed="true"] small { color: inherit; opacity: .85; }
.fchips { display: flex; flex-wrap: wrap; gap: 8px; }

.list {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.list > li { border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.item { display: flex; align-items: center; gap: 8px; min-height: 54px; padding: 4px 6px 4px 8px; }
.item .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.item.done .txt { color: var(--muted); text-decoration: line-through; }
.meta { display: block; font-size: 13px; color: var(--muted); }
.check {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
}
.check i {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 2px solid var(--muted);
  border-radius: 50%;
  color: var(--accent-ink);
  transition: background-color .15s, border-color .15s;
}
.check svg { opacity: 0; }
.check[aria-pressed="true"] i { background: var(--accent); border-color: var(--accent); }
.check[aria-pressed="true"] svg { opacity: 1; }
.x {
  flex: none;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}
.x:hover { color: var(--danger); }
.ask { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.txtbtn { display: block; width: 100%; min-height: 40px; padding: 0; border: 0; background: none; text-align: left; font: inherit; color: inherit; overflow-wrap: anywhere; }
.txtbtn:disabled { cursor: default; }
.mv { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.mv .fchip { min-height: 34px; padding: 0 12px; font-size: 14px; }
.editrow { display: grid; gap: 10px; padding: 12px 12px 12px 14px; background: var(--accent-soft); }
.editbtns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.editbtns .linkbtn { margin-left: auto; color: var(--danger); }
.rolesel { max-width: 100%; }
.selrow { display: flex; flex-wrap: wrap; gap: 8px; }
.selrow .field { min-width: 150px; }
.attn { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 16px; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.attn[hidden] { display: none; }
.attn span { flex: 1; min-width: 180px; }
.attn .btn { background: var(--surface); color: var(--ink); }
.newtag { display: inline-block; padding: 0 7px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.dueover { color: var(--danger); font-weight: 700; }
.duetoday { color: var(--warn); font-weight: 700; }
.grip { flex: none; width: 30px; height: 42px; display: grid; place-items: center; color: var(--muted); touch-action: none; cursor: grab; }
.grp { border-radius: 12px; }
.dropempty { padding: 18px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.ghost { position: fixed; left: 0; top: 0; z-index: 40; max-width: 70vw; padding: 10px 14px; overflow: hidden; border: 1px solid var(--accent); border-radius: 12px; background: var(--surface); box-shadow: 0 6px 20px rgba(0, 0, 0, .25); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.dragging { opacity: .4; }
.droptarget { outline: 2px dashed var(--accent); outline-offset: 2px; border-radius: 12px; }
.fchip.droptarget { background: var(--accent-soft); }
body.dragmode { -webkit-user-select: none; user-select: none; }

.empty { padding: 32px 20px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); display: grid; gap: 12px; justify-items: center; }
.empty strong { display: block; margin-bottom: 4px; font-family: var(--font-display); font-size: 20px; color: var(--ink); }

/* Essensplan */
.meals > li { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 12px; padding: 12px 14px; }
.meals > li.today { background: var(--accent-soft); }
.daylabel { display: grid; justify-items: start; align-content: start; gap: 2px; }
.dn { font-family: var(--font-display); font-size: 21px; font-weight: 700; line-height: 1.1; }
.dd { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tag {
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.slots { display: grid; gap: 4px; min-width: 0; align-content: center; }
.slot { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 8px; }
.slots.one .slot { grid-template-columns: minmax(0, 1fr); }
.slots.one .slot span { display: none; }
.slot span { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.slot input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.slot input:focus { outline: none; border-bottom-color: var(--accent); box-shadow: 0 1px 0 var(--accent); }
.slot input::placeholder { color: var(--muted); opacity: .7; }

/* Aufgaben */
.person { display: grid; gap: 10px; }
.phead { display: flex; align-items: center; gap: 10px; }
.av {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--on-member);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
}
.av.sm { width: 28px; height: 28px; font-size: 14px; }
.pname { flex: 1; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; }
.pname strong { font-family: var(--font-display); font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.me { padding: 1px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.pcount { flex: none; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 6px; overflow: hidden; border-radius: 99px; background: var(--surface-2); }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .25s; }
.toolrow { display: flex; }
.toolrow .btn { flex: 1; }

/* Einstellungen */
.panel { display: grid; gap: 12px; padding: 18px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel p { color: var(--muted); font-size: 15px; }
.panel p strong { color: var(--ink); }
.panel .list { border-radius: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 4px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); }
.chip b { padding-left: 4px; font-weight: 600; overflow-wrap: anywhere; }
.chip .x { width: 32px; height: 32px; font-size: 20px; }
.chip:not(:has(.av)) b { padding-left: 10px; }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.suggest .fchip { min-height: 34px; padding: 0 12px; font-size: 14px; font-weight: 500; border-style: dashed; }
.urow { display: grid; gap: 8px; padding: 12px 8px 12px 14px; }
.urow-top { display: flex; align-items: center; gap: 8px; }
.urow-top .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.urow.pending { background: var(--accent-soft); }
.urow-sel { display: flex; gap: 8px; flex-wrap: wrap; padding-right: 6px; }
.rec-who { color: var(--muted); }

.welcome { display: grid; gap: 16px; }
.welcome > p { color: var(--muted); }
.picks { display: grid; gap: 8px; }
.pick {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
  font-weight: 600;
  font-size: 17px;
}
.pick:hover { border-color: var(--accent); }

.status { margin-bottom: 16px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 15px; }

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 6px max(16px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
body.gate .tabs { display: none; }
.tabs-in { display: flex; gap: 6px; max-width: 640px; margin: 0 auto; }
.tabs a {
  position: relative;
  flex: 1;
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px 2px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.tabs a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.badge {
  position: absolute;
  top: 3px;
  left: calc(50% + 6px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: 99px;
  background: var(--danger);
  color: var(--danger-ink);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.badge[hidden] { display: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  width: max-content;
  max-width: calc(100% - 32px);
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--toast-bg);
  color: var(--toast-ink);
  font-size: 15px;
  text-align: center;
}
.toast[hidden] { display: none; }
body.gate .toast { bottom: 24px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- Anmeldung ---- */
.auth { display: grid; gap: 16px; max-width: 420px; margin: 8px auto 0; }
.auth .panel { gap: 14px; }
.auth h2 { margin: 0; font-family: var(--font-display); font-size: 24px; font-weight: 700; }
.auth label { display: grid; gap: 6px; font-weight: 600; font-size: 15px; }
.auth .field { width: 100%; }
.auth .btn.primary { width: 100%; }
.auth .links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.formerr { padding: 10px 12px; border-radius: 10px; background: var(--danger); color: var(--danger-ink); font-size: 15px; }
.formok { padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--ink); font-size: 15px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.brand i { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--accent); color: var(--accent-ink); }

/* ---- Verwaltung ---- */
.formgrid { display: grid; gap: 10px; }
.formgrid .field { width: 100%; }
.formgrid label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; color: var(--muted); }
.copyrow { display: flex; gap: 8px; }
.copyrow .field { font-size: 13px; }
.btn.danger { background: var(--danger); color: var(--danger-ink); }
details.fold { border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; }
details.fold summary { cursor: pointer; font-weight: 600; min-height: 30px; display: flex; align-items: center; }
details.fold[open] summary { margin-bottom: 10px; }
.state-off { opacity: .7; }
.urow .meta .off { color: var(--danger); font-weight: 700; }
.who { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.noscript { padding: 24px 16px; text-align: center; }

:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }

.list > li.ins-before { box-shadow: 0 -3px 0 0 var(--accent); }
.list > li.ins-after { box-shadow: 0 3px 0 0 var(--accent); }

.plus { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface, transparent); color: var(--accent, currentColor); font-size: 22px; line-height: 1; display: grid; place-items: center; cursor: pointer; padding: 0 0 2px; transition: transform .15s; }
.plus.open { transform: rotate(45deg); }
.addrow.inl { margin-bottom: 8px; }

.addrow.stacked { flex-direction: column; align-items: stretch; }
.addrow.stacked input, .addrow.stacked .btn { width: 100%; max-width: 100%; box-sizing: border-box; }
.fchips .fchip { white-space: normal; text-align: left; max-width: 100%; height: auto; min-height: 40px; }
