html { font-size: 16px; }
body { padding: env(safe-area-inset-top) 0 calc(76px + env(safe-area-inset-bottom)); overscroll-behavior-y: contain; }
#root { max-width: 640px; margin: 0 auto; padding: 0 16px; }

/* Kopf */
.top { display: flex; align-items: center; gap: 12px; padding: 18px 0 12px; }
.top h1 { margin: 0; font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; }
.top .me { margin-left: auto; font-size: 1.15rem; }
.sub { color: var(--ink2); font-size: .95rem; margin: -6px 0 12px; }

/* Filter-Chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px 7px 8px; border-radius: 99px; background: var(--card); box-shadow: var(--shadow); font-weight: 700; font-size: .92rem; white-space: nowrap; }
.chip.plain { padding-left: 13px; }
.chip.on { background: var(--pc, var(--ink)); color: #fff; }
.chip .avatar { font-size: .72rem; box-shadow: none; }

/* Listen */
.group { margin: 14px 0 6px; font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--ink2); display: flex; gap: 8px; }
.group .wx { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600; }
.list { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; min-height: 56px; }
.item:last-child { border-bottom: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 700; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; }
.item .s { color: var(--ink2); font-size: .85rem; margin-top: 2px; }
.item .tm { font-weight: 800; font-size: .95rem; min-width: 50px; font-variant-numeric: tabular-nums; }
.item .tm small { display: block; font-weight: 600; color: var(--ink2); font-size: .78rem; }
.item .side { color: var(--ink3); font-size: .85rem; font-weight: 700; }
.item .x { color: var(--ink3); font-size: 1.1rem; padding: 6px 4px 6px 10px; }
.stripe { width: 4px; align-self: stretch; border-radius: 4px; background: var(--pc); flex: none; }
.item .avatar { font-size: .85rem; }
.empty-box { text-align: center; padding: 40px 16px; color: var(--ink2); }
.empty-box b { display: block; font-size: 2.6rem; margin-bottom: 6px; }

/* Punkte */
.scores { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 6px; }
.score { flex: 1; min-width: 74px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 10px 6px; text-align: center; border-top: 4px solid var(--pc); }
.score .avatar { font-size: 1rem; }
.score .n { font-weight: 800; margin-top: 4px; font-size: .9rem; }
.score .p { font-weight: 800; font-size: 1.1rem; }

/* Einkauf */
.addbar { display: flex; gap: 8px; margin-bottom: 12px; }
.addbar input { flex: 1; padding: 13px 15px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); font-size: 1rem; min-width: 0; }
.addbar input:focus { outline: none; border-color: var(--accent); }

/* Abstimmungen */
.poll { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.poll .q { font-weight: 800; font-size: 1.15rem; }
.poll .m { color: var(--ink2); font-size: .85rem; margin: 3px 0 12px; }
.popt { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; align-items: center; width: 100%; padding: 11px 12px; border-radius: 12px; background: var(--bg); margin-bottom: 7px; text-align: left; border: 2px solid transparent; }
.popt.mine { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--card)); }
.popt .lb { font-weight: 700; }
.popt .bar { grid-column: 1 / -1; height: 6px; }
.popt .radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ink3); }
.popt.mine .radio { border: 6px solid var(--accent); }
.poll .acts { display: flex; gap: 8px; margin-top: 6px; }
.poll.closed { opacity: .7; }

/* Mehr */
.menu .item .ic { font-size: 1.35rem; width: 30px; text-align: center; }
.menu .item .chev { color: var(--ink3); }

/* Stundenplan */
.ttday { margin-bottom: 4px; }

/* Buttons & Formulare */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 18px; border-radius: 14px; background: var(--accent); color: #fff; font-weight: 800; font-size: 1rem; }
.btn.ghost { background: var(--bg2); color: var(--ink); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.small { padding: 8px 12px; font-size: .88rem; border-radius: 11px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
label.f { display: block; margin: 14px 0 6px; font-size: .82rem; font-weight: 800; color: var(--ink2); text-transform: uppercase; letter-spacing: .06em; }
.in { width: 100%; padding: 13px 14px; border-radius: 13px; border: 2px solid var(--line); background: var(--card); font-size: 1rem; }
.in:focus { outline: none; border-color: var(--accent); }
textarea.in { min-height: 70px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; background: var(--bg2); border-radius: 13px; padding: 4px; gap: 4px; }
.seg button { flex: 1; padding: 9px 6px; border-radius: 10px; font-weight: 700; font-size: .92rem; color: var(--ink2); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.wdpick { display: flex; gap: 6px; }
.wdpick button { flex: 1; padding: 10px 0; border-radius: 11px; background: var(--bg2); font-weight: 800; color: var(--ink2); }
.wdpick button.on { background: var(--accent); color: #fff; }
.toggle { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; font-weight: 700; }
.sw { width: 50px; height: 30px; border-radius: 99px; background: var(--line); position: relative; transition: .2s; flex: none; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.sw.on { background: var(--accent); }
.sw.on::after { left: 23px; }
.emojis { display: flex; flex-wrap: wrap; gap: 6px; }
.emojis button { font-size: 1.4rem; width: 44px; height: 44px; border-radius: 12px; background: var(--bg2); }
.emojis button.on { background: var(--accent); }
.colors { display: flex; gap: 10px; flex-wrap: wrap; }
.colors button { width: 38px; height: 38px; border-radius: 50%; background: var(--c); }
.colors button.on { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--c); }
.optrow { display: flex; gap: 8px; margin-bottom: 8px; }

/* Untere Leiste */
#tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 20; }
#tabs[hidden] { display: none; }
#tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .7rem; font-weight: 700; color: var(--ink3); padding: 4px 0; }
#tabs button b { font-size: 1.35rem; filter: grayscale(1); opacity: .6; }
#tabs button.on { color: var(--ink); }
#tabs button.on b { filter: none; opacity: 1; }
#fab { position: fixed; right: max(18px, calc(50% - 302px)); bottom: calc(88px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 20px; background: var(--accent); color: #fff; font-size: 2rem; font-weight: 300; box-shadow: 0 6px 20px rgba(42, 157, 143, .45); z-index: 21; }
#fab[hidden] { display: none; }

/* Bottom-Sheet */
#sheet-bg { position: fixed; inset: 0; background: rgba(20, 18, 25, .4); z-index: 30; }
#sheet-bg[hidden], #sheet[hidden] { display: none; }
#sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto; background: var(--card); border-radius: 24px 24px 0 0; z-index: 31; padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
#sheet .grab { width: 40px; height: 5px; background: var(--line); border-radius: 9px; margin: 0 auto 10px; }
#sheet h2 { margin: 0 0 4px; font-size: 1.35rem; }
#sheet .actions { display: flex; gap: 10px; margin-top: 22px; }
#sheet .actions .btn:last-child { flex: 1; }

#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(150px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 14px; font-weight: 700; z-index: 40; max-width: 90vw; text-align: center; }
#toast[hidden] { display: none; }

/* Login */
.login { min-height: 90vh; display: flex; flex-direction: column; justify-content: center; text-align: center; padding: 20px 0; }
.login .logo { font-size: 3.5rem; }
.login h1 { margin: 6px 0 4px; font-size: 1.9rem; }
.login .who { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 12px; margin: 26px 0; }
.login .who button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px; border-radius: 18px; font-weight: 800; background: var(--card); box-shadow: var(--shadow); }
.login .who button .avatar { font-size: 1.8rem; }
.login .who button.on { box-shadow: 0 0 0 3px var(--pc); }
.pin { display: flex; gap: 12px; justify-content: center; margin: 8px 0 18px; }
.pin i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink3); }
.pin i.f { background: var(--ink); border-color: var(--ink); }
.pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; justify-content: center; }
.pad button { height: 64px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow); font-size: 1.5rem; font-weight: 700; }
.err { color: var(--danger); font-weight: 700; min-height: 1.4em; }
.demo-note { background: var(--ink); color: var(--bg); font-size: .8rem; font-weight: 700; text-align: center; padding: 6px; border-radius: 10px; margin-top: 12px; }
.lform { max-width: 360px; margin: 0 auto; width: 100%; text-align: left; }
.lform .btn { margin-top: 6px; }
