:root {
  --orange: #E65100; --orange-2: #F57C00; --container: #FFE0B2; --surface-o: #FFF3E0;
  --on-container: #3E1A00; --bg: #FFFBFF; --card: #F1ECEC; --text: #1D1B1E; --muted: #5F5A5E; --error: #B3261E;
  color-scheme: light dark;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --container: #7A2E00; --surface-o: #4A2200; --on-container: #FFE0B2; --bg: #1A1A1A; --card: #2A2628; --text: #EDE7EA; --muted: #B9B1B5; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; width: 100%; padding: 10px; border: 1px solid var(--muted); border-radius: 8px; background: var(--bg); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--orange); border-color: var(--orange); }
input.invalid { border-color: var(--error); outline-color: var(--error); }
label { display: block; font-size: .85rem; color: var(--muted); margin: 8px 0 0; }
label > input, label > select { margin-top: 4px; }

.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 4px; min-height: 60px;
  padding: env(safe-area-inset-top) 4px 0; background: var(--orange); color: #fff; }
.bar .title { flex: 1; min-width: 0; line-height: 1.2; font-size: 1.15rem; }
.bar .title > span, .bar .title small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .title small { font-size: .8rem; opacity: .9; }
.bar .actions { display: flex; align-items: center; }
.icon { background: none; border: 0; color: inherit; font-size: 1.5rem; min-width: 48px; min-height: 48px; border-radius: 50%; }
.bar .text-btn { background: none; border: 0; color: #fff; padding: 10px; font-weight: 600; }
.bar button:disabled { opacity: .5; }

#scrim { position: fixed; inset: 0; background: #0006; z-index: 9; }
#drawer { position: fixed; inset: 0 auto 0 0; width: min(85vw, 330px); background: var(--bg); z-index: 10; overflow-y: auto;
  transform: translateX(-105%); transition: transform .2s; border-radius: 0 16px 16px 0; padding-bottom: 16px; }
#drawer.open { transform: none; }
.drawer-head { background: var(--orange); color: #fff; padding: calc(20px + env(safe-area-inset-top)) 20px 20px; display: flex; flex-direction: column; gap: 4px; }
#drawer small { display: block; color: var(--orange); font-weight: 600; padding: 14px 24px 4px; }
#drawer button { display: block; width: calc(100% - 24px); margin: 2px 12px; text-align: left; padding: 14px 16px; border: 0; border-radius: 28px; background: none; color: var(--text); }
#drawer button.active { background: var(--surface-o); color: var(--on-container); font-weight: 600; }
#drawer hr { border: 0; border-top: 1px solid var(--card); margin: 8px 0; }

main { padding: 8px 12px 96px; max-width: 900px; margin: 0 auto; }
.card { background: var(--card); border-radius: 14px; padding: 12px 14px; margin: 8px 0; }
.card.o { background: var(--container); color: var(--on-container); }
.card.click { cursor: pointer; display: flex; align-items: center; }
.card .grow { flex: 1; min-width: 0; }
.card b { display: block; overflow-wrap: anywhere; }
.small { font-size: .85rem; color: var(--muted); }
.card.o .small { color: inherit; }
.row { display: flex; gap: 8px; align-items: center; }
.del { background: none; border: 0; font-size: 1.3rem; min-width: 44px; min-height: 44px; color: var(--muted); }

.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 8px 0; }
.days button, .days label span { display: flex; flex-direction: column; align-items: center; padding: 6px 0; border-radius: 10px;
  border: 2px solid transparent; background: var(--card); color: var(--muted); font-size: .75rem; line-height: 1.3; }
.days b { font-size: 1rem; color: var(--text); }
.days .today { border-color: var(--orange); }
.days .sel, .days input:checked + span { background: var(--orange); color: #fff; }
.days .sel b, .days input:checked + span b { color: #fff; }
.days label { margin: 0; }
.days input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.fab { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); width: 60px; height: 60px; border-radius: 18px;
  border: 0; background: var(--orange); color: #fff; font-size: 2rem; box-shadow: 0 3px 10px #0004; z-index: 4; }
.fab[hidden] { display: none; }
.primary, .btn { border: 0; border-radius: 22px; padding: 11px 20px; font-weight: 600; }
.primary { background: var(--orange); color: #fff; }
.primary:disabled { opacity: .45; }
.btn { background: none; border: 1px solid var(--muted); color: var(--text); }
.full { width: 100%; margin: 6px 0; }
.hint { background: var(--container); color: var(--on-container); border-radius: 10px; padding: 10px; margin-top: 8px; }
.progress { position: sticky; top: 60px; height: 4px; background: linear-gradient(90deg, var(--orange) 40%, var(--container) 40%); background-size: 200% 100%; animation: p 1s linear infinite; z-index: 5; }
@keyframes p { to { background-position: -200% 0; } }

table.hours { width: 100%; border-collapse: collapse; }
table.hours th, table.hours td { padding: 7px 6px; text-align: right; }
table.hours th:first-child, table.hours td:first-child { text-align: left; }
table.hours tr.share td { padding: 0 6px 6px; }
table.hours tr.share span { display: block; height: 5px; border-radius: 3px; background: var(--orange); }
.seg { gap: 0; margin: 4px 0; }
.seg button { flex: 1; border: 1px solid var(--orange); background: none; color: var(--text); padding: 9px; font-weight: 600; }
.seg button:first-child { border-radius: 20px 0 0 20px; } .seg button:last-child { border-radius: 0 20px 20px 0; }
.seg button.sel { background: var(--orange); color: #fff; }
.period b { text-align: center; font-size: 1.15rem; }
table.hours tr.today { background: var(--surface-o); font-weight: 700; }
table.hours tfoot td { font-weight: 700; border-top: 1px solid var(--muted); }
.big { font-size: 2.2rem; font-weight: 800; }

dialog { border: 0; border-radius: 20px; padding: 0; width: min(560px, 96vw); max-height: 92vh; background: var(--bg); color: var(--text); }
dialog::backdrop { background: #0007; }
dialog form, dialog .body { padding: 16px 18px; }
dialog h2 { margin: 0 0 8px; font-size: 1.25rem; }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 16px 0 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.hidden { display: none !important; }
fieldset { border: 1px solid var(--card); border-radius: 10px; margin: 10px 0 0; }
fieldset label { display: flex; gap: 10px; align-items: center; color: var(--text); font-size: 1rem; margin: 6px 0; }
fieldset input, .check input { width: 22px; height: 22px; accent-color: var(--orange); }
.check { display: flex; gap: 10px; align-items: center; color: var(--text); font-size: 1rem; }
dialog.preview { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; background: #444; }
.preview .head { display: flex; align-items: center; gap: 6px; background: var(--orange); color: #fff; padding: env(safe-area-inset-top) 8px 0; min-height: 56px; }
.preview .head .grow { flex: 1; font-weight: 600; }
.preview .head button { background: none; border: 0; color: #fff; padding: 10px; font-weight: 600; }
.preview .tabs { display: flex; background: var(--orange-2); }
.preview .tabs button { flex: 1; border: 0; background: none; color: #fff; padding: 10px; border-bottom: 3px solid transparent; }
.preview .tabs button.sel { border-color: #fff; font-weight: 700; }
.preview .scroll { overflow: auto; height: calc(100vh - 56px - 44px - env(safe-area-inset-top)); }
.preview canvas { display: block; background: #fff; margin: 8px auto; }

#snackbar { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: 92vw;
  background: #323032; color: #fff; padding: 12px 16px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; }
#snackbar.show { opacity: 1; pointer-events: auto; }

/* Wochenscheine: Auswahl mit Versandstatus */
.check.part { align-items: flex-start; margin: 10px 0; }
.check.part > span { display: flex; flex-direction: column; gap: 2px; }
.small.warn, .warn-card { color: #B3261E; }
.warn-card { background: #F9DEDC; }
.small .ok, .ok { color: var(--orange); font-weight: 600; }
fieldset.coords { border: 1px solid var(--muted); border-radius: 12px; padding: 8px 12px 10px; margin: 10px 0; }
fieldset.coords legend { padding: 0 6px; font-weight: 600; }
.row.wrap { flex-wrap: wrap; }
a.btn { display: inline-block; text-decoration: none; }
