:root {
    color-scheme: dark;
    --bg: #0c0c0e;
    --panel: #16171b;
    --panel-2: #1e2025;
    --line: #2e3138;
    --text: #f4f3ef;
    --muted: #a6aab3;
    --accent: #f1f2f4;
    --accent-ink: #0c0c0e;
    --hot: #868c96;
    --link: #eceef1;
    --ok-bg: #11301f;   --ok-text: #86e6a6;
    --err-bg: #3b1219;  --err-text: #ffa0ab;
    --info-bg: #13263f; --info-text: #a3c8ff;
    --danger: #ff5c6c;
    --brand: #16171b;
    --radius: 4px;
    --display: Impact, Haettenschweiler, "Arial Narrow Bold", "Roboto Condensed", sans-serif-condensed, "Arial Narrow", sans-serif;
}

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

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

body {
    margin: 0;
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background: var(--bg) repeating-linear-gradient(135deg, rgba(255, 255, 255, .018) 0 2px, transparent 2px 16px);
    min-height: 100vh;
}

a { color: var(--link); }
a:hover { text-decoration: none; }

h1, h2 {
    font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .03em;
    line-height: 1.1; text-wrap: balance;
}
h1 { font-size: 2.2rem; margin: 0 0 .5rem; }
h1::after {
    content: ""; display: block; width: 3.5rem; height: .35rem; margin-top: .45rem;
    background: linear-gradient(90deg, var(--accent), var(--c, var(--hot))); transform: skewX(-20deg);
}
h2 { font-size: 1.45rem; margin: 2rem 0 .6rem; color: #c3c7ce; }
.card h2:first-child, .card h1:first-child { margin-top: 0; }
p { margin: 0 0 .75rem; }
ul { margin: 0 0 .75rem; padding-left: 1.25rem; }
code { background: #26282e; padding: .1em .35em; border-radius: 3px; font-size: .9em; overflow-wrap: anywhere; }

.muted { color: var(--muted); font-size: .92rem; }
.warn { color: var(--danger); font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.count {
    font: 400 .95rem/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; text-transform: none; letter-spacing: 0;
    color: var(--muted); font-variant-numeric: tabular-nums; margin-left: .35rem;
}

/* Chrom-Effekt für große Schrift (Schwarz-Weiß-Look) */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
    h1, .tile-num, .site-brand {
        background: linear-gradient(180deg, #ffffff 30%, #9ba1aa 100%);
        -webkit-background-clip: text; background-clip: text; color: transparent;
    }
}

/* ---------- Rahmen ---------- */
.topbar {
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    background: #000; color: #fff; padding: .55rem 1rem; border-bottom: 3px solid var(--accent);
    position: sticky; top: 0; z-index: 10;
}
.logo {
    display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #c9cdd4 55%, #8f959e 100%); color: var(--accent-ink); font: 400 1.9rem/1 var(--display);
    text-decoration: none; transform: skewX(-10deg); box-shadow: 4px 4px 0 var(--hot);
}
.logo-big { width: 4.5rem; height: 4.5rem; font-size: 3.6rem; margin: 0 auto 2rem; display: grid; box-shadow: 6px 6px 0 var(--hot); }
.topbar nav { display: flex; gap: .15rem; flex: 1; overflow-x: auto; }
.topbar nav a {
    color: #d5d6da; text-decoration: none; padding: .5rem .7rem; white-space: nowrap;
    font-weight: 700; text-transform: uppercase; letter-spacing: .07em; font-size: .86rem;
    border-bottom: 3px solid transparent;
}
.topbar nav a:hover { color: #fff; border-bottom-color: #555; }
.topbar nav a.active { color: var(--accent); border-bottom-color: var(--accent); }
.logout { margin: 0; }
.gear {
    display: grid; place-items: center; flex: none; width: 2.7rem; height: 2.7rem; border-radius: 50%;
    color: #d5d6da; transition: transform .35s ease, color .14s ease;
}
.gear:hover { color: #ffffff; transform: rotate(90deg); }
.gear.active { color: var(--accent-ink); background: var(--accent); }
.gear:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .gear { transition: none; } .gear:hover { transform: none; } }

.wrap { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.narrow { max-width: 620px; margin: 0 auto; padding: 2rem 1rem 3rem; }
body.plain .narrow { max-width: 440px; padding-top: 4rem; }

.card {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.1rem 1.25rem; margin-bottom: 1rem;
}
.stack > * + * { margin-top: .9rem; }
.stack > * { margin-bottom: 0; }

.head-row {
    display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem 1rem;
    flex-wrap: wrap; margin-bottom: 1rem;
}
.head-row h1, .head-row h2 { margin: 0; }
.head-row h2 { margin-top: 1.25rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- Formulare ---------- */
label { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
label > input, label > select, label > textarea, label > .copy-row { margin-top: .35rem; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="tel"],
input[type="number"], input[type="date"], input[type="datetime-local"], input[type="file"], select, textarea {
    display: block; width: 100%; font: inherit; font-size: 1rem; color: var(--text); text-transform: none; letter-spacing: 0;
    padding: .55rem .65rem; border: 1px solid #454953; border-radius: var(--radius); background: #0f1013;
    min-height: 2.7rem;
}
input::placeholder, textarea::placeholder { color: #7d828c; }
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible,
.chip:focus-visible, .tick:focus-visible, summary:focus-visible {
    outline: 3px solid var(--accent); outline-offset: 2px;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset legend { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 0; margin-bottom: .35rem; }
fieldset input + input { margin-top: .4rem; }

.grid { display: grid; gap: .9rem 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

label.check {
    display: flex; align-items: flex-start; gap: .5rem; cursor: pointer;
    font-size: .95rem; font-weight: 400; color: var(--text); text-transform: none; letter-spacing: 0;
}
label.check input { width: 1.2rem; height: 1.2rem; margin: .15rem 0 0; flex: none; accent-color: var(--accent); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    font: inherit; font-size: .86rem; font-weight: 800; line-height: 1.2; text-transform: uppercase; letter-spacing: .07em;
    text-decoration: none; cursor: pointer; white-space: nowrap;
    padding: .6rem 1rem; min-height: 2.7rem; border-radius: var(--radius);
    border: 2px solid #5a5f6a; background: transparent; color: var(--text);
    transition: transform .08s ease, box-shadow .08s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { color: var(--accent-ink); transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--hot); }
.btn-primary:active { transform: none; box-shadow: none; }
.btn-ghost { border-color: transparent; color: var(--link); }
.btn-ghost:hover { border-color: transparent; text-decoration: underline; }
.topbar .btn-ghost { color: #d5d6da; }
.topbar .btn-ghost:hover { color: #fff; }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #14070a; }
.btn-big { width: 100%; min-height: 3.2rem; font-size: 1rem; }
.btn-small { min-height: 2rem; padding: .25rem .6rem; font-size: .78rem; }

.danger-zone { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
form.inline { margin: 0; }
form.inline select { min-width: 8.5rem; }

.copy-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.copy-row input { flex: 1 1 16rem; width: auto; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Meldungen ---------- */
.flash {
    padding: .7rem .9rem; border-radius: var(--radius); margin: 0 0 1rem;
    background: var(--info-bg); color: var(--info-text); border-left: 4px solid currentColor;
}
.flash-ok { background: var(--ok-bg); color: var(--ok-text); }
.flash-error { background: var(--err-bg); color: var(--err-text); }
.stack > .flash { margin-bottom: 0; }

/* ---------- Kacheln ---------- */
.tiles { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 1.25rem 0 .5rem; }
.tile {
    background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: var(--radius);
    padding: .9rem 1.1rem 1rem; text-decoration: none; color: var(--text); display: block;
    transition: transform .08s ease, box-shadow .08s ease;
}
a.tile:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--hot); }
.tile-num { display: block; font: 400 3rem/1 var(--display); color: var(--accent); font-variant-numeric: tabular-nums; }
.tile-label { color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Events ---------- */
.event-row { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; text-decoration: none; color: var(--text); border-left: 4px solid var(--c, var(--accent)); }
a.event-row:hover { background: var(--panel-2); }
.event-count { min-width: 220px; font-variant-numeric: tabular-nums; }
.event-count.wide { min-width: 0; }
.bar { height: .55rem; background: #2a2d33; border-radius: 99px; overflow: hidden; margin-top: .4rem; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--c, var(--hot))); border-radius: 99px; }
.bar-fill.full { background: #ffffff; }
.brand-dot {
    display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .4rem; vertical-align: baseline;
    box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .55);
}

/* ---------- Projekte und Aufgaben ---------- */
.quick-add { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; padding: .7rem 1rem; border-left: 4px solid var(--hot); }
.quick-add input[type="text"] { flex: 1 1 14rem; width: auto; }
.quick-add select { flex: 0 1 12rem; width: auto; }

.tabs-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs-row select { width: auto; }
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; }
.tabs a {
    padding: .45rem .8rem; border-radius: var(--radius); text-decoration: none; color: var(--text);
    border: 2px solid var(--line); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .82rem;
}
.tabs a:hover { border-color: var(--accent); }
.tabs a.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tabs small { opacity: .8; font-variant-numeric: tabular-nums; }
.settings-tabs { margin: .25rem 0 1.25rem; }
.status {
    display: inline-block; font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
    padding: .2rem .55rem; border-radius: 3px; white-space: nowrap; transform: skewX(-8deg);
}
.status-idee { background: transparent; color: #ffc94a; box-shadow: inset 0 0 0 2px #ffc94a; }
.status-aktiv { background: #2bd576; color: #04200e; }
.status-abgeschlossen { background: #33363d; color: #b9bdc6; }

.tasks { padding: .4rem 1.1rem; }
.task { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task form { margin: 0; flex: none; }
.task-body { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: .1rem .75rem; align-items: baseline; }
.task-title { overflow-wrap: anywhere; }
.task-done .task-title { text-decoration: line-through; color: var(--muted); }
.tick {
    display: grid; place-items: center; width: 1.8rem; height: 1.8rem; padding: 0; cursor: pointer;
    border: 2px solid #7c818c; border-radius: 3px; background: transparent; color: var(--accent-ink);
    font-size: 1.05rem; font-weight: 800; line-height: 1;
}
.tick:hover { border-color: var(--accent); }
.tick-on { background: var(--accent); border-color: var(--accent); }
.task-add { display: flex; gap: .6rem; flex-wrap: wrap; padding: .8rem 0 .6rem; margin: 0; }
.task-add input[type="text"] { flex: 1 1 14rem; width: auto; }
.task-add input[type="date"] { flex: 0 1 11rem; width: auto; }
details.card > summary { cursor: pointer; color: var(--link); font-weight: 700; }
.copy-form { margin-top: .9rem; }
.wrap > .bar { margin: -.25rem 0 .75rem; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th {
    font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; color: var(--accent);
    background: #101114; white-space: nowrap; border-bottom: 2px solid var(--accent);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--panel-2); }
.table tr.past { color: var(--muted); }
.table tr.past a { color: #b3b7be; }
.table td { overflow-wrap: anywhere; }
.col-check { width: 2.25rem; }
.col-check input { width: 1.2rem; height: 1.2rem; accent-color: var(--accent); }
.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.table input[type="text"] { min-width: 9rem; }

.badge { display: inline-block; font-size: .7rem; font-weight: 800; letter-spacing: .06em; padding: .1rem .4rem; border-radius: 3px; margin-left: .35rem; vertical-align: middle; }
.badge-vip { background: #ffffff; color: #0c0c0e; transform: skewX(-8deg); }

/* ---------- Filter und Tags ---------- */
.filter-row { display: flex; gap: .6rem .9rem; flex-wrap: wrap; align-items: center; }
.filter-row input[type="search"] { flex: 1 1 16rem; width: auto; }
.filter-row label.check { align-items: center; }
.filter-row label.check input { margin: 0; }
.filter details { margin-top: .8rem; }
.filter summary { cursor: pointer; color: var(--link); font-size: .92rem; padding: .25rem 0; }
.filter details .chips { margin-top: .6rem; }

.bulk-bar { display: flex; gap: .6rem .9rem; flex-wrap: wrap; align-items: center; padding: .7rem 1rem; }
.bulk-bar label.check { align-items: center; }
.bulk-bar label.check input { margin: 0; }
.bulk-bar input[type="text"] { flex: 1 1 10rem; width: auto; max-width: 16rem; }

.chip-group { display: flex; gap: .5rem .9rem; align-items: baseline; flex-wrap: wrap; margin-top: .6rem; }
.chip-group-label {
    flex: 0 0 5.5rem; font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--accent);
}
.chip-group .chips { flex: 1 1 14rem; margin-top: 0; }
.filter details .chip-group .chips { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
    display: inline-flex; align-items: center; gap: .3rem; font: inherit; font-size: .82rem; line-height: 1.3;
    padding: .2rem .65rem; border-radius: 99px; border: 1px solid #50545e; background: #23252b; color: var(--text);
    text-decoration: none; cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip small { color: var(--muted); }
.chip-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.chip-on:hover { color: var(--accent-ink); }
.chip-check { padding: 0; border: 0; background: none; text-transform: none; letter-spacing: 0; font-weight: 400; }
.chip-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-check span {
    display: inline-flex; gap: .3rem; padding: .3rem .7rem; border-radius: 99px; font-size: .86rem;
    border: 1px solid #50545e; background: #23252b; color: var(--text);
}
.chip-check input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.chip-check input:checked + span small { color: #44474d; }
.chip-check input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; margin: 1rem 0; }

/* ---------- Gäste-Anmeldeseiten ---------- */
body.site { --c: var(--brand); }
.site-head { background: #000; color: #fff; padding: 1.1rem 1rem; text-align: center; border-bottom: 4px solid var(--c, var(--accent)); }
.site-brand { font: 400 1.5rem/1 var(--display); text-transform: uppercase; letter-spacing: .08em; }
.event-meta { font-size: 1.05rem; }
.preview-bar { margin: 0; padding: .55rem 1rem; text-align: center; font-size: .88rem; background: #3a2f00; color: #ffd76a; }
.back { margin: 0 0 .75rem; }
.narrow > .stack { margin-bottom: 1rem; }
.site-h2 { margin-top: 1.5rem; }
.termin { display: flex; justify-content: space-between; align-items: center; gap: .75rem 1rem; flex-wrap: wrap; border-left: 4px solid var(--c, var(--accent)); }
.termin-title { font: 400 1.3rem/1.15 var(--display); text-transform: uppercase; letter-spacing: .03em; }
.slug-row { display: flex; align-items: stretch; }
.slug-prefix {
    display: flex; align-items: center; padding: 0 .6rem; background: #23252b; border: 1px solid #454953; border-right: 0;
    border-radius: var(--radius) 0 0 var(--radius); color: var(--muted); font-size: .9rem; text-transform: none; letter-spacing: 0; white-space: nowrap;
}
.slug-row input { border-radius: 0 var(--radius) var(--radius) 0; min-width: 0; margin-top: 0; }
label > .slug-row { margin-top: .35rem; }
label.check-inline { align-self: end; padding-bottom: .6rem; }
form .card h2, form.card h2 { margin-top: 1.25rem; }
.prose { overflow-wrap: anywhere; }
.site-foot { text-align: center; padding: 0 1rem 2rem; font-size: .9rem; }
.site-foot a { margin: 0 .5rem; color: var(--muted); }

@media (max-width: 640px) {
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.3rem; }
    .wrap { padding: 1rem .75rem 2.5rem; }
    .topbar { padding: .5rem .75rem; gap: .5rem; }
    .topbar nav { order: 3; flex-basis: 100%; }
    .gear { margin-left: auto; }
    .card { padding: .9rem 1rem; }
    .table th, .table td { padding: .5rem .55rem; }
    .tile-num { font-size: 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .btn, .tile { transition: none; }
    .btn-primary:hover, a.tile:hover { transform: none; }
}

/* ---------- Cockpit: Mr. Z und seine Sphären ---------- */
.orbit { position: relative; display: flex; flex-direction: column; align-items: center; padding: .75rem 0 .25rem; margin-bottom: 1.25rem; }
.orbit-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.wire { fill: none; stroke: #5b606a; stroke-width: 1.5; transition: stroke .18s ease, opacity .18s ease; }
.wire.is-hot { stroke: var(--c, #ffffff); stroke-width: 2.5; }
.wire.is-dim { opacity: .3; }
.spark {
    fill: none; stroke: var(--c, #ffffff); stroke-width: 3; stroke-linecap: round; stroke-dasharray: .07 .93;
    filter: drop-shadow(0 0 5px var(--c, #ffffff)); transition: opacity .18s ease;
    animation: spark 1.5s linear infinite; animation-delay: calc(var(--i, 0) * -.23s);
}
.spark.is-dim { opacity: 0; }
@keyframes spark { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

.z-core {
    position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: .55rem;
    background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer;
}
.z-mark {
    position: relative; overflow: hidden; display: grid; place-items: center; width: 6.5rem; height: 6.5rem;
    font: 400 5.2rem/1 var(--display); color: #0c0c0e;
    background: linear-gradient(135deg, #ffffff 0%, #c9cdd4 55%, #8f959e 100%);
    transform: skewX(-10deg); box-shadow: 8px 8px 0 var(--hot), 0 0 42px rgba(255, 255, 255, .28);
    transition: transform .14s ease, box-shadow .14s ease;
}
.z-mark::after {
    content: ""; position: absolute; top: -20%; bottom: -20%; left: -70%; width: 45%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .95), transparent);
    transform: skewX(-20deg); animation: shine 3.4s ease-in-out infinite;
}
@keyframes shine { 0%, 60% { left: -70%; } 100% { left: 140%; } }
.z-core:hover .z-mark { transform: skewX(-10deg) scale(1.05); box-shadow: 10px 10px 0 var(--hot), 0 0 60px rgba(255, 255, 255, .45); }
.z-core:focus-visible { outline: 3px solid var(--accent); outline-offset: 8px; }
.z-name { font: 400 1.25rem/1 var(--display); letter-spacing: .2em; text-transform: uppercase; color: #c3c7ce; }

.spheres {
    position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem;
    width: 100%; max-width: 760px; margin-top: 3.4rem;
}
.sphere {
    display: flex; flex-direction: column; justify-content: center; gap: .3rem; min-height: 5rem; padding: .8rem .5rem;
    background: var(--panel); border: 2px solid #4b4f58; border-top: 5px solid var(--c, #4b4f58); border-radius: var(--radius); color: var(--text);
    font: inherit; text-align: center; cursor: pointer; transform: skewX(-6deg);
    transition: transform .14s ease, border-color .14s ease, background .14s ease, box-shadow .14s ease, opacity .14s ease;
}
.sphere > span { display: block; transform: skewX(6deg); }
.sphere-name { font: 400 1.4rem/1.05 var(--display); text-transform: uppercase; letter-spacing: .05em; overflow-wrap: anywhere; }
.sphere-count { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.sphere:hover { border-color: var(--c, #ffffff); transform: skewX(-6deg) translateY(-3px); }
.sphere:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.sphere.is-active {
    background: var(--c, #ffffff); border-color: var(--c, #ffffff); color: #0c0c0e;
    transform: skewX(-6deg) translateY(-4px) scale(1.03); box-shadow: 6px 6px 0 #ffffff, 0 0 34px var(--c, rgba(255, 255, 255, .25));
}
.sphere.is-active .sphere-count { color: #17181b; }
.orbit.has-choice .sphere:not(.is-active) { opacity: .62; }

.orbit-drop {
    position: relative; z-index: 1; width: .85rem; height: .85rem; margin-top: 2.8rem; background: #ffffff;
    transform: rotate(45deg); box-shadow: 0 0 16px rgba(255, 255, 255, .8); animation: drop-pulse 1.4s ease-in-out infinite;
}
@keyframes drop-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

/* Einmaliger Auftritt je Sitzung: Z springt rein, Linien zeichnen sich, Sphären steigen auf */
.orbit.intro .z-core { animation: z-in .5s cubic-bezier(.2, 1.5, .4, 1) backwards; }
@keyframes z-in { from { opacity: 0; transform: scale(.35) rotate(-14deg); } }
.orbit.intro .wire {
    stroke-dasharray: 1; animation: wire-draw .4s ease-out backwards; animation-delay: calc(.32s + var(--i, 0) * .07s);
}
@keyframes wire-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.orbit.intro .spark {
    animation: spark 1.5s linear infinite, fade-in .25s ease backwards;
    animation-delay: calc(var(--i, 0) * -.23s), .95s;
}
@keyframes fade-in { from { opacity: 0; } }
.orbit.intro .sphere { animation: sphere-in .32s ease-out backwards; animation-delay: calc(.5s + var(--i, 0) * .08s); }
@keyframes sphere-in { from { opacity: 0; transform: skewX(-6deg) translateY(18px); } }
.orbit.intro .orbit-drop { animation: fade-in .3s ease backwards 1s, drop-pulse 1.4s ease-in-out infinite 1.3s; }

/* Projektkarten */
.pcards { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); margin-bottom: 1rem; }
.pcard {
    display: flex; flex-direction: column; gap: .45rem; padding: .9rem 1rem 1rem; text-decoration: none; color: var(--text);
    background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--c, #ffffff); border-radius: var(--radius);
    transition: transform .1s ease, box-shadow .1s ease, background .1s ease;
}
.pcard:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--c, var(--hot)); background: var(--panel-2); }
.pcard-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.pcard-name { font: 400 1.35rem/1.15 var(--display); text-transform: uppercase; letter-spacing: .03em; overflow-wrap: anywhere; }
.pcard-meta { display: flex; flex-wrap: wrap; gap: .1rem .8rem; color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.pop { animation: pop-in .2s ease-out backwards; animation-delay: calc(var(--i, 0) * 30ms); }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.task-none { padding: .7rem 0; margin: 0; }
.tasks-plain { padding: .4rem 0 0; }
.quick-add input[type="date"] { flex: 0 1 11rem; width: auto; }
[hidden] { display: none !important; }

/* ---------- Z-BOT ---------- */
.zbot { max-width: 820px; margin: 0 auto; }
.zbot-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.zbot-title { flex: 1 1 14rem; min-width: 0; }
.zbot-title h1 { margin: 0; }
.zbot-title p { margin: .5rem 0 0; }
.zbot-new { margin: 0; }
.zbot-avatar {
    position: relative; display: inline-block; flex: none; width: 2.4rem; height: 2.4rem;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, .25));
}
.zbot-avatar svg, .zbot-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; }
.zbot-avatar img { object-fit: cover; }
/* Porträt-Avatar: quadratisches Bild im Chrom-Rahmen mit rotem Schimmer */
.zbot-avatar-photo {
    border-radius: 6px; overflow: hidden; background: #000;
    box-shadow: 0 0 0 2px #c9cdd4, 0 0 14px rgba(255, 59, 59, .35);
    filter: none;
}
.zbot-avatar-photo.zbot-avatar-big { width: 6rem; height: 6rem; box-shadow: 0 0 0 3px #c9cdd4, 6px 6px 0 var(--hot), 0 0 26px rgba(255, 59, 59, .45); }
.zbot-avatar-big { width: 5.2rem; height: 5.2rem; }
.zb-laser { animation: zb-laser 2.2s ease-in-out infinite; transform-origin: 70px 27px; }
@keyframes zb-laser { 0%, 100% { opacity: .75; } 50% { opacity: 1; filter: drop-shadow(0 0 4px #ff3b3b); } }

/* Großer Auftritt des Bots bei leerem Gespräch */
.zhero { display: none; text-align: center; padding: .5rem 0 1.25rem; }
.zbot.is-empty .zhero { display: block; }
.zbot.is-empty .zbot-head { display: none; }
.zbot-avatar-photo.zbot-avatar-hero, .zbot-avatar-hero {
    display: inline-block; width: min(17rem, 68vw); height: min(17rem, 68vw); border-radius: 10px;
}
.zbot-avatar-photo.zbot-avatar-hero {
    box-shadow: 0 0 0 4px #c9cdd4, 12px 12px 0 var(--hot), 0 0 70px rgba(255, 59, 59, .5);
    animation: zhero-in .45s cubic-bezier(.2, 1.4, .4, 1) backwards, zhero-glow 3s ease-in-out .5s infinite;
}
@keyframes zhero-in { from { opacity: 0; transform: scale(.6) rotate(-6deg); } }
@keyframes zhero-glow {
    0%, 100% { box-shadow: 0 0 0 4px #c9cdd4, 12px 12px 0 var(--hot), 0 0 50px rgba(255, 59, 59, .35); }
    50% { box-shadow: 0 0 0 4px #ffffff, 12px 12px 0 var(--hot), 0 0 90px rgba(255, 59, 59, .7); }
}
.zhero-name { margin: 1.4rem 0 0; font: 400 3rem/1 var(--display); letter-spacing: .12em; text-transform: uppercase; color: #ffffff; }
.zhero-claim { margin: .5rem 0 0; color: var(--muted); }
.zbot.is-empty .zempty { text-align: center; }
.zbot.is-empty .zempty .chips { justify-content: center; }
@media (prefers-reduced-motion: reduce) { .zbot-avatar-photo.zbot-avatar-hero { animation: none; } }

.zhistory { margin-top: .5rem; }
.zhistory-list { list-style: none; padding: 0; margin: .6rem 0 0; }
.zhistory-list li { display: flex; justify-content: space-between; gap: .75rem; padding: .45rem 0; border-top: 1px solid var(--line); }
.zhistory-list a { overflow-wrap: anywhere; }
.zhistory-list .muted { white-space: nowrap; }

/* Einstieg im Cockpit */
.zbot-teaser { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .7rem 1rem; border-left: 4px solid #ffffff; }
.zbot-teaser-link {
    display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--text);
    font: 400 1.35rem/1 var(--display); letter-spacing: .06em;
}
.zbot-teaser-link:hover { color: #ffffff; }
.zbot-teaser-link:hover .zbot-avatar { filter: drop-shadow(0 0 12px rgba(255, 59, 59, .7)); }
.zbot-teaser-link:hover .zbot-avatar-photo { filter: none; box-shadow: 0 0 0 2px #ffffff, 0 0 18px rgba(255, 59, 59, .8); }
.zbot-teaser input[type="text"] { flex: 1 1 14rem; width: auto; }
.zbot-teaser .zbot-avatar { width: 3.6rem; height: 3.6rem; }

.zlog { display: flex; flex-direction: column; gap: .6rem; min-height: 8rem; padding-bottom: .5rem; }
.zempty { background: var(--panel); border: 1px dashed #4b4f58; border-radius: var(--radius); padding: 1rem 1.1rem; }
.zempty .chip { text-align: left; border-radius: 6px; padding: .4rem .7rem; }
.zmsg { display: flex; gap: .6rem; align-items: flex-start; }
.zmsg-user { justify-content: flex-end; }
.zbubble {
    max-width: min(46rem, 88%); padding: .65rem .9rem; border-radius: 10px; overflow-wrap: anywhere;
    background: var(--panel); border: 1px solid var(--line); border-left: 3px solid #ffffff;
}
.zmsg-user .zbubble { background: #ffffff; color: #0c0c0e; border-color: #ffffff; border-left-width: 1px; }
.zact { margin-left: 3rem; color: var(--muted); font-size: .86rem; overflow-wrap: anywhere; }
.zact-mark {
    display: inline-grid; place-items: center; width: 1.15rem; height: 1.15rem; margin-right: .35rem;
    border-radius: 3px; background: #2bd576; color: #04200e; font-weight: 800; font-size: .72rem;
}
.zact-fail .zact-mark { background: var(--danger); color: #14070a; }
.zstatus { display: flex; align-items: center; gap: .6rem; margin: .4rem 0 .8rem 3rem; color: var(--muted); font-size: .9rem; }
.zdots { display: inline-flex; gap: .25rem; }
.zdots i { width: .45rem; height: .45rem; border-radius: 50%; background: #ffffff; animation: zdot 1s ease-in-out infinite; }
.zdots i:nth-child(2) { animation-delay: .15s; }
.zdots i:nth-child(3) { animation-delay: .3s; }
@keyframes zdot { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
.zform {
    position: sticky; bottom: 0; display: flex; gap: .5rem; align-items: flex-end; padding: .7rem 0 .9rem;
    background: linear-gradient(180deg, transparent, var(--bg) 35%);
}
.zform textarea { flex: 1; min-height: 2.8rem; max-height: 180px; resize: none; }
#zerror { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
#zerror[hidden] { display: none; }

@media (max-width: 640px) {
    .zbot-avatar-big, .zbot-avatar-photo.zbot-avatar-big { width: 3.8rem; height: 3.8rem; }
    .zbot-title p { display: none; }
    .zbubble { max-width: 92%; }
    .zact, .zstatus { margin-left: .2rem; }
    /* über der Daumenleiste bleiben */
    .zform { bottom: calc(3.4rem + env(safe-area-inset-bottom)); }
    .topbar nav a { font-size: .62rem; letter-spacing: .02em; }
}
@media (prefers-reduced-motion: reduce) { .zb-laser, .zdots i { animation: none; } }

/* Schnelle Übergänge zwischen den Seiten (Browser ohne Unterstützung wechseln einfach direkt) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .11s ease-in both; }
::view-transition-new(root) { animation: vt-in .18s ease-out both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }
.topbar { view-transition-name: topbar; }

@media (max-width: 640px) {
    .orbit { padding-top: .25rem; }
    .z-mark { width: 5rem; height: 5rem; font-size: 4rem; box-shadow: 6px 6px 0 var(--hot), 0 0 34px rgba(255, 255, 255, .28); }
    .z-name { font-size: 1.05rem; }
    .spheres { gap: .5rem; margin-top: 2.6rem; }
    .sphere { min-height: 4.6rem; padding: .6rem .25rem; }
    .sphere-name { font-size: 1.05rem; }
    .sphere-count { font-size: .62rem; letter-spacing: .04em; }
    .orbit-drop { margin-top: 2.2rem; }
    .pcards { grid-template-columns: 1fr; }

    /* Tabellen werden auf dem Handy zu gestapelten Karten statt zu quetschen */
    .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { position: relative; padding: .7rem .85rem; border-bottom: 1px solid var(--line); }
    .table tbody tr:last-child { border-bottom: 0; }
    .table th, .table td { padding: .15rem 0; border: 0; }
    .table td:empty { display: none; }
    .table td[data-label]::before {
        content: attr(data-label) ": "; color: var(--muted); font-size: .76rem; font-weight: 700;
        text-transform: uppercase; letter-spacing: .05em;
    }
    .table td.col-check { position: absolute; top: .75rem; right: .85rem; width: auto; padding: 0; }
    .table td.col-check + td { padding-right: 2.5rem; }
    .table td.row-actions { margin-top: .4rem; }
    .table input[type="text"] { min-width: 0; margin-bottom: .3rem; }

    /* iPhone: Navigation als Daumenleiste am unteren Rand */
    .topbar { flex-wrap: nowrap; padding-left: max(.75rem, env(safe-area-inset-left)); padding-right: max(.75rem, env(safe-area-inset-right)); }
    .topbar nav {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; order: 0; flex-basis: auto; gap: 0; overflow: visible;
        background: #000; border-top: 2px solid var(--accent); padding-bottom: env(safe-area-inset-bottom);
    }
    .topbar nav a {
        flex: 1 1 0; min-width: 0; text-align: center; padding: .85rem .1rem .75rem; font-size: .62rem; letter-spacing: .03em;
        border-bottom: 0; border-top: 3px solid transparent;
    }
    .topbar nav a:hover { border-bottom-color: transparent; }
    .topbar nav a.active { border-top-color: var(--accent); border-bottom-color: transparent; }
    .topbar nav a { font-size: .7rem; }
    .wrap { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
    .spark, .z-mark::after, .orbit-drop, .orbit.intro .z-core, .orbit.intro .wire, .orbit.intro .spark,
    .orbit.intro .sphere, .orbit.intro .orbit-drop, .pop { animation: none; }
    .spark { opacity: 0; }
    .sphere, .pcard, .z-mark { transition: none; }
    ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
