:root {
  --bg: #f5f1e8; --card: #fffdf8; --ink: #17251f; --muted: #7a7f76; --line: #ece6d8;
  --green: #1f7a4c; --green-d: #16603b; --green-l: #e3f1e6; --pill: #15302a;
  --orange: #e29a2b; --orange-l: #fbeed6; --blue: #3b8fd6; --blue-l: #e0eefb; --red: #cf4a3a; --red-l: #fbe3df;
  --tile: #f3ece0; --shadow: 0 6px 22px rgba(60, 50, 20, .09);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: #e9e3d4; color: var(--ink); overscroll-behavior-y: none; }
body { font-size: 15px; line-height: 1.35; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
h1, h2, h3, p { margin: 0; }
#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; background: var(--bg); position: relative; box-shadow: 0 0 60px rgba(0, 0, 0, .12); }
[hidden] { display: none !important; }

/* ---------- Top bar & Nav ---------- */
#topbar { position: sticky; top: 0; z-index: 20; display: flex; gap: 8px; align-items: center; padding: calc(8px + var(--safe-t)) 14px 8px; background: rgba(245, 241, 232, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid rgba(0, 0, 0, .04); }
.stat { display: flex; align-items: center; gap: 5px; background: #fff; border-radius: 999px; padding: 6px 11px; font-weight: 700; font-size: 13.5px; box-shadow: 0 2px 8px rgba(60, 50, 20, .06); white-space: nowrap; }
.stat small { font-weight: 600; color: var(--muted); font-size: 11.5px; }
.stat.flex { flex: 1; justify-content: center; min-width: 0; overflow: hidden; }
.stat.warn { background: var(--red-l); color: var(--red); }
#nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 520px); z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); background: #fffdf8; border-radius: 24px 24px 0 0; box-shadow: 0 -6px 24px rgba(60, 50, 20, .10); padding: 8px 6px calc(8px + var(--safe-b)); }
#nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; color: #8a8d84; font-size: 11.5px; font-weight: 600; position: relative; }
#nav button .ic { font-size: 22px; filter: grayscale(1) opacity(.6); transition: .2s; line-height: 1.1; }
#nav button.on { color: var(--ink); font-weight: 800; }
#nav button.on .ic { filter: none; transform: translateY(-2px) scale(1.12); }
#nav .badge { position: absolute; top: 0; right: 22%; min-width: 17px; height: 17px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; padding: 0 4px; }
#view { padding-bottom: calc(96px + var(--safe-b)); }
.page { padding: 0 16px; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 0 8px; }
.page-head h1 { font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.sub { color: var(--muted); font-size: 13.5px; font-weight: 500; margin-top: 2px; }
.round { width: 46px; height: 46px; border-radius: 50%; background: #fff; box-shadow: var(--shadow); display: grid; place-items: center; font-size: 22px; flex: none; }

/* ---------- Chips ---------- */
.chips { display: flex; gap: 9px; overflow-x: auto; padding: 4px 16px 10px; margin: 0 -16px; scrollbar-width: none; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: flex; align-items: center; gap: 7px; padding: 11px 16px; border-radius: 999px; background: #fffdf8; font-weight: 700; font-size: 14.5px; box-shadow: 0 2px 10px rgba(60, 50, 20, .07); scroll-snap-align: start; white-space: nowrap; }
.chip.on { background: var(--pill); color: #fff; }
.chip.lock { opacity: .6; }
.chip.sm { padding: 8px 13px; font-size: 13px; }
.seg { display: flex; background: #ebe5d6; border-radius: 14px; padding: 4px; gap: 2px; margin: 4px 0 12px; }
.seg button { flex: 1; padding: 9px 4px; border-radius: 11px; font-weight: 700; font-size: 13.5px; color: #6d6e66; position: relative; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.seg .badge { position: absolute; top: 2px; right: 6px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; display: grid; place-items: center; padding: 0 4px; }

/* ---------- Karte ---------- */
#mapwrap { position: relative; width: 100%; aspect-ratio: 1 / 1.12; border-radius: 30px; overflow: hidden; box-shadow: var(--shadow); background: #4e8a45; touch-action: pan-y; }
#mapwrap canvas { width: 100%; height: 100%; display: block; }
#mapwrap.full { position: fixed; inset: 0; z-index: 60; border-radius: 0; aspect-ratio: auto; max-width: 520px; margin: 0 auto; }
.map-btn { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; font-size: 19px; }
.map-hint { position: absolute; left: 12px; bottom: 12px; right: 12px; display: none; }

/* ---------- Karten ---------- */
.card { background: var(--card); border-radius: 26px; padding: 18px; box-shadow: var(--shadow); margin: 14px 0; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card.tip { background: #e6f3e6; box-shadow: none; display: flex; gap: 14px; align-items: center; }
.card.warn { background: var(--orange-l); box-shadow: none; }
.card.bad { background: var(--red-l); box-shadow: none; }
.card h2 { font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.card h3 { font-size: 16px; font-weight: 800; }
.sec { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 2px 8px; }
.sec h2 { font-size: 21px; font-weight: 800; letter-spacing: -.3px; }
.sec a, .link { color: var(--green); font-weight: 700; font-size: 13.5px; cursor: pointer; }
.head { display: flex; align-items: center; gap: 14px; }
.icon-tile { width: 64px; height: 64px; border-radius: 22px; background: var(--tile); display: grid; place-items: center; font-size: 30px; flex: none; }
.icon-tile.sm { width: 46px; height: 46px; border-radius: 16px; font-size: 24px; }
.head .t { flex: 1; min-width: 0; }
.head .t .n { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.head .t .s { color: var(--muted); font-size: 14px; font-weight: 500; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; background: #e9efe9; color: var(--green); white-space: nowrap; }
.tag.o { background: var(--orange-l); color: #b8741a; } .tag.r { background: var(--red-l); color: var(--red); } .tag.b { background: var(--blue-l); color: #2a6aa6; } .tag.g { background: #eee9dc; color: #6b6a5e; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.tiles.two { grid-template-columns: repeat(2, 1fr); } .tiles.four { grid-template-columns: repeat(4, 1fr); }
.tile { background: var(--tile); border-radius: 18px; padding: 12px 14px; min-width: 0; }
.tile .l { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.tile .v { font-size: 19px; font-weight: 800; letter-spacing: -.3px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#panel .tiles.four .v { font-size: 15.5px; }
.tile .v small { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-tile { background: #fffdf8; border-radius: 24px; padding: 14px; box-shadow: var(--shadow); position: relative; }
.stat-tile .ic { width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; font-size: 22px; }
.stat-tile .v { font-size: 28px; font-weight: 800; margin-top: 10px; letter-spacing: -.5px; }
.stat-tile .l { color: var(--muted); font-size: 14px; font-weight: 500; }
.stat-tile .go { position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border-radius: 50%; background: #eee9dc; display: grid; place-items: center; color: #777; font-size: 14px; }

/* ---------- Buttons ---------- */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 15px 18px; border-radius: 999px; background: var(--green); color: #fff; font-weight: 700; font-size: 16px; transition: transform .1s, filter .2s; }
.btn:active { transform: scale(.98); filter: brightness(.94); }
.btn.dark { background: var(--pill); } .btn.orange { background: var(--orange); } .btn.red { background: var(--red); }
.btn.ghost { background: #ece6d6; color: var(--ink); } .btn.blue { background: var(--blue); }
.btn.sm { padding: 10px 16px; font-size: 14px; width: auto; }
.btn.xs { padding: 7px 12px; font-size: 13px; width: auto; }
.btn[disabled], .btn.dis { background: #ddd8ca; color: #999a90; pointer-events: none; }
.btn small { opacity: .8; font-weight: 600; font-size: 12.5px; }
.row { display: flex; gap: 10px; } .row > * { flex: 1; min-width: 0; } .row.auto > * { flex: none; }
.mt { margin-top: 12px; } .mt2 { margin-top: 18px; } .mb { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .xs { font-size: 12px; } .b { font-weight: 700; } .center { text-align: center; }

/* ---------- Fortschritt ---------- */
.bar { height: 10px; background: #eae4d4; border-radius: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green); border-radius: 6px; transition: width .4s; }
.bar.b > i { background: var(--blue); } .bar.o > i { background: var(--orange); } .bar.r > i { background: var(--red); }
.bar.lg { height: 14px; border-radius: 8px; }
.lbl { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; margin: 12px 0 6px; }
.lbl b { font-weight: 800; }
.steps { display: flex; align-items: center; margin: 14px 0 4px; }
.step { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: none; width: 64px; font-size: 11.5px; font-weight: 700; color: var(--muted); text-align: center; }
.step .d { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #d8d2c2; display: grid; place-items: center; color: #fff; font-size: 14px; background: #fff; }
.step.done .d { background: var(--green); border-color: var(--green); } .step.cur .d { border-color: var(--green); box-shadow: 0 0 0 4px var(--green-l); }
.step.done, .step.cur { color: var(--ink); }
.steps .ln { flex: 1; height: 3px; background: #ddd7c8; margin-bottom: 18px; border-radius: 2px; } .steps .ln.done { background: var(--green); }

/* ---------- Listen ---------- */
.item { display: flex; align-items: center; gap: 13px; padding: 12px; background: #fffdf8; border-radius: 22px; box-shadow: var(--shadow); margin-bottom: 10px; cursor: pointer; }
.item .pic { width: 62px; height: 62px; border-radius: 18px; display: grid; place-items: center; font-size: 32px; flex: none; position: relative; overflow: hidden; }
.item .mid { flex: 1; min-width: 0; }
.item .mid .n { font-weight: 800; font-size: 17px; letter-spacing: -.2px; }
.item .mid .s { color: var(--muted); font-size: 13.5px; }
.item .end { text-align: right; flex: none; }
.item .chev { color: #9b9a8e; font-size: 18px; }
.cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.catc { background: #fffdf8; border-radius: 20px; padding: 10px 4px; text-align: center; box-shadow: var(--shadow); border: 2px solid transparent; font-weight: 700; font-size: 12.5px; position: relative; }
.catc .e { font-size: 30px; line-height: 1.15; } .catc .n { font-size: 20px; font-weight: 800; color: var(--muted); } .catc.on { border-color: var(--green); } .catc.on .n { color: var(--green); }
.catc.lock { opacity: .55; }
.hl { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); } .hl:last-child { border: 0; }
.hl .e { font-size: 24px; width: 34px; text-align: center; flex: none; } .hl .m { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 600; } .hl .m small { display: block; color: var(--muted); font-weight: 500; font-size: 12.5px; }
.q { display: inline-flex; gap: 3px; } .q span { font-size: 11px; background: #eee9dc; padding: 1px 6px; border-radius: 8px; font-weight: 700; } .q .s1 { background: #dfeedd; color: var(--green); } .q .s2 { background: #fbeccb; color: #a8741a; }
.up { color: var(--green); font-weight: 800; } .down { color: var(--red); font-weight: 800; }
.ok { color: var(--green); } .no { color: var(--red); }
.stars { color: #e29a2b; letter-spacing: 1px; font-size: 14px; } .stars i { color: #d9d2bf; font-style: normal; }

/* ---------- Hero ---------- */
.hero { position: relative; margin: 0 -16px; height: 262px; overflow: hidden; border-radius: 0 0 36px 36px; }
.hero svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero .hi { position: absolute; left: 16px; right: 16px; top: 14px; display: flex; align-items: center; gap: 12px; }
.avatar { width: 62px; height: 62px; border-radius: 50%; background: #fff; border: 3px solid #bfe3f5; display: grid; place-items: center; font-size: 34px; flex: none; box-shadow: var(--shadow); }
.hero .gr { font-size: 14px; font-weight: 600; opacity: .75; } .hero .fn { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.hero .bell { margin-left: auto; position: relative; } .hero .bell .dot { position: absolute; top: 9px; right: 11px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); border: 2px solid #fff; }
.top2 { display: grid; grid-template-columns: 1fr 1.05fr; gap: 12px; margin-top: -78px; position: relative; }
.top2 .card { margin: 0; padding: 14px; }
.ring { position: relative; width: 78px; height: 78px; flex: none; } .ring svg { transform: rotate(-90deg); } .ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 17px; font-weight: 800; }
.fc { display: flex; justify-content: space-between; margin-top: 10px; gap: 4px; }
.fc div { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted); flex: 1; background: var(--tile); border-radius: 12px; padding: 5px 0; } .fc div .e { font-size: 18px; display: block; } .fc div.low { opacity: .6; }

/* ---------- Sheets, Toasts ---------- */
#sheets .back { position: fixed; inset: 0; background: rgba(20, 30, 24, .45); z-index: 80; animation: fadeb .2s; }
@keyframes fadeb { from { opacity: 0; } }
#sheets .sheet { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 520px); max-height: 90dvh; background: var(--bg); border-radius: 30px 30px 0 0; z-index: 81; display: flex; flex-direction: column; animation: up .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes up { from { transform: translate(-50%, 40px); opacity: 0; } }
.sheet .sh { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 8px; }
.sheet .sh h2 { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.sheet .sh .x { width: 38px; height: 38px; border-radius: 50%; background: #ebe5d6; font-size: 17px; }
.sheet .sb { overflow-y: auto; padding: 4px 18px calc(24px + var(--safe-b)); overscroll-behavior: contain; }
#toasts { position: fixed; bottom: calc(92px + var(--safe-b)); left: 50%; transform: translateX(-50%); width: min(92%, 460px); z-index: 100; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { background: var(--pill); color: #fff; border-radius: 16px; padding: 9px 14px; font-weight: 600; font-size: 13.5px; display: flex; gap: 10px; align-items: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); animation: tin .3s; }
.toast.err { background: #8a2f25; } .toast .e { font-size: 20px; }
@keyframes tin { from { opacity: 0; transform: translateY(14px) scale(.96); } }

/* ---------- Start / Boot ---------- */
#boot { min-height: 100dvh; padding: calc(24px + var(--safe-t)) 20px 30px; background: linear-gradient(#bfe6f7, #e8f4d9 55%, #f5f1e8); }
#boot .logo { text-align: center; padding: 14px 0 6px; } #boot .logo .em { font-size: 62px; } #boot h1 { font-size: 34px; font-weight: 800; letter-spacing: -1px; } #boot .tag-l { color: #4d6a58; font-weight: 600; margin-top: 4px; }
.pf { display: flex; align-items: center; gap: 13px; padding: 14px; background: #fffdf8; border-radius: 22px; box-shadow: var(--shadow); margin-bottom: 11px; }
.pf .avatar { width: 54px; height: 54px; font-size: 30px; border-color: #e3f1e6; }
.avs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; } .avs button { width: 48px; height: 48px; border-radius: 16px; background: #fff; font-size: 26px; border: 2px solid transparent; } .avs button.on { border-color: var(--green); background: var(--green-l); }
input[type=text], textarea, select { width: 100%; padding: 14px 16px; border-radius: 16px; border: 2px solid #e5dfcf; background: #fff; font: inherit; font-weight: 600; color: var(--ink); outline: none; }
input[type=text]:focus, textarea:focus { border-color: var(--green); }
label.f { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 12px 0 6px; }
.switch { position: relative; width: 52px; height: 30px; border-radius: 16px; background: #d4cebd; flex: none; transition: .2s; } .switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 4px rgba(0,0,0,.2); } .switch.on { background: var(--green); } .switch.on::after { left: 25px; }
.spark { width: 100%; height: 60px; }
.crop-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.crop { background: #fffdf8; border-radius: 20px; padding: 12px; box-shadow: var(--shadow); text-align: left; border: 2px solid transparent; }
.crop.bad { opacity: .5; } .crop .e { font-size: 32px; } .crop .n { font-weight: 800; } .crop .s { font-size: 12.5px; color: var(--muted); }
.node { display: flex; gap: 12px; align-items: center; padding: 13px; border-radius: 22px; background: #fffdf8; box-shadow: var(--shadow); margin-bottom: 10px; }
.node.locked { opacity: .55; } .node.done { background: #e8f3ea; box-shadow: none; }
.gtt { display: flex; gap: 8px; align-items: center; }
.pulse { animation: pulse 1.6s infinite; } @keyframes pulse { 50% { transform: scale(1.05); } }
.confetti { font-size: 40px; text-align: center; }
.sticky-act { position: sticky; bottom: 0; padding-top: 10px; background: linear-gradient(transparent, var(--bg) 30%); }
@media (min-width: 560px) { #app { margin-top: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
