:root {
  --bg: #f6f7f9; --card: #ffffff; --text: #1c2430; --muted: #667085; --line: #d8dde5;
  --primary: #1f6fb5; --danger: #b42318; --ok: #1a7f4b; --warn: #b54708;
  --c-familie: #6b7280; --radius: 10px;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
a { color: var(--primary); }
main { max-width: 980px; margin: 0 auto; padding: 1rem; }
main.wide { max-width: 1500px; }
[hidden] { display: none !important; }

.topbar { display: flex; align-items: center; gap: 1rem; padding: .5rem 1rem; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); }
.topbar nav { display: flex; gap: .2rem; flex-wrap: wrap; flex: 1; }
.topbar nav a { padding: .4rem .65rem; border-radius: 8px; text-decoration: none; color: var(--text); }
.topbar nav a.active { background: #e6f0fa; color: var(--primary); font-weight: 600; }
.topbar nav a:hover { background: #eef1f5; }
.nav-toggle { display: none; }
.who { display: flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .9rem; }
.badge { background: var(--danger); color: #fff; border-radius: 999px; font-size: .7rem; padding: .05rem .4rem; margin-left: .3rem; }
@media (max-width: 800px) {
  .nav-toggle { display: inline-block; margin-left: auto; }
  .topbar nav { display: none; flex-basis: 100%; flex-direction: column; }
  .topbar nav.open { display: flex; }
}

button, .button { font: inherit; padding: .45rem .8rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); cursor: pointer; min-height: 2.3rem; }
button:hover { background: #eef1f5; }
a.button { display: inline-block; text-decoration: none; line-height: 1.4; }
.conflict-versions > .card { flex: 1; min-width: 240px; margin-bottom: .6rem; }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--danger); border-color: #f0c2bd; }
button.link { border: 0; background: none; color: var(--primary); padding: 0 .3rem; min-height: 0; text-decoration: underline; }
button.big { font-size: 1.1rem; padding: .8rem 1.2rem; width: 100%; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: .4rem .5rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); max-width: 100%; }
textarea { width: 100%; }
label { display: flex; flex-direction: column; gap: .2rem; font-size: .9rem; color: var(--muted); }
label.check, label.chip, label.switch { flex-direction: row; align-items: center; gap: .35rem; color: var(--text); }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .4rem .7rem .6rem; margin: 0; }
fieldset.inline { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; }
legend { font-size: .85rem; color: var(--muted); padding: 0 .3rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.card.narrow { max-width: 420px; margin: 3rem auto; }
.row { display: flex; gap: .8rem; flex-wrap: wrap; align-items: flex-end; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .7rem; align-items: end; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .9rem; margin: .2rem 0 .6rem; }
.error { color: var(--danger); background: #fdecea; border-radius: 8px; padding: .5rem .7rem; }
.info { color: var(--ok); background: #e7f6ee; border-radius: 8px; padding: .5rem .7rem; }
.secret { font-family: ui-monospace, monospace; background: #fff8e1; border: 1px dashed var(--warn); border-radius: 8px; padding: .6rem; word-break: break-all; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid #eef1f5; flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.list.small li { font-size: .85rem; padding: .2rem 0; }
.dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; background: var(--c-familie); }
.dot-papa { background: var(--c-papa); } .dot-mama { background: var(--c-mama); }
.dot-sohn { background: var(--c-sohn); } .dot-tochter { background: var(--c-tochter); }
.hh { padding: 0 .35rem; border-radius: 5px; }
.hh-papa { background: var(--h-papa); } .hh-mama { background: var(--h-mama); }
.toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: #1c2430; color: #fff; padding: .6rem 1rem; border-radius: 8px; z-index: 100; max-width: 90vw; }
.toast.err { background: var(--danger); }
.dev-login { display: flex; gap: .5rem; flex-wrap: wrap; }

/* calendar */
.cal-toolbar { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-bottom: .6rem; }
.layers { display: flex; gap: .3rem; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: .15rem .6rem; background: #fff; font-size: .85rem; cursor: pointer; }
.search { position: relative; margin-left: auto; }
.dropdown { position: absolute; right: 0; top: 100%; z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: 8px; list-style: none; margin: .2rem 0 0; padding: .2rem; min-width: 280px; max-height: 50vh; overflow: auto; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.dropdown li { padding: .4rem .5rem; border-radius: 6px; cursor: pointer; }
.dropdown li:hover { background: #eef1f5; }
#calendar { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; }
.fc .fc-toolbar-title { font-size: 1.2rem; }
.fc-event.tentative { opacity: .65; border-style: dashed !important; border-width: 2px !important; background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.35) 0 6px, transparent 6px 12px); }
.fc-event.private .fc-event-title::before { content: "🔒 "; }
.fc .fc-daygrid-day-frame { position: relative; }
.kal-deco { display: flex; gap: 3px; align-items: center; font-size: .68rem; line-height: 1.1; pointer-events: none; flex-wrap: wrap; }
.fc-daygrid-day .kal-deco { position: absolute; left: 3px; right: 3px; bottom: 2px; z-index: 1; }
.fc-daygrid-day-events { margin-bottom: 1.3em !important; }
.kal-custody { display: inline-block; min-width: 1.5em; text-align: center; border-radius: 4px; padding: 0 3px; border: 1px solid rgba(0,0,0,.18); color: #1c2430; }
.kal-custody.pending { border: 2px dashed #b54708; }
.kal-holiday { color: var(--danger); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.kal-ferien { color: #7a5b00; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.fc-day.is-ferien { background-image: linear-gradient(rgba(255, 221, 87, .16), rgba(255, 221, 87, .16)); }
.fc-day.is-feiertag { background-image: linear-gradient(rgba(240, 100, 90, .14), rgba(240, 100, 90, .14)); }

.dialog { border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem; width: min(680px, 96vw); max-height: 94vh; overflow: auto; }
.dialog.small { width: min(460px, 96vw); }
.dialog::backdrop { background: rgba(20, 25, 35, .45); }
.dialog form { display: flex; flex-direction: column; gap: .7rem; }
.dialog input[type=text], .dialog #ev-title { width: 100%; }

/* lists: to-dos, routines, packing lists */
.todo.done .todo-title, .fc-event.done .fc-event-title, .fc-event.done .fc-list-event-title { text-decoration: line-through; opacity: .65; }
.overdue { color: var(--danger) !important; font-weight: 600; }
.ok-mark { color: var(--ok); font-weight: 600; font-size: .9rem; }
.checklist li { justify-content: flex-start; }
.checklist input[type=checkbox], .todo input[type=checkbox] { width: 1.25rem; height: 1.25rem; }
details.inline-form { display: inline-block; }
details.inline-form > summary { cursor: pointer; color: var(--primary); list-style: none; padding: .3rem .5rem; }
details.inline-form[open] { display: block; flex-basis: 100%; padding: .4rem 0; }
details.template { padding: .4rem 0; border-bottom: 1px solid #eef1f5; }
details.template > summary { cursor: pointer; }
fieldset.packlist { display: flex; flex-direction: column; gap: .25rem; }

/* meals and recipes */
.tabs { display: flex; gap: .3rem; }
.tab { padding: .4rem .9rem; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--text); background: #fff; }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.meal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: .8rem; }
.mealday.today { outline: 2px solid var(--primary); }
.mealday h2 { margin-bottom: .1rem; }
.mealslot { border-top: 1px solid #eef1f5; padding-top: .4rem; margin-top: .4rem; }
.mealslot.inactive { opacity: .55; }
.mealslot h3 { margin: 0 0 .3rem; display: flex; justify-content: space-between; }
.decision { background: #e7f6ee; border-radius: 8px; padding: .35rem .5rem; margin: .2rem 0; }
.proposal.chosen { font-weight: 600; }
.vote.mine { background: #e6f0fa; border-color: var(--primary); }
.decide-form { display: inline-flex; gap: .3rem; }
.decide-form input { width: 3.5rem; }
.propose-form select, .propose-form input { flex: 1; min-width: 0; }
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; }
.recipe-card { display: flex; flex-direction: column; gap: .3rem; text-decoration: none; color: var(--text); margin: 0; }
.recipe-card img { width: 100%; height: 130px; object-fit: cover; border-radius: 8px; }
.recipe-image { max-width: 100%; max-height: 320px; border-radius: 10px; }
.tag { display: inline-block; font-size: .75rem; padding: .05rem .45rem; border-radius: 999px; background: #eef1f5; margin-right: .2rem; }
.tag-entwurf { background: #fff3cd; color: #7a5b00; }
.tag-haeufig { background: #e7f6ee; color: var(--ok); }
.grid-form .full { grid-column: 1 / -1; }

/* shopping */
.shop-group { margin: .8rem 0 .2rem; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.shop-item { justify-content: space-between !important; }
.shop-item.done .shop-name { text-decoration: line-through; opacity: .6; }
.shop-item.pending .shop-name::after { content: " ⏳"; }
.shop-source { font-size: .8rem; }
#shop-add input { flex: 1; }

/* wall view (kiosk, from 15 inch, landscape and portrait) */
body.wall { font-size: clamp(18px, 1.35vw + .5vh, 30px); background: #eef1f5; }
main.wall-main { max-width: none; padding: .8rem; }
.wall-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .7rem; }
.wall-day { font-size: 1.7em; font-weight: 700; }
.wall-date { font-size: 1.3em; color: var(--muted); }
.wall-stays { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.wall-stay { padding: .25em .7em; border-radius: 999px; border: 1px solid rgba(0,0,0,.15); background: #fff; }
.wall-grid { display: grid; gap: .8rem; grid-template-columns: 1.3fr 1fr 1fr; align-items: start; }
.wall-events { grid-row: span 2; }
@media (orientation: portrait), (max-width: 1100px) { .wall-grid { grid-template-columns: 1fr 1fr; } .wall-events { grid-column: 1 / -1; grid-row: auto; } }
@media (max-width: 700px) { .wall-grid { grid-template-columns: 1fr; } }
.wall-card { background: #fff; border-radius: 14px; padding: .8em 1em; border: 1px solid var(--line); }
.wall-card h2 { font-size: 1.15em; margin: 0 0 .4em; }
.wall-card h3 { font-size: 1em; margin: .7em 0 .25em; }
.wall-list { list-style: none; margin: 0; padding: 0; }
.wall-list li { padding: .28em 0; border-bottom: 1px solid #eef1f5; }
.wall-list li.tentative { opacity: .65; font-style: italic; }
.wall-list li.done .wall-title { text-decoration: line-through; opacity: .6; }
.wall-time { display: inline-block; min-width: 4.6em; color: var(--muted); font-variant-numeric: tabular-nums; }
label.check.big { font-size: 1em; gap: .6em; min-height: 2.2em; cursor: pointer; }
label.check.big input { width: 1.6em; height: 1.6em; flex: none; }
.wall-add input { flex: 1; font-size: 1em; min-height: 2.4em; }
.wall-add button { font-size: 1.2em; min-width: 2.6em; min-height: 2.4em; }
.hh-none { background: #fff; }

/* voice */
.voice-button { position: fixed; right: 1.2rem; bottom: 1.2rem; width: 3.6rem; height: 3.6rem; border-radius: 50%; font-size: 1.5rem; background: var(--primary); color: #fff; border: 0; box-shadow: 0 4px 14px rgba(0,0,0,.25); z-index: 50; }
.voice-button.recording { background: var(--danger); animation: pulse 1s infinite; }
.voice-button.busy { opacity: .6; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.transcript { font-size: 1.1rem; font-style: italic; margin: .2rem 0; }
nav a.attention { outline: 2px solid var(--warn); }

/* custody */
.custody-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.custody-grid th { font-size: .8rem; color: var(--muted); font-weight: 600; padding: .2rem; }
.custody-grid td { border: 1px solid var(--line); padding: .25rem; height: 3rem; vertical-align: top; font-size: .8rem; }
.custody-grid td.today { outline: 2px solid var(--primary); outline-offset: -2px; }
.daynum { color: var(--muted); display: block; }
.stay { display: inline-block; min-width: 1.4rem; text-align: center; border-radius: 4px; padding: 0 .25rem; border: 1px solid rgba(0,0,0,.18); }
.stay.exc { box-shadow: inset 0 -3px 0 #1c2430; }
.stay.pend { border: 2px dashed #b54708; }
.legend { font-size: .85rem; color: var(--muted); }

/* handovers (phase 2) */
.handover h2 { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; font-size: 1.05rem; }
.handover.pending { border-left: 5px solid var(--warn); }
.handover-facts { margin: .2rem 0 .5rem; }
.warn { color: #7a4b00; background: #fff3cd; border-radius: 8px; padding: .5rem .7rem; }
.proposal-box { background: #fff8e1; border: 1px dashed var(--warn); border-radius: 8px; padding: .5rem .7rem; margin: .4rem 0; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.handover-tile { display: flex; flex-wrap: wrap; gap: .2rem 1rem; align-items: baseline; background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--primary); border-radius: var(--radius); padding: .6rem .9rem; margin-bottom: .6rem; text-decoration: none; color: var(--text); }
.handover-tile.soon { border-left-color: var(--danger); background: #fdecea; }
.handover-tile.soon .tile-countdown { color: var(--danger); }
.tile-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tile-countdown { font-weight: 700; font-size: 1.15em; }
.tile-detail { color: var(--muted); flex-basis: 100%; }
.wall-tile .handover-tile { font-size: 1.1em; }
.fc-event.handover { border-style: double !important; border-width: 3px !important; }
.template-grid { border-collapse: collapse; font-size: .85rem; }
.template-grid th, .template-grid td { padding: .15rem .25rem; text-align: left; }
.template-grid input, .template-grid select { max-width: 7.5rem; padding: .2rem; }
.place-form input[type=text] { flex: 1; min-width: 8rem; }

/* audit log */
.audit-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.audit-table th, .audit-table td { text-align: left; padding: .3rem .5rem; border-bottom: 1px solid #eef1f5; vertical-align: top; }
.audit-table th { color: var(--muted); font-weight: 600; }
.audit-detail { color: var(--muted); word-break: break-word; }
