/* 69 Newtonmeter – Tokens aus dem Design-System „WG App“. Hell und dunkel, folgt dem Gerät. */
:root {
    color-scheme: light;
    --bg: #f6f5f1;
    --surface: #ffffff;
    --surface-2: #eeece6;
    --ink: #1a1d1b;
    --muted: #5f6661;
    --line: #e2dfd7;
    --accent: #1f6b4a;
    --accent-ink: #ffffff;
    --accent-soft: #e3f1e9;
    --hi: #f08a4b;
    --hi-ink: #2a1406;
    --hi-soft: #fdeee3;
    --hi-text: #a3460f;
    --pos: #1f6b4a;
    --neg: #b42f25;
    --neg-soft: #fbe7e4;
    --warn: #a3460f;
    --warn-soft: #fdeee3;
    --shadow: 0 1px 2px rgba(26,29,27,0.06), 0 4px 16px rgba(26,29,27,0.05);
    --shadow-float: 0 8px 24px rgba(26,29,27,0.14);
    /* Diagrammfarben: feste Reihenfolge, je Modus eigene Stufen */
    --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7;
    --member-1: #3563c9; --member-2: #b8502a; --member-3: #7a4fb8; --member-4: #e9b949;
    /* Müllarten wie die Tonnen in Karlsruhe */
    --waste-rest: #6b6f6c; --waste-bio: #8a5a2b; --waste-paper: #2a6fc9; --waste-recycle: #c8312b;
    --late: #d9a400;   /* Verspätung bei Abfahrten */
    --radius: 22px;
    --radius-md: 14px;
    --tabs-h: 76px;
    --ease: cubic-bezier(.2,.7,.3,1);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #121413;
        --surface: #1b1e1c;
        --surface-2: #0d0f0e;
        --ink: #eef0ec;
        --muted: #a3aaa5;
        --line: #2c302d;
        --accent: #5cc893;
        --accent-ink: #0b1f15;
        --accent-soft: #173326;
        --hi: #f5a06b;
        --hi-ink: #2a1406;
        --hi-soft: #3a2416;
        --hi-text: #f5a06b;
        --pos: #5cc893;
        --neg: #ff7a6e;
        --neg-soft: #3a1a17;
        --warn: #f5a06b;
        --warn-soft: #3a2416;
        --shadow: 0 1px 2px rgba(0,0,0,0.4);
        --shadow-float: 0 8px 24px rgba(0,0,0,0.5);
        --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9;
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #121413;
    --surface: #1b1e1c;
    --surface-2: #0d0f0e;
    --ink: #eef0ec;
    --muted: #a3aaa5;
    --line: #2c302d;
    --accent: #5cc893;
    --accent-ink: #0b1f15;
    --accent-soft: #173326;
    --hi: #f5a06b;
    --hi-ink: #2a1406;
    --hi-soft: #3a2416;
    --hi-text: #f5a06b;
    --pos: #5cc893;
    --neg: #ff7a6e;
    --neg-soft: #3a1a17;
    --warn: #f5a06b;
    --warn-soft: #3a2416;
    --shadow: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-float: 0 8px 24px rgba(0,0,0,0.5);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/22px "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, p, ul, ol, dl, dd, fieldset, table { margin: 0; padding: 0; }
ul, ol { list-style: none; }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }
h2 { font-size: 22px; line-height: 28px; }
h3 { font-size: 17px; line-height: 24px; font-weight: 600; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.amount, .figure, .legend td, .cal-day { font-variant-numeric: tabular-nums; }

.icon { width: 22px; height: 22px; flex: none; stroke-width: 1.9; }

/* ------------------------------------------------------------ Rahmen */
#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; }

.top {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: 8px;
    padding: calc(env(safe-area-inset-top) + 24px) 16px 12px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.top h1 { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: clamp(24px, 7.5vw, 32px); line-height: 38px; font-weight: 800; letter-spacing: -0.02em; }
.top .back { margin-left: -8px; }
.who {
    padding: 6px 12px; border-radius: 999px; background: var(--surface-2);
    color: var(--ink); font-size: 13px; font-weight: 600;
}

#view { padding: 8px 16px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 40px); }
.view { display: flex; flex-direction: column; gap: 12px; }
.view h2.section:first-child { margin-top: 0; }
.view > [data-list], .view > [data-content], .view > [data-summary], .view > [data-stats] { display: flex; flex-direction: column; gap: 12px; }
.view > [data-stats]:empty { display: none; }

.tabs {
    position: fixed; bottom: calc(env(safe-area-inset-bottom) + 12px); left: 50%; transform: translateX(-50%); z-index: 10;
    width: calc(100% - 24px); max-width: 536px;
    display: grid; grid-template-columns: repeat(var(--tab-count, 5), 1fr);
    padding: 6px; border-radius: var(--radius);
    background: var(--surface); box-shadow: var(--shadow-float); border: 1px solid var(--line);
}
.tabs a {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 0; border-radius: var(--radius-md); min-height: 52px; justify-content: center;
    color: var(--muted); font-size: 12px; line-height: 16px; font-weight: 600; transition: background .16s var(--ease), color .16s var(--ease);
}
.tabs a[aria-current] { color: var(--accent); background: var(--accent-soft); }

.banner {
    margin: 0 16px 8px; padding: 8px 12px; border-radius: 10px;
    background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 600;
}

.boot, .loading { color: var(--muted); text-align: center; padding: 32px 0; }
.empty { color: var(--muted); text-align: center; padding: 20px 12px; background: var(--surface); border-radius: var(--radius); border: 1px dashed var(--line); }
.error-box { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px; text-align: center; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--neg); }

/* ------------------------------------------------------------ Text */
.section { margin-top: 12px; font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
h3.section { font-size: 17px; line-height: 24px; }
.meta { color: var(--muted); font-size: 12px; line-height: 16px; font-weight: 500; }
.label { color: var(--muted); font-size: 13px; line-height: 18px; font-weight: 600; }
.hint { color: var(--muted); font-size: 12px; line-height: 16px; font-weight: 500; }
.lead { color: var(--muted); }
.greeting { font-size: 17px; line-height: 24px; color: var(--muted); }
.greeting strong { color: var(--ink); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.warn-text { color: var(--warn); font-weight: 600; }
.center { text-align: center; align-items: center; }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ------------------------------------------------------------ Karten */
.card {
    display: block; padding: 16px; border-radius: var(--radius);
    background: var(--surface); box-shadow: var(--shadow); color: var(--ink);
    border: 0;
}
.card.stack { display: flex; }
.card > * + * { margin-top: 10px; }
.card.stack > * + * { margin-top: 0; }

.hero { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.hero > * + * { margin-top: 0; }
.hero .grid2, .hero .counter, .hero > .btn { margin-top: 12px; align-self: stretch; }
.figure { font-size: 28px; line-height: 32px; font-weight: 700; letter-spacing: -0.02em; }
.figure.big { font-size: 64px; line-height: 68px; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi > * + * { margin-top: 0; }
.kpi .figure { font-size: 22px; line-height: 28px; }

.split-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.split-line.small { font-size: 13px; color: var(--muted); }
.amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ------------------------------------------------------------ Listen */
.rows { display: flex; flex-direction: column; gap: 8px; }
.row {
    display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px;
    background: var(--surface); box-shadow: var(--shadow); border-radius: var(--radius-md);
    transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.row.leaving { opacity: 0; transform: translateX(40px); }
.row.mine { background: var(--hi-soft); box-shadow: inset 0 0 0 1.5px var(--hi); }
.row.locked { opacity: 0.65; }
.muted-rows .row { background: transparent; }
.row-main {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    padding: 8px 10px; border: 0; border-radius: 10px; background: none; text-align: left; overflow-wrap: anywhere;
}
.row-main strong { font-size: 17px; line-height: 24px; font-weight: 600; }
button.row-main:active { background: var(--surface-2); }
.rows > li:not(.row) > .row-main { width: 100%; background: var(--surface); box-shadow: var(--shadow); border-radius: var(--radius-md); padding: 12px 16px; }
.row-icon { color: var(--muted); padding: 0 8px; }

.link-row {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    background: var(--surface); box-shadow: var(--shadow); border-radius: var(--radius-md); color: var(--ink);
}
.link-row > .icon:last-child { color: var(--muted); }
.link-row.notice { background: var(--hi-soft); box-shadow: none; }
.link-row.notice > .icon:first-child { color: var(--hi-text); }
.tile-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }

.plain { display: flex; flex-direction: column; }
.plain li { padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.plain li:last-child { border-bottom: 0; }
.plain a { color: var(--ink); }

/* ------------------------------------------------------------ Knöpfe */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 0 18px; border-radius: var(--radius-md);
    border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; font-size: 15px;
    transition: transform .12s var(--ease), background .16s var(--ease);
}
.btn:active, .round:active, .chip-btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.danger { color: var(--neg); }
.btn.primary.danger { background: var(--neg); border-color: var(--neg); color: var(--surface); }
.btn.block { width: 100%; }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 13px; line-height: 18px; }
.btn.yes { border-color: var(--pos); color: var(--pos); }
.btn.no { border-color: var(--neg); color: var(--neg); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1; }

.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; background: none; color: var(--muted); }
.icon-btn:active { background: var(--surface-2); }

.round {
    display: grid; place-items: center; width: 44px; height: 44px; flex: none;
    border-radius: 50%; border: 1.5px solid var(--line); background: none; color: var(--muted);
}
.round.done { border-color: var(--accent); color: var(--accent); }
.round.armed { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); transform: scale(1.08); }
.round.xl { width: 68px; height: 68px; }
.round.accent { background: var(--hi); border-color: var(--hi); color: var(--hi-ink); box-shadow: var(--shadow-float); }
.counter { display: flex; justify-content: center; gap: 28px; }

.chip {
    display: inline-flex; align-items: center; align-self: flex-start; gap: 4px;
    padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink); font-size: 13px; line-height: 18px; font-weight: 600;
}
.chip.accent { background: var(--hi-soft); color: var(--hi-text); }
.chip.ok { background: var(--accent-soft); color: var(--accent); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.pos { background: var(--accent-soft); color: var(--accent); }
.chip.neg { background: var(--neg-soft); color: var(--neg); }
.chip.gone { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn {
    display: inline-flex; align-items: center; gap: 4px; padding: 8px 14px 8px 10px;
    border-radius: 999px; border: 0; background: var(--surface); box-shadow: var(--shadow); font-size: 13px; font-weight: 600;
}
.chip-btn .icon { width: 16px; height: 16px; color: var(--muted); }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: var(--radius-md); background: var(--surface-2); }
.segmented > * {
    padding: 9px 8px; border: 0; border-radius: 10px; background: none; text-align: center;
    color: var(--muted); font-weight: 600; font-size: 13px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.segmented > [aria-current] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ------------------------------------------------------------ Formulare */
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--muted); }
input, select, textarea {
    width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--radius-md);
    border: 1px solid transparent; background: var(--surface-2); color: var(--ink); font-size: 16px; font-weight: 400;
}
textarea { resize: vertical; }
input[type="range"] { padding: 0; border: 0; background: none; accent-color: var(--accent); }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--accent); flex: none; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; font-weight: 400; }
fieldset { border: 0; }
legend { padding: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.checks { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.add-bar { display: flex; gap: 8px; }
.add-bar input { background: var(--surface); box-shadow: var(--shadow); }
.form-error { color: var(--neg); font-size: 13px; font-weight: 600; }
output { color: var(--ink); }

/* ------------------------------------------------------------ Sheet */
.sheet {
    width: 100%; max-width: 560px; max-height: 90dvh; margin: auto auto 0; padding: 0; border: 0;
    border-radius: 22px 22px 0 0; background: var(--surface); color: var(--ink);
    animation: rise 0.22s ease-out;
}
.sheet::backdrop { background: rgb(0 0 0 / 45%); }
.sheet { box-shadow: var(--shadow-float); }
.sheet form { display: flex; flex-direction: column; gap: 14px; padding: 18px 18px calc(env(safe-area-inset-bottom) + 18px); }
.sheet header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet h2 { font-size: 22px; line-height: 28px; }
.sheet-body { display: flex; flex-direction: column; gap: 14px; }
.sheet footer { display: flex; gap: 10px; }
.sheet footer .primary { flex: 1; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 620px) { .sheet { margin: auto; border-radius: 22px; } }

/* ------------------------------------------------------------ Toast */
#toasts {
    position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 20px); z-index: 100;
    display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px; pointer-events: none;
}
.toast {
    display: flex; align-items: center; gap: 14px; max-width: 480px; padding: 12px 16px; border-radius: 12px;
    background: var(--ink); color: var(--bg); font-weight: 600; font-size: 13px; pointer-events: auto;
    box-shadow: 0 6px 24px rgb(0 0 0 / 25%); animation: rise 0.2s ease-out;
}
.toast.error { background: var(--neg); color: var(--surface); }
.toast button { border: 0; background: none; color: inherit; font-weight: 800; text-decoration: underline; padding: 0; }

/* ------------------------------------------------------------ Anmeldung */
.login { display: flex; flex-direction: column; justify-content: center; gap: 16px; min-height: 100dvh; padding: 24px; max-width: 400px; margin: 0 auto; }
.login .banner { margin: 0; }
.brand { display: flex; flex-direction: column; align-items: center; margin-bottom: 8px; }
.brand-mark { display: grid; place-items: center; width: 112px; height: 112px; border-radius: 999px; background: var(--hi); color: var(--hi-ink); font-size: 52px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; box-shadow: var(--shadow-float); margin-bottom: 14px; }
.brand-unit { font-size: 32px; line-height: 38px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }

/* ------------------------------------------------------------ Kalender */
.calendar header { display: flex; align-items: center; justify-content: space-between; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dow { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; padding-bottom: 4px; }
.cal-day {
    aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 1px solid transparent; border-radius: 10px; background: var(--bg); font-size: 13px; font-weight: 600;
}
.cal-day.today { background: var(--hi-soft); color: var(--hi-text); font-weight: 800; }
.dots { display: flex; gap: 2px; height: 6px; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.dot.party { background: var(--s5); }
.dot.garbage { background: var(--s4); }
.dot.cleaning { background: var(--s1); }
.dot.task { background: var(--s3); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }

/* ------------------------------------------------------------ Abstimmungen */
.poll header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.poll header .icon-btn { margin: -8px -8px 0 0; }
.poll.veto { box-shadow: inset 0 0 0 1.5px var(--hi); }
.vote-bar { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.vote-bar .yes { background: var(--pos); }
.vote-bar .no { background: var(--neg); }
.archive { display: flex; flex-direction: column; }
.archive summary { padding: 12px 0; font-weight: 650; color: var(--muted); cursor: pointer; }
.archive .card { margin-bottom: 12px; opacity: 0.85; }

/* ------------------------------------------------------------ Finanzen */
.month summary { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; cursor: pointer; list-style: none; }
.month summary::-webkit-details-marker { display: none; }
.stack-bar { display: flex; gap: 2px; height: 14px; }
.stack-bar span { min-width: 3px; border-radius: 3px; }
.legend { width: 100%; border-collapse: collapse; font-size: 13px; }
.legend th { text-align: left; font-weight: 400; padding: 5px 0; }
.legend td { text-align: right; padding: 5px 0 5px 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.legend td:nth-child(2) { color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; }
.s1 { background: var(--s1); } .s2 { background: var(--s2); } .s3 { background: var(--s3); } .s4 { background: var(--s4); }
.s5 { background: var(--s5); } .s6 { background: var(--s6); } .s7 { background: var(--s7); }

/* ------------------------------------------------------------ Ranking, Bahn, Gästebuch */
.rank { flex-direction: row !important; align-items: center !important; gap: 14px !important; }
.rank.me { box-shadow: inset 0 0 0 1.5px var(--accent) !important; }
.place { width: 30px; font-size: 22px; font-weight: 800; color: var(--muted); text-align: center; }
.meter { display: block; height: 6px; margin-top: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 3px; background: var(--accent); }

.line-badge { min-width: 48px; padding: 8px 6px; margin-left: 6px; border-radius: 8px; background: var(--ink); color: var(--bg); font-weight: 800; font-size: 13px; text-align: center; }

.entry header { display: flex; align-items: center; gap: 8px; }
.entry header h3 { flex: 1; }
.entry header .chip { align-self: center; }
.quote { font-style: italic; color: var(--muted); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--bg); }
.facts dt { font-size: 12px; font-weight: 600; color: var(--muted); }
.facts dd { font-size: 13px; }

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

/* ------------------------------------------------------------ Avatare */
.avatar {
    display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 999px;
    background: var(--muted); color: #fff; font-size: 13px; font-weight: 700;
}
.avatar.m1 { background: var(--member-1); } .avatar.m2 { background: var(--member-2); }
.avatar.m3 { background: var(--member-3); } .avatar.m4 { background: var(--member-4); color: #1a1d1b; }
.who { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; background: var(--surface); box-shadow: var(--shadow); }
.who .avatar { width: 28px; height: 28px; font-size: 12px; }
.with-avatar { display: flex; align-items: center; gap: 10px; white-space: nowrap; }

/* Segment-Auswahl als Radio-Buttons (z. B. Aufteilung im Finanzformular) */
.segmented .seg { flex-direction: row; justify-content: center; align-items: center; cursor: pointer; }
.segmented .seg input { position: absolute; opacity: 0; pointer-events: none; }
.segmented .seg:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.segmented .seg:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
fieldset .segmented { margin-bottom: 10px; }

/* Bahn */
.dep-time { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 64px; }
.dep-time .late { color: var(--neg); font-size: 12px; font-weight: 600; }
.dep-time .cancel { color: var(--neg); font-size: 12px; font-weight: 700; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ============================================================ Kalender (Monatsansicht mit Titeln) */
.calendar header { gap: 8px; }
.calendar header h2 { font-size: 22px; font-weight: 400; }
.calendar header h2 strong { font-weight: 800; }
.cal-nav { display: flex; align-items: center; gap: 2px; }
.cal-grid { gap: 0; border-top: 1px solid var(--line); }
.dow { padding: 6px 0; font-size: 11px; }
.cal-day {
    aspect-ratio: auto; min-height: 76px; padding: 4px 2px 6px; gap: 2px;
    justify-content: flex-start; align-items: stretch; overflow: hidden;
    background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; text-align: left;
}
.cal-day.blank { border-bottom: 1px solid var(--line); }
.cal-day.weekend .num { color: var(--muted); }
.cal-day .num {
    align-self: center; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 999px;
    font-size: 14px; font-weight: 600; margin-bottom: 2px;
}
.cal-day.today .num { background: var(--hi); color: var(--hi-ink); }
.cal-day.today { background: none; color: inherit; }
.cal-day.selected .num { background: var(--ink); color: var(--bg); }
.cal-day.today.selected .num { background: var(--hi); color: var(--hi-ink); }
.pill {
    display: block; padding: 1px 3px; border-radius: 4px; overflow: hidden; white-space: nowrap; text-overflow: clip;
    font-size: 10px; line-height: 14px; font-weight: 600; color: var(--ink);
    background: color-mix(in srgb, var(--c) 22%, transparent); border-left: 2px solid var(--c);
}
.cal-day .more { font-size: 10px; color: var(--muted); padding-left: 4px; }
.calendar.compact .cal-day { min-height: 58px; }
.calendar.compact .pill { font-size: 9px; line-height: 12px; }
@media (min-width: 500px) { .pill { font-size: 11px; line-height: 15px; } }

.agenda { display: flex; flex-direction: column; gap: 6px; }
.agenda li {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 12px; border-radius: 10px;
    background: color-mix(in srgb, var(--c) 12%, transparent); border-left: 3px solid var(--c);
}

/* ============================================================ Board / Widgets */
.board { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.widget { grid-column: span 2; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.widget.half { grid-column: span 1; }
.widget.card > * + * { margin-top: 0; }
.widget.frameless > .widget-body > .calendar { margin: 0; }
.widget-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.widget-title { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
.widget-title .icon { width: 18px; height: 18px; }
a.widget-title .icon:last-child { width: 14px; height: 14px; opacity: .6; }
.widget-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.widget-empty { display: flex; align-items: center; gap: 8px; color: var(--muted); padding: 6px 0; }
.widget-tools { display: inline-flex; gap: 0; }
.widget-tools .icon-btn { width: 36px; height: 36px; }
.widget-tools .icon-btn:disabled { opacity: .3; }
.board.editing .widget { outline: 2px dashed var(--line); outline-offset: -2px; }
.board-actions { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }
.board-actions .btn:only-child { color: var(--muted); }
.round.small { width: 36px; height: 36px; }

/* Abweichungs-Balken (Stände), Mitte = 0 */
.diverging { display: flex; flex-direction: column; gap: 10px; }
.diverging li { display: grid; grid-template-columns: minmax(80px, 1fr) 2fr auto; align-items: center; gap: 10px; }
.diverging .track { position: relative; height: 12px; border-radius: 6px; background: var(--surface-2); }
.diverging .track::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: var(--line); }
.diverging .track span { position: absolute; top: 0; bottom: 0; border-radius: 6px; }
.diverging .track .pos { left: 50%; background: var(--pos); }
.diverging .track .neg { right: 50%; background: var(--neg); }

/* Säulen (Zählerverbrauch je Monat) */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 130px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; position: relative; min-width: 0; }
.bar i { display: block; width: 100%; max-width: 28px; border-radius: 4px 4px 0 0; background: var(--accent); }
.bar small { font-size: 10px; color: var(--muted); }
.bar em { font-style: normal; font-size: 11px; font-weight: 700; white-space: nowrap; }
.history summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; padding: 4px 0; }
.kpis > div { display: flex; flex-direction: column; }
.figure small { font-size: 14px; font-weight: 600; color: var(--muted); }

/* Woche */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-day { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 6px; border-radius: 10px; background: var(--bg); min-height: 120px; }
.week-day.today { background: var(--hi-soft); }
.week-head { display: flex; flex-direction: column; align-items: center; margin-bottom: 4px; }
.week-head span { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.week-head strong { font-size: 20px; }

/* Müll */
.waste-next { display: flex; flex-direction: column; gap: 8px; }
.waste-next li { display: flex; align-items: center; gap: 12px; }
.waste-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 12px; background: var(--c); color: #fff; }
.waste-next.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.waste-next.tiles li { flex-direction: column; align-items: flex-start; padding: 12px; border-radius: 16px; background: color-mix(in srgb, var(--c) 14%, transparent); }
.bin { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.meter.warn span { background: var(--hi); }

/* Uhr */
.clock { display: flex; flex-direction: column; gap: 4px; }
.clock-time { font-size: 64px; line-height: 1; font-weight: 800; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.clock-date { font-size: 17px; color: var(--muted); font-weight: 600; }

/* ============================================================ iPad-Display (Querformat) */
.brand-mark.small { width: 44px; height: 44px; font-size: 20px; margin: 0; box-shadow: none; }
html.kiosk #app { max-width: none; }
.kiosk-view { padding: calc(env(safe-area-inset-top) + 16px) 24px 24px; }
.kiosk-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.kiosk-head h1 { flex: 1; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.kiosk-board { grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kiosk-board .widget { grid-column: span 2; }
.kiosk-board .widget.half { grid-column: span 1; }
.kiosk-board .widget.wide { grid-column: span 3; }
.kiosk-board .widget { padding: 16px 18px; }
.kiosk-board .plain li { padding: 8px 0; }
.kiosk-board .waste-next.tiles { grid-template-columns: repeat(4, 1fr); }
.kiosk-board .waste-next.tiles li { padding: 10px; }
.kiosk-board .week-day { min-height: 96px; }
.kiosk-board .clock-time { font-size: 72px; }
.kiosk-board .figure { font-size: 44px; line-height: 48px; }
.kiosk-board .widget-title { font-size: 15px; }
.kiosk-board .row-main strong, .kiosk-board .plain strong { font-size: 18px; }
.kiosk-board .bars { height: 160px; }
.kiosk-board .chip-btn { font-size: 16px; padding: 10px 16px; }
@media (max-width: 900px) { .kiosk-board { grid-template-columns: repeat(2, 1fr); } }

/* Abfahrten: ganze Zeile nach Pünktlichkeit eingefärbt (Farbe plus Text, nie nur Farbe) */
.deps { display: flex; flex-direction: column; gap: 6px; }
.dep { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.dep .grow { min-width: 0; }
.dep .grow strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep .line-badge { margin-left: 0; }
.dep .dep-time { align-items: flex-end; text-align: right; }
.dep.ok { background: color-mix(in srgb, var(--pos) 16%, var(--surface)); }
.dep.late { background: color-mix(in srgb, var(--late) 26%, var(--surface)); }
.dep.bad { background: color-mix(in srgb, var(--neg) 18%, var(--surface)); }
.dep.bad .amount { color: var(--neg); }

/* Abhak-Liste in Widgets: ganze Zeile ist der Knopf */
.checklist { display: flex; flex-direction: column; gap: 6px; }
.checklist li { transition: opacity .2s var(--ease), transform .2s var(--ease); }
.checklist li.leaving { opacity: 0; transform: translateX(30px); }
.check-row {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; text-align: left;
    border: 0; border-radius: var(--radius-md); background: var(--bg); color: var(--ink);
}
.check-row:active { transform: scale(0.98); }
.check-row .tick {
    display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 999px;
    border: 2px solid var(--accent); color: transparent;
}
.check-row:active .tick, .checklist li.leaving .tick { background: var(--accent); color: var(--accent-ink); }
@media (hover: hover) { .check-row:hover .tick { background: var(--accent-soft); color: var(--accent); } }
.check-row .tick .icon { width: 18px; height: 18px; }
.add-bar.small input { min-height: 44px; }
.add-bar.small .btn { min-height: 44px; padding: 0 14px; }
.chip-btn.on-list { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.chip-btn.on-list .icon { color: var(--accent); }
.btn-row.nowrap { flex-wrap: nowrap; gap: 8px; }
.btn-row.nowrap > * { flex: none; }

/* iPad: genau eine Bildschirmhöhe, Inhalte scrollen notfalls innerhalb ihres Widgets */
html.kiosk, html.kiosk body { height: 100%; overflow: hidden; }
#view.kiosk-view { height: 100dvh; display: flex; flex-direction: column; padding-bottom: 16px; }
.kiosk-view > .view { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 0; }
.kiosk-view [data-board] { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.kiosk-board:not(.editing) { flex: 1; min-height: 0; grid-template-rows: auto; grid-auto-rows: minmax(0, 1fr); }
.kiosk-board:not(.editing) .widget { min-height: 0; overflow: hidden; }
.kiosk-board:not(.editing) .widget-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.kiosk-board.editing { overflow-y: auto; }
html.kiosk .board-actions { position: fixed; right: 20px; bottom: 14px; margin: 0; z-index: 5; }
html.kiosk .board-actions .btn.ghost { background: var(--surface); box-shadow: var(--shadow); min-height: 36px; }
.kiosk-head { margin-bottom: 12px; }
/* iPad: kompaktere Zeilen, damit alles ohne Scrollen ins Widget passt */
.kiosk-board .dep { padding: 6px 10px; }
.kiosk-board .dep .line-badge { padding: 6px; min-width: 40px; }
.kiosk-board .check-row { padding: 5px 8px; }
.kiosk-board .checklist { gap: 4px; }
.kiosk-board .waste-icon { width: 30px; height: 30px; border-radius: 10px; }
.kiosk-board .waste-next.tiles { gap: 8px; }
.kiosk-board .waste-next.tiles li { padding: 8px; gap: 6px; }
.kiosk-board .bin { gap: 6px; padding-top: 6px; }
.kiosk-board .bin > .meter { display: none; }
.kiosk-board .widget-body { gap: 4px; }
.kiosk-board [data-widget="train.departures"] .widget-body > p.meta { display: none; }
.kiosk-board .dep { padding: 4px 10px; }
.kiosk-board .waste-next.tiles .meta { display: none; }
/* iPad: Müll-Kachel ohne Scrollen – Abfuhrarten als flache Kacheln, Tonne als eine Zeile mit Knopf rechts */
.kiosk-board .waste-next.tiles li { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.kiosk-board .waste-next.tiles li .grow { flex: 1 1 60px; }
.kiosk-board .waste-next.tiles li .chip { flex: 1 0 100%; justify-content: center; }
.kiosk-board .bin {
    display: grid; grid-template-columns: 1fr auto; grid-template-areas: "head btn" "meta btn";
    align-items: center; gap: 2px 12px; padding: 8px 0 0; border-top: 1px solid var(--line); margin-top: 4px;
}
.kiosk-board .bin > .split-line { grid-area: head; justify-content: flex-start; }
.kiosk-board .bin > .meta { grid-area: meta; }
.kiosk-board .bin > .btn { grid-area: btn; min-height: 44px; }
