/* ===== Liquid-Glass-Design (Apple-inspiriert) ===== */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI Variable", "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;
  --accent: #20bdce;
  --accent2: #1195a5;
  --good: #30d158;
  --warn: #ff9f0a;
  --bad: #ff453a;
  --s-todo: #8e8e93;
  --s-doing: #20bdce;
  --s-review: #ff9f0a;
  --s-done: #30d158;
  --radius: 22px;
  --radius-sm: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
  --bg: #111721;
  --text: #edf2f4;
  --text2: rgba(235, 235, 245, .62);
  --text3: rgba(235, 235, 245, .38);
  --glass: rgba(255, 255, 255, .055);
  --glass-strong: rgba(30, 39, 53, .86);
  --glass-hover: rgba(255, 255, 255, .1);
  --edge: rgba(255, 255, 255, .2);
  --rim-hi: rgba(205, 221, 226, .34); --rim-lo: rgba(255, 255, 255, .08);
  --inner-shadow: rgba(0, 0, 0, .35);
  --stroke: rgba(255, 255, 255, .08);
  --fill: rgba(255, 255, 255, .07);
  --fill2: rgba(255, 255, 255, .12);
  --shadow: 0 1px 1px rgba(0, 0, 0, .4), 0 18px 46px rgba(0, 0, 0, .5);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, .75);
  --scrim: rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
[hidden] { display: none !important; }

/* Nachthimmel: dunkelgraues Blau, ruhige Sterne ohne Bewegung oder Blinken. */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background: var(--bg); }
.star { position: absolute; width: var(--star-size); height: var(--star-size); border-radius: 50%; background: #fff;
  opacity: var(--star-low); animation: starlight var(--star-period) ease-in-out var(--star-delay) infinite; }
@keyframes starlight { 0%, 100% { opacity: var(--star-low); } 50% { opacity: var(--star-high); } }
@media (max-width: 600px) { .star:nth-child(n + 45) { display: none; } }
@media (prefers-reduced-motion: reduce) { .star { animation: none !important; opacity: .28; } }

/* ===== Glas-Grundelement (Liquid Glass) =====
   Schicht 1: Tönung + Unschärfe + Sättigung (überall)
   Schicht 2: Kantenlicht (Rim) und Innenschatten
   Schicht 3: echte Lichtbrechung per SVG-Filter (nur Chromium, siehe js/liquid.js) */
.glass {
  position: relative;
  background: linear-gradient(160deg, rgba(255,255,255,.10), rgba(255,255,255,0) 45%), var(--glass);
  -webkit-backdrop-filter: blur(12px) saturate(185%) brightness(1.06);
  backdrop-filter: blur(12px) saturate(185%) brightness(1.06);
  border: 0;
  border-radius: var(--radius);
  box-shadow:
    var(--shadow),
    inset 0 1px 0.5px var(--rim-hi),
    inset 1px 0 0.5px var(--rim-lo),
    inset 0 -1px 0.5px var(--rim-lo),
    inset 0 -14px 24px -12px var(--inner-shadow),
    inset 0 0 18px rgba(255, 255, 255, .035);
}
.glass::before { /* weicher Glanz oben links */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120% 70% at 12% 0%, rgba(255,255,255,.2), rgba(255,255,255,0) 55%);
  opacity: .55;
}
.glass::after { /* Verlaufs-Rand: hell oben links / unten rechts, dunkel dazwischen */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; padding: 1px;
  background: linear-gradient(135deg, var(--rim-hi), rgba(255,255,255,0) 34%, rgba(255,255,255,0) 66%, var(--rim-lo));
  -webkit-mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); mask-composite: exclude;
  opacity: .9;
}
.glass > * { position: relative; }
.glass-strong { background: var(--glass-strong); }

/* ===== App-Layout ===== */
#app { position: relative; z-index: 1; min-height: 100dvh; }
.shell { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 16px; padding: 16px; min-height: 100dvh; }
.sidebar { position: sticky; top: 16px; height: calc(100dvh - 32px); display: flex; flex-direction: column; padding: 18px 12px; gap: 6px; overflow: hidden; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 14px; font-weight: 700; font-size: 19px; letter-spacing: -.02em; }
.brand img { width: 30px; height: 30px; border-radius: 9px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav button {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 13px; color: var(--text);
  background: none; border: 0; text-align: left; cursor: pointer; font-weight: 500; transition: background .2s;
}
.nav a:hover, .nav button:hover { background: var(--fill); }
.nav a, .nav button { box-shadow: inset 0 0 0 1.5px transparent; transition: box-shadow .3s var(--ease), background .3s var(--ease), color .2s; }
.nav a.active { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--accent); }
.nav a.active:hover { background: var(--fill); }
/* Projekte: Umrandung in Projektfarbe (aktiv: kräftiger + Leuchten) */
.nav a.proj-link { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--pc) 50%, transparent); }
.nav a.proj-link:hover { background: color-mix(in srgb, var(--pc) 9%, transparent); }
.nav a.proj-link.active { box-shadow: inset 0 0 0 2px var(--pc), 0 0 18px -2px color-mix(in srgb, var(--pc) 55%, transparent); background: color-mix(in srgb, var(--pc) 7%, transparent); }
.nav a.sort-ghost { opacity: .3; }
.sort-lift { position: fixed; z-index: 500; pointer-events: none; margin: 0; background: var(--glass-strong); border-radius: 13px; box-shadow: var(--shadow-lg), inset 0 0 0 2px var(--pc); transform: scale(1.03); }
.pcard.sort-ghost { opacity: .3; }
.nav a.proj-link, .pcard { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.nav .ico { width: 20px; height: 20px; flex: none; }
.nav-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text3); padding: 14px 12px 4px; font-weight: 600; }
.nav .proj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .scroll { overflow-y: auto; flex: 1; margin: 0 -6px; padding: 0 6px; }
.sidebar-foot { display: flex; align-items: center; gap: 10px; padding: 10px 8px 2px; border-top: 1px solid var(--stroke); }
.sidebar-foot .who { flex: 1; min-width: 0; }
.who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.who span { font-size: 12px; color: var(--text2); }

.main { min-width: 0; display: flex; flex-direction: column; gap: 16px; padding-bottom: 8px; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 4px 4px 0; }
.topbar h1 { font-size: 30px; letter-spacing: -.03em; font-weight: 750; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page { display: flex; flex-direction: column; gap: 16px; animation: rise .26s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* Tab-Leiste (iPhone) */
.tabbar { display: none; }

/* ===== Buttons & Eingaben ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--stroke); cursor: pointer;
  padding: 9px 16px; border-radius: 999px; background: var(--fill); font-weight: 600; transition: transform .15s var(--ease), background .2s, box-shadow .2s;
  white-space: nowrap; user-select: none;
}
.btn:hover { background: var(--fill2); }
.btn:active { transform: scale(.96); }
.btn.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent)); color: #fff; border-color: transparent; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent), inset 0 1px 0 rgba(255,255,255,.35); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.icon { padding: 0; width: 40px; height: 40px; }
.btn .ico { width: 18px; height: 18px; }
.btn:disabled { opacity: .5; pointer-events: none; }

.input, select.input, textarea.input {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--stroke); background: var(--fill);
  outline: none; transition: border-color .2s, box-shadow .2s, background .2s; appearance: none; -webkit-appearance: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); background: var(--glass-strong); }
textarea.input { resize: vertical; min-height: 84px; }
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%238e8e93' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text2); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }

.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--fill); border: 1px solid var(--stroke); gap: 2px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--text2); white-space: nowrap; transition: all .25s var(--ease); display: inline-flex; gap: 7px; align-items: center; }
.seg button .ico { width: 16px; height: 16px; }
.seg button.active { background: var(--glass-strong); color: var(--text); box-shadow: 0 2px 10px rgba(0,0,0,.14), inset 0 1px 0 var(--edge); }

.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; flex: none; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; background: var(--fill); font-size: 12px; font-weight: 600; color: var(--text2); white-space: nowrap; }
.chip .ico { width: 12px; height: 12px; }
.chip.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.chip.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.chip.good { color: var(--good); background: color-mix(in srgb, var(--good) 15%, transparent); }
.prio-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.prio-high { background: var(--bad); } .prio-med { background: var(--warn); } .prio-low { background: var(--text3); }

/* ===== Karten / Kacheln ===== */
.card { padding: 18px; }
.card h2, .card-title { font-size: 16px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-title .grow { flex: 1; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 16px 18px; }
.stat .k { font-size: 12px; color: var(--text2); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat .v { font-size: 34px; font-weight: 750; letter-spacing: -.03em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 14px; font-weight: 600; color: var(--text2); margin-left: 4px; }
.stat.bad .v { color: var(--bad); }
.cols-2 { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.empty { text-align: center; padding: 34px 16px; color: var(--text2); }
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }

.progress { height: 6px; border-radius: 99px; background: var(--fill2); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .5s var(--ease); }

/* Aufgabenzeilen */
.tlist { display: flex; flex-direction: column; }
.trow { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-radius: 12px; cursor: pointer; transition: background .15s; }
.trow:hover { background: var(--fill); }
.trow + .trow { border-top: 1px solid var(--stroke); }
.trow .t { flex: 1; min-width: 0; }
.trow .t b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow .t span { font-size: 12.5px; color: var(--text2); }
.trow.done .t b { text-decoration: line-through; color: var(--text3); }
.check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--text3); background: none; cursor: pointer; flex: none; display: grid; place-items: center; transition: all .2s var(--ease); padding: 0; color: #fff; }
.check .ico { width: 14px; height: 14px; opacity: 0; transform: scale(.5); transition: all .2s var(--ease); }
.check.on { background: var(--good); border-color: var(--good); }
.check.on .ico { opacity: 1; transform: none; }
.check:hover { border-color: var(--good); }

/* Quick-Add */
.quick { display: flex; gap: 8px; align-items: center; padding: 8px 8px 8px 16px; border-radius: 999px; }
.quick .ico { width: 20px; height: 20px; color: var(--accent); flex: none; }
.quick input { flex: 1; min-width: 0; background: none; border: 0; outline: none; padding: 8px 0; }
.quick input::placeholder { color: var(--text3); }

/* Projektkacheln */
.pcard { padding: 18px; cursor: pointer; transition: transform .25s var(--ease), box-shadow .25s; display: flex; flex-direction: column; gap: 12px; }
.pcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg), inset 0 1px 0 var(--edge); }
.pcard .head { display: flex; align-items: center; gap: 12px; }
.pcard .badge { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; color: #fff; font-weight: 700; flex: none; }
.pcard h3 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.pcard .meta { display: flex; gap: 6px; flex-wrap: wrap; }
.pgrid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* ===== Board ===== */
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x proximity; }
.col { --shadow: 0 4px 12px rgba(0, 0, 0, .16); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 140px; scroll-snap-align: start; transition: box-shadow .2s, background .2s; }
.col.over { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px; font-weight: 700; }
.col-head .sdot { width: 10px; height: 10px; border-radius: 50%; }
.col-head .count { font-size: 12px; background: var(--fill2); padding: 1px 8px; border-radius: 99px; color: var(--text2); font-weight: 600; }
.col-head .grow { flex: 1; }
.col-cards { display: flex; flex-direction: column; gap: 10px; min-height: 40px; }
.tcard {
  background: var(--glass-strong); border: 1px solid var(--stroke); border-radius: 16px; padding: 12px 13px; cursor: grab; box-shadow: 0 2px 10px rgba(0,0,0,.08), inset 0 1px 0 var(--edge);
  display: flex; flex-direction: column; gap: 8px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; transition: transform .15s var(--ease), box-shadow .2s;
}
.tcard:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0,0,0,.14), inset 0 1px 0 var(--edge); }
.tcard .tt { font-weight: 600; line-height: 1.3; word-break: break-word; }
.tcard .tmeta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tcard .tmeta .grow { flex: 1; }
.tcard.done .tt { text-decoration: line-through; color: var(--text3); }
.tcard.ghost { opacity: .25; }
.tcard.lifting { position: fixed; z-index: 500; pointer-events: none; margin: 0; transform: rotate(2.5deg) scale(1.03); box-shadow: var(--shadow-lg); cursor: grabbing; transition: none; opacity: .97; }
.drop-ind { height: 4px; border-radius: 4px; background: var(--accent); margin: -3px 0; box-shadow: 0 0 12px var(--accent); }
.add-inline { display: flex; gap: 6px; }
.add-btn { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px; border-radius: 12px; border: 1px dashed var(--stroke); background: none; color: var(--text2); cursor: pointer; font-weight: 600; transition: all .2s; }
.add-btn:hover { background: var(--fill); color: var(--text); }
.add-btn .ico { width: 16px; height: 16px; }
body.dragging { user-select: none; -webkit-user-select: none; cursor: grabbing; }

/* ===== Kalender ===== */
.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-head h2 { margin: 0; font-size: 20px; flex: 1; min-width: 140px; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { text-align: center; font-size: 12px; font-weight: 600; color: var(--text3); padding: 4px 0; text-transform: uppercase; }
.cal-day { min-height: 92px; padding: 6px; border-radius: 14px; background: var(--fill); border: 1px solid transparent; cursor: pointer; display: flex; flex-direction: column; gap: 3px; overflow: hidden; transition: background .15s; text-align: left; }
.cal-day:hover { background: var(--fill2); }
.cal-day.other { opacity: .4; }
.cal-day.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.cal-day .n { font-size: 13px; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.today .n { background: var(--accent); color: #fff; }
.cal-chip { font-size: 11.5px; padding: 1px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: #fff; }
.cal-chip.task { background: none; border: 1px solid; }
.cal-dots { display: none; gap: 3px; flex-wrap: wrap; }
.cal-dots i { width: 6px; height: 6px; border-radius: 50%; }
.cal-more { font-size: 11px; color: var(--text2); }
.day-panel .item { display: flex; align-items: center; gap: 10px; padding: 8px 4px; }
.day-panel .item + .item { border-top: 1px solid var(--stroke); }
.day-panel .bar { width: 4px; align-self: stretch; border-radius: 4px; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week .wday { padding: 10px; border-radius: 16px; background: var(--fill); display: flex; flex-direction: column; gap: 6px; min-height: 160px; }
.week .wday.today { outline: 2px solid var(--accent); }
.week .wday h4 { margin: 0; font-size: 13px; }

/* ===== Charts ===== */
.chart-bars { display: flex; gap: 6px; align-items: flex-end; height: 130px; }
.chart-bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.chart-bars .b i { width: 100%; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 100%, #fff 18%), var(--accent2)); min-height: 4px; transition: height .6s var(--ease); }
.chart-bars .b.today i { background: linear-gradient(180deg, #ff9f0a, #ff5a2b); }
.chart-bars .b span { font-size: 11px; color: var(--text2); }
.chart-bars .b em { font-style: normal; font-size: 11px; font-weight: 700; }
.legend { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.legend .li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.legend .li i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.legend .li b { margin-left: auto; font-variant-numeric: tabular-nums; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-wrap svg { flex: none; }
.hbar { display: grid; grid-template-columns: 110px 1fr 40px; gap: 10px; align-items: center; font-size: 13.5px; padding: 5px 0; }
.hbar .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .track { height: 10px; border-radius: 99px; background: var(--fill2); overflow: hidden; display: flex; }
.hbar .track i { display: block; height: 100%; }
.big-pct { font-size: 44px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }

/* ===== Modal / Sheet ===== */
.overlay { position: fixed; inset: 0; z-index: 200; background: var(--scrim); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 22px; border-radius: 28px; box-shadow: var(--shadow-lg), inset 0 1px 0 var(--edge); animation: pop .35s var(--ease); display: flex; flex-direction: column; gap: 14px; }
@keyframes pop { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.sheet h2 { font-size: 20px; letter-spacing: -.02em; margin: 0; }
.sheet .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.sheet .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sub { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.sub .check { width: 20px; height: 20px; }
.sub input.plain { flex: 1; background: none; border: 0; outline: none; padding: 4px 0; min-width: 0; }
.sub.done input.plain { text-decoration: line-through; color: var(--text3); }

#toasts { position: fixed; z-index: 400; left: 0; right: 0; top: calc(14px + var(--safe-t)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 14px; }
.toast { pointer-events: auto; padding: 11px 18px; border-radius: 999px; background: var(--glass-strong); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%); border: 1px solid var(--stroke); box-shadow: var(--shadow-lg), inset 0 1px 0 var(--edge); font-weight: 600; animation: pop .35s var(--ease); max-width: 100%; }
.toast.err { color: var(--bad); }

/* ===== Auth ===== */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.auth .box { width: min(420px, 100%); padding: 30px; display: flex; flex-direction: column; gap: 16px; border-radius: 30px; }
.auth h1 { font-size: 28px; letter-spacing: -.03em; }
.auth .logo { width: 62px; height: 62px; border-radius: 18px; box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 45%, transparent); }
.err-text { color: var(--bad); font-size: 13.5px; font-weight: 600; min-height: 0; }

/* Mitglieder / Rechte */
.perm-row { display: grid; grid-template-columns: minmax(140px, 1.2fr) repeat(4, minmax(90px, 1fr)); gap: 8px; align-items: center; padding: 10px 0; }
.perm-row + .perm-row { border-top: 1px solid var(--stroke); }
.perm-row select.input { padding: 7px 28px 7px 10px; font-size: 13.5px; border-radius: 10px; background-position: right 9px center; }
.perm-header, .perm-head { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text3); font-weight: 700; }
.perm-row .perm-head { display: none; }
.perm-row.level-view select.input { }
.codebox { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; padding: 10px 12px; border-radius: 12px; background: var(--fill); word-break: break-all; user-select: all; }
details.acc { border-top: 1px solid var(--stroke); padding: 10px 0; }
details.acc summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 10px; }
details.acc summary::-webkit-details-marker { display: none; }
.kbd { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--fill2); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }

.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ===== Responsive: Tablet ===== */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-2, .cols-3 { grid-template-columns: minmax(0, 1fr); }
}

/* ===== Responsive: iPhone ===== */
@media (max-width: 860px) {
  body { font-size: 16px; }
  .shell { display: block; padding: calc(10px + var(--safe-t)) 12px calc(98px + var(--safe-b)); }
  .sidebar { display: none; }
  .topbar h1 { font-size: 30px; }
  .main { gap: 14px; }
  input, select, textarea, .input { font-size: 16px; }

  .tabbar {
    display: flex; position: fixed; z-index: 150; left: 12px; right: 12px; bottom: calc(10px + var(--safe-b)); padding: 7px; gap: 4px; border-radius: 30px;
    background: var(--glass); -webkit-backdrop-filter: blur(28px) saturate(190%); backdrop-filter: blur(28px) saturate(190%);
    border: 1px solid var(--stroke); box-shadow: var(--shadow-lg), inset 0 1px 0 var(--edge);
  }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px; border-radius: 22px; color: var(--text2); font-size: 10.5px; font-weight: 600; background: none; border: 0; cursor: pointer; transition: all .25s var(--ease); }
  .tabbar .ico { width: 24px; height: 24px; }
  .tabbar a.active { color: var(--accent); background: var(--fill); }
  .tabbar .plus { flex: 0 0 56px; height: 56px; margin-top: -22px; border-radius: 50%; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 85%, #fff), var(--accent)); color: #fff; box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 55%, transparent), inset 0 1px 0 rgba(255,255,255,.4); justify-content: center; border: 3px solid var(--glass-strong); }
  .tabbar .plus .ico { width: 28px; height: 28px; }

  .stats { gap: 10px; }
  .stat { padding: 13px 14px; }
  .stat .v { font-size: 28px; }
  .grid { gap: 12px; }
  .card { padding: 15px; }
  .pgrid { grid-template-columns: minmax(0, 1fr); }

  .board { grid-template-columns: repeat(4, 84vw); margin: 0 -12px; padding: 0 12px 10px; scroll-snap-type: x mandatory; scroll-padding: 0 12px; }
  .col { scroll-snap-align: start; }
  .tcard { cursor: default; }

  .cal-day { min-height: 54px; align-items: center; padding: 4px 2px; gap: 2px; }
  .cal-day .cal-chip, .cal-day .cal-more { display: none; }
  .cal-dots { display: flex; justify-content: center; max-width: 100%; }
  .week { grid-template-columns: minmax(0, 1fr); }
  .week .wday { min-height: 0; }

  .overlay { place-items: end center; padding: 0; }
  .sheet { border-radius: 30px 30px 0 0; padding: 20px 18px calc(22px + var(--safe-b)); max-height: 92dvh; width: 100%; animation: slide .4s var(--ease); }
  @keyframes slide { from { transform: translateY(100%); } }
  .sheet .two { grid-template-columns: 1fr 1fr; }
  .perm-row { grid-template-columns: 1fr 1fr; }
  .perm-row .pname { grid-column: 1 / -1; font-weight: 700; }
  .perm-header { display: none; }
  .perm-row .perm-head { display: block; }
  .hbar { grid-template-columns: 90px 1fr 34px; }
  .desktop-only { display: none !important; }
  .cal-head h2 { flex: 1 1 100%; }
  .cal-head .seg { margin-left: auto; }
}
@media (min-width: 861px) { .mobile-only { display: none !important; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .tabbar, .toast { background: var(--glass-strong); }
}

/* Persönlicher Tagesplan */
.dashboard-intro { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 0 4px; }
.eyebrow { font-weight: 650; color: var(--accent); margin-bottom: 4px; }
.quick-hint { margin: -6px 4px 0; }
.quick .btn .ico { color: inherit; }
.dashboard-columns { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; }
.dashboard-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 28px 12px; }
.dashboard-empty > .ico { width: 30px; height: 30px; color: var(--accent); }
.task-open { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; padding: 4px 0; }
.task-open .t { overflow: hidden; }
.agenda-row { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; border-left: 3px solid var(--pc); border-radius: 8px; padding: 12px 10px; margin-bottom: 8px; background: var(--fill); color: inherit; text-align: left; cursor: pointer; }
.agenda-date { flex: 0 0 56px; font-size: 12px; font-weight: 650; }
.agenda-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.project-shortcuts { display: flex; flex-wrap: wrap; gap: 10px; }
.project-shortcut { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 14px; background: var(--fill); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
@media (max-width: 1100px) { .dashboard-columns { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 540px) { .dashboard-intro .row { gap: 8px; } .dashboard-intro .btn { padding: 10px 12px; font-size: 13px; } .task-open { flex-wrap: wrap; } .task-open .t { flex-basis: calc(100% - 20px); } .topbar { gap: 8px; } .topbar h1 { font-size: 25px; } }

/* CarStage: gemeinsame Tagesansicht mit echtem Stundenraster. */
.task-filters .input { min-width: 0; }
.task-filters select { width: 185px; flex: none; }
.calendar-date { width: 145px; padding: 8px; }
.embedded-calendar { height: 100%; }
.embedded-calendar .cal-head { gap: 6px; margin-top: 14px; }
.embedded-calendar .cal-head h2 { font-size: 14px; flex-basis: 100%; }
.day-timeline-scroll { height: min(62vh, 640px); min-height: 300px; overflow: auto; overscroll-behavior: contain; border: 1px solid var(--stroke); border-radius: 12px; background: rgba(12,18,28,.22); }
.embedded-calendar .day-timeline-scroll { height: 430px; }
.day-timeline { position: relative; height: 1152px; margin: 12px 10px 12px 0; }
.hour-line { position: absolute; width: 100%; height: 1px; background: rgba(170,190,215,.12); padding-left: 54px; pointer-events: none; }
.hour-line span { position: absolute; left: 8px; top: -7px; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hour-slot { position: absolute; left: 54px; right: 0; height: 48px; background: transparent; border: 0; cursor: pointer; }
.hour-slot:hover, .hour-slot:focus-visible { background: rgba(90,145,225,.08); }
.day-event-layer { position: absolute; top: 0; bottom: 0; left: 58px; right: 0; pointer-events: none; }
.timed-event { position: absolute; pointer-events: auto; overflow: hidden; border: 1px solid rgba(100,160,240,.28); border-left: 3px solid var(--event-color); border-radius: 7px; padding: 5px 7px; text-align: left; color: var(--text); background: #233852; cursor: pointer; display: flex; flex-direction: column; gap: 3px; font: inherit; }
.timed-event b { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 0; }
.timed-event span { font-size: 10px; opacity: .75; font-variant-numeric: tabular-nums; }
.timed-event:hover { background: #2b4360; }
.now-line { position: absolute; left: 54px; right: 0; height: 1px; background: #fa6c78; pointer-events: none; }
.now-line span { position: absolute; top: -7px; left: -33px; color: #fa6c78; font-size: 9px; background: #151c28; }
.all-day-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--stroke); margin-bottom: 8px; }
.all-day-row > span { min-width: 54px; font-size: 10px; }
.all-day-row .done { text-decoration: line-through; opacity: .55; }
.calendar-empty { margin: 0 0 10px; }
@media(max-width:600px) {
  .task-filters { flex-wrap: wrap; }
  .task-filters select { width: 100%; }
  .cal-head h2 { flex-basis: 100%; }
  .calendar-date { width: 135px; }
  .day-timeline-scroll, .embedded-calendar .day-timeline-scroll { height: 400px; }
  .timed-event { padding: 4px; }
}

.embedded-calendar .cal-head .btn { font-size: 12px; padding: 7px 10px; }
.embedded-calendar .cal-head .btn.icon { width: 32px; height: 32px; padding: 6px; }
.embedded-calendar .cal-head .calendar-date { width: 128px; font-size: 12px; }
.embedded-calendar .cal-head .btn.primary { width: 32px; height: 32px; padding: 6px; }
.embedded-calendar .all-day-row .btn { font-size: 11px; padding: 5px 8px; }
.all-day-row > .row { gap: 5px; min-width: 0; }

/* CarStage: türkis/silber, mit heller Silhouette auf dem dunklen Nachthimmel. */
.brand { color: var(--text); padding: 4px 8px 18px; gap: 12px; }
.brand img { width: 48px; height: 48px; border-radius: 50%; flex: none; }
.brand-type { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.brand-name { font-size: 21px; line-height: 1; font-weight: 850; font-style: italic; letter-spacing: -.045em; white-space: nowrap; }
.brand-name > span { color: var(--accent); }
.brand-caption { font-size: 9px; font-weight: 600; letter-spacing: .24em; color: var(--text2); }
.brand:hover .brand-name > span { color: #69dbe5; }
.mobile-brand { display: none; }
.auth-brand { padding: 0 0 6px; gap: 16px; align-self: flex-start; }
.auth-brand img { width: 70px; height: 70px; }
.auth-brand .brand-name { font-size: 28px; }
.auth-brand .brand-caption { font-size: 10px; }
.btn.primary { color: #082a30; background: linear-gradient(180deg, #4cd1dd, var(--accent)); box-shadow: 0 5px 16px rgba(32,189,206,.18), inset 0 1px 0 rgba(255,255,255,.28); }
.nav a.active { background: rgba(32,189,206,.06); box-shadow: inset 0 0 0 1px rgba(32,189,206,.5); }
.nav a.active .ico { color: var(--accent); }
.avatar { color: #09272e; background: linear-gradient(135deg, #72d5df, var(--accent2)); }
.cal-day.today .n { color: #082a30; }
.timed-event { background: #19323b; border-color: rgba(32,189,206,.22); }
.timed-event:hover { background: #22434c; }
@media(max-width:860px) {
  .mobile-brand { display: flex; padding: 2px 2px 18px; gap: 10px; }
  .mobile-brand img { width: 34px; height: 34px; }
  .mobile-brand .brand-name { font-size: 18px; }
  .mobile-brand .brand-caption { font-size: 8px; }
  .tabbar .plus { color: #082a30; background: linear-gradient(180deg, #4cd1dd, var(--accent)); box-shadow: 0 8px 22px rgba(32,189,206,.24); }
}

/* Chat zur direkten CarStage-Erfassung, vorbereitet für die spätere Handy-App. */
.capture-page { height: calc(100dvh - 40px); max-width: 1050px; margin-inline: auto; width: 100%; }
.capture-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.capture-header h1 { font-size: 28px; }
.capture-history { flex: 1; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding: 12px 4px; overscroll-behavior: contain; scrollbar-width: thin; }
.capture-user { align-self: flex-end; max-width: 85%; background: rgba(32,189,206,.12); border: 1px solid rgba(32,189,206,.23); padding: 13px 18px; border-radius: 20px 20px 4px 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.capture-answer { align-self: flex-start; width: min(88%, 640px); display: grid; gap: 7px; padding: 0 8px 8px; overflow-wrap: anywhere; }
.capture-task { display: grid; gap: 12px; padding: 16px; background: var(--glass); border: 1px solid var(--stroke); border-radius: 18px; }
.capture-task .btn { justify-self: start; }
.capture-task .row { flex-wrap: wrap; }
.capture-intro { margin: auto; max-width: 560px; display: grid; gap: 18px; text-align: center; justify-items: center; padding: 24px 8px; }
.capture-intro > .ico { color: var(--accent); width: 36px; height: 36px; }
.capture-intro h2 { font-size: clamp(21px, 3vw, 30px); }
.capture-examples { display: grid; gap: 10px; }
.capture-examples .btn { white-space: normal; text-align: left; }
.capture-composer { flex: none; padding: 14px; border-radius: 22px; display: grid; gap: 12px; }
.capture-composer textarea { resize: none; min-height: 66px; max-height: 160px; }
.capture-composer .err-text:empty { display: none; }
.capture-connect { display: grid; gap: 12px; }
.capture-connect .btn { justify-self: start; }
.prio-label-high { color: var(--bad); } .prio-label-med { color: var(--warn); } .prio-label-low { color: var(--text2); }
@media (max-width: 760px) {
  .capture-page { height: calc(100dvh - 170px - var(--safe-t) - var(--safe-b)); min-height: 390px; gap: 12px; }
  .capture-header h1 { font-size: 24px; }
  .capture-header .chip { font-size: 11px; }
  .capture-composer { padding: 10px; }
  .capture-composer .row { flex-wrap: wrap; gap: 8px; }
  .capture-user { max-width: 92%; padding: 12px; }
  .capture-answer { width: 96%; padding: 0 2px 8px; }
}

.capture-voice-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.capture-voice-actions [type=submit] { margin-left: auto; }
.capture-mic { min-height: 54px; min-width: 148px; color: var(--accent); background: rgba(32,189,206,.1); border: 1px solid rgba(32,189,206,.3); font-size: 16px; }
.capture-mic .ico { width: 25px; height: 25px; }
.capture-mic[aria-pressed=true] { color: var(--text); background: rgba(255,69,58,.14); border-color: rgba(255,69,58,.6); }
.capture-composer.is-listening { box-shadow: 0 0 0 1px rgba(255,69,58,.4), var(--shadow); }
.capture-voice-status { line-height: 1.5; }
.is-listening .capture-voice-status { color: var(--text); }
.capture-voice-actions [hidden] { display: none; }
@media(max-width: 480px) {
  .capture-mic { flex: 1; }
  .capture-voice-actions [type=submit] { margin-left: 0; }
  .capture-voice-actions:has([aria-pressed=true]) [type=submit] { display: none; }
}
