/* ==========================================================================
   Seiten-Bau HQ – im Seiten-Bau Design System: Indigo, Ink, Clash Display + Inter,
   Haarlinien als Ringe statt Rahmen. Aufbau übernommen aus Sasa HQ.
   ========================================================================== */

@font-face { font-family: "Clash Display"; src: url("../assets/ClashDisplay-Bold.otf") format("opentype"); font-weight: 600 700; font-style: normal; font-display: swap; }

:root {
  --accent: #4338CA;
  --accent-2: #6D5AE6;
  --accent-grad: linear-gradient(90deg, #4338CA 0%, #6D5AE6 100%);
  --accent-soft: rgba(67, 56, 202, .1);
  --accent-ink: #fff;
  --red: #DC2626;
  --red-soft: rgba(220, 38, 38, .1);
  --green: #1BA672;
  --green-soft: rgba(27, 166, 114, .13);
  --amber: #E8A317;
  --amber-soft: rgba(232, 163, 23, .16);
  --amber-text: #9A6700;
  --teal: #14B8A6;
  --orange: #EA7A3B;

  --bg: #F6F8FB;
  --surface: #FFFFFF;
  --surface-2: #EFF2F7;
  --hover: #E4E8F0;
  --text: #0F172A;
  --text-2: #5B667A;
  --text-3: #94A0B4;
  --line: #E7EAF1;
  --blue: #4338CA;
  --blue-soft: rgba(67, 56, 202, .1);
  --ring: inset 0 0 0 1px var(--line);
  --shadow: inset 0 0 0 1px var(--line), 0 8px 24px -12px rgba(15, 23, 42, .14);
  --shadow-hover: inset 0 0 0 1px #DCE0EA, 0 20px 45px -20px rgba(15, 23, 42, .24);
  --shadow-lg: 0 30px 80px -24px rgba(15, 23, 42, .38), 0 0 0 1px rgba(15, 23, 42, .05);
  --shadow-brand: 0 14px 30px -10px rgba(67, 56, 202, .55);
  --backdrop: rgba(15, 23, 42, .24);
  --glow: radial-gradient(closest-side, rgba(109, 90, 230, .16), rgba(109, 90, 230, 0) 70%);

  --radius: 20px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.32, .72, 0, 1);
  --ease-out: cubic-bezier(.22, .61, .36, 1);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Clash Display", "Inter", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --topbar: 64px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --accent: #8B7CF6;
  --accent-2: #A79BFA;
  --accent-grad: linear-gradient(90deg, #6D5AE6 0%, #A79BFA 100%);
  --accent-soft: rgba(139, 124, 246, .16);
  --accent-ink: #0B1120;
  --red: #F05252;
  --red-soft: rgba(240, 82, 82, .16);
  --green: #34C38F;
  --green-soft: rgba(52, 195, 143, .15);
  --amber-text: #F2B84B;
  --bg: #0B1120;
  --surface: #111A2E;
  --surface-2: #1A2540;
  --hover: #24304D;
  --text: #F1F4FA;
  --text-2: #AEB6CB;
  --text-3: #6F7A93;
  --line: rgba(199, 205, 224, .1);
  --blue: #A5B4FC;
  --blue-soft: rgba(165, 180, 252, .14);
  --shadow: inset 0 0 0 1px var(--line);
  --shadow-hover: inset 0 0 0 1px rgba(199, 205, 224, .18), 0 20px 45px -20px rgba(0, 0, 0, .6);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .7), 0 0 0 1px rgba(199, 205, 224, .08);
  --shadow-brand: 0 14px 30px -12px rgba(109, 90, 230, .6);
  --backdrop: rgba(3, 6, 15, .5);
  --glow: radial-gradient(closest-side, rgba(109, 90, 230, .22), rgba(109, 90, 230, 0) 70%);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -.01em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--red-soft); }
[hidden] { display: none !important; }

.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 24px; height: 24px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Boot ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-logo { animation: pulse 1.2s var(--ease) infinite alternate; }
@keyframes pulse { from { transform: scale(.92); opacity: .6; } to { transform: scale(1); opacity: 1; } }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; letter-spacing: -.03em; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 30px; height: 22px; border-radius: 7px; display: grid; place-items: center;
  background: var(--red); color: #fff; font-size: 13px; font-weight: 700; letter-spacing: 0;
}
.boot-logo .logo-mark { width: 56px; height: 40px; border-radius: 12px; font-size: 22px; }
.logo small { font-weight: 400; color: var(--text-2); font-size: 12px; letter-spacing: 0; margin-left: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: 18px;
  background: var(--surface-2); color: var(--text); font-weight: 500; white-space: nowrap;
  transition: background-color .15s ease, transform .16s var(--ease-out), opacity .15s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:active, .icon-btn:active, .chip:active, .tile:active, .pcard:active { transform: scale(.97); transition-duration: .08s; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--text); color: var(--bg); box-shadow: 0 10px 24px -10px rgba(15, 23, 42, .45); }
.btn.primary:hover { opacity: .88; }
.btn.red { background: var(--red); color: #fff; }
.btn.red:hover { filter: brightness(.94); }
.btn.accent { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-brand); }
.btn.accent:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.soft:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.blue { background: var(--blue-soft); color: var(--blue); }
.btn.danger { color: var(--red); background: transparent; }
.btn.danger:hover { background: var(--red-soft); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; border-radius: 15px; }
.btn.block { width: 100%; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  color: var(--text); transition: background-color .15s ease, transform .16s var(--ease-out);
  -webkit-tap-highlight-color: transparent; position: relative;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn .badge { position: absolute; top: 6px; right: 6px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px;
  background: var(--surface-2); font-weight: 500; font-size: 14px; white-space: nowrap;
  transition: background-color .15s, color .15s, transform .16s var(--ease-out);
}
.chip:hover { background: var(--hover); }
.chip.active { background: var(--accent); color: var(--accent-ink); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; line-height: 1;
}
.pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 100px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.amber { background: var(--amber-soft); color: var(--amber-text); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.orange { background: color-mix(in srgb, var(--orange) 15%, transparent); color: var(--orange); }
.red-text { color: var(--red); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.dark { background: var(--text); color: var(--bg); }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; }
.field > span, .label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.input, .textarea, .select {
  width: 100%; min-height: 40px; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--text); box-shadow: none;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.input:hover, .textarea:hover, .select:hover { border-color: var(--text-3); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select.sm { min-height: 34px; padding: 4px 10px; width: auto; max-width: 220px; }
.textarea { resize: none; line-height: 1.5; }
.input.plain, .textarea.plain { border-color: transparent; background: transparent; padding-left: 0; padding-right: 0; }
.input.plain:hover, .textarea.plain:hover { border-color: transparent; }
.input.plain:focus, .textarea.plain:focus { box-shadow: none; border-color: transparent; }
.form-error { color: var(--red); font-size: 13px; min-height: 18px; }

.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); gap: 2px; }
.seg button { height: 30px; padding: 0 12px; border-radius: 8px; font-weight: 500; color: var(--text-2); transition: background-color .2s var(--ease), color .2s; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(15, 23, 42, .12), inset 0 0 0 1px var(--line); }

/* ---------- Avatar ---------- */
.av {
  --s: 32px;
  width: var(--s); height: var(--s); border-radius: 50%; flex: none;
  display: inline-grid; place-items: center; color: #fff; font-weight: 500;
  font-size: calc(var(--s) * .42); background: var(--c, #888); user-select: none; position: relative;
}
.av img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
/* Online-Punkt sitzt auf dem Rand des Kreises, nicht im Bild */
.av.online::after {
  content: ""; position: absolute; right: -1px; bottom: -1px;
  width: max(9px, 26%); height: max(9px, 26%); border-radius: 50%;
  background: var(--green); box-shadow: 0 0 0 2px var(--surface);
}
.sheet .av.online::after { box-shadow: 0 0 0 2px var(--bg); }
:root[data-theme="light"] .sheet .av.online::after { box-shadow: 0 0 0 2px var(--surface); }
.av-stack { display: inline-flex; }
.av-stack .av { box-shadow: 0 0 0 2px var(--surface); }
.av-stack .av + .av { margin-left: -8px; }

/* ==========================================================================
   Topbar + Home
   ========================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar);
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
}
.topbar .spacer { flex: 1; }
.topbar .demo-flag { margin-left: 4px; }
.topbar .me-btn { border-radius: 50%; transition: transform .16s var(--ease-out); }
.topbar .me-btn:active { transform: scale(.94); }

.home { padding: 8px 24px 48px; max-width: 1440px; margin: 0 auto; transition: transform .5s var(--ease), filter .5s var(--ease); transform-origin: 50% 30vh; }
body.has-layer .home { transform: scale(.985); }
.hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 16px 0 24px; flex-wrap: wrap; }
.hello h1 { font-family: var(--display); font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.hello p { color: var(--text-2); margin-top: 4px; }

.topbar { display: grid; grid-template-columns: 1fr minmax(0, auto) 1fr; }
.tb-left, .tb-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tb-right { justify-content: flex-end; }

.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-flow: dense;
}
.tile {
  --i: 0;
  position: relative; display: flex; flex-direction: column; min-height: 200px; min-width: 0;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px 20px; text-align: left; cursor: pointer; overflow: hidden;
  transition: box-shadow .25s var(--ease), transform .25s var(--ease);
  animation: rise .6s var(--ease) both; animation-delay: calc(var(--i) * 45ms);
  -webkit-tap-highlight-color: transparent;
}
.tile:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.tile-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.tile-head h2 { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.ti { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); color: var(--accent); box-shadow: var(--ring); flex: none; }
.ti.sm { width: 30px; height: 30px; border-radius: 9px; }
.tile-head .ti.accent { background: var(--accent-grad); color: #fff; box-shadow: var(--shadow-brand); }
.tile-head .go { margin-left: auto; color: var(--text-3); transition: transform .25s var(--ease), color .2s; }
.tile:hover .go { transform: translateX(3px); color: var(--text); }
.tile-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.tile .empty { color: var(--text-3); margin: auto 0; }

.t-next { grid-column: span 4; grid-row: span 2; }
.t-board { grid-column: span 8; }
.t-todos { grid-column: span 4; }
.t-cal { grid-column: span 4; }
.t-fin { grid-column: span 8; }
.t-chats { grid-column: span 4; }
.t-team { grid-column: span 4; }

/* Nach dem ersten Auftritt keine Einblend-Animationen mehr bei Aktualisierungen */
.settled .tile, .settled .progress > i, .settled .flow-bar > i, .settled .line.draw, .settled .area { animation: none; stroke-dashoffset: 0; opacity: 1; }
.tile [data-open] { cursor: pointer; transition: background-color .15s, transform .16s var(--ease-out); }
.tile .queue-item[data-open]:hover, .tile .act[data-open]:hover { background: var(--surface-2); }
.tile .idea-mini-item[data-open]:hover { background: var(--hover); }
.tile [data-open]:active { transform: scale(.98); }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Next-up tile */
.next-hero { border-radius: 12px; padding: 16px; background: var(--surface-2); display: grid; gap: 10px; }
.next-hero h3 { font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: -.015em; line-height: 1.15; }
.next-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.progress { height: 4px; border-radius: 2px; background: var(--hover); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent-grad); border-radius: inherit; transform-origin: left; animation: grow .9s var(--ease) both .2s; }
@keyframes grow { from { transform: scaleX(0); } }
.queue { margin-top: 16px; display: grid; gap: 2px; grid-template-columns: minmax(0, 1fr); }
.queue-item { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-radius: 8px; }
.queue-item .n { width: 20px; color: var(--text-3); font-weight: 500; font-size: 13px; text-align: center; }
.queue-item .t { flex: 1; min-width: 0; }
.countdown { font-size: 46px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.countdown small { font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--text-2); margin-left: 6px; }

/* Board summary tile */
.flow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: auto; }
.flow-col { display: grid; gap: 8px; align-content: end; }
.flow-bar { height: 90px; border-radius: 10px; background: var(--surface-2); position: relative; overflow: hidden; display: flex; align-items: flex-end; }
.flow-bar > i { width: 100%; background: var(--red); opacity: var(--o, 1); border-radius: 10px 10px 0 0; transform-origin: bottom; animation: growY .8s var(--ease) both; animation-delay: calc(var(--i) * 60ms + .15s); }
@keyframes growY { from { transform: scaleY(0); } }
.flow-col b { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.flow-col span { font-size: 12px; color: var(--text-2); }
.board-latest { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

/* Ideas tile */
.idea-mini { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.idea-mini-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.idea-mini-item .t { flex: 1; min-width: 0; font-weight: 500; }
.big-num { font-size: 36px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }

/* Calendar tile */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-day { border-radius: 10px; background: var(--surface-2); padding: 8px 4px; text-align: center; display: grid; gap: 4px; justify-items: center; min-height: 82px; align-content: start; }
.week-day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.week-day small { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.week-day b { font-size: 16px; }
.dots { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
.dot.g { background: var(--green); }
.next-shoot { margin-top: 12px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--green-soft); }
.next-shoot .t { flex: 1; min-width: 0; }

/* Chats tile */
.activity { display: grid; gap: 4px; grid-template-columns: minmax(0, 1fr); }
.act { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border-radius: 10px; margin: 0 -8px; }
.act .b { flex: 1; min-width: 0; }
.act .b p { color: var(--text-2); }
.act.unread .b strong::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 6px; vertical-align: middle; }

/* Perf tile */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { display: grid; gap: 2px; }
.kpi small { color: var(--text-2); font-size: 12px; }
.kpi b { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.delta { font-size: 12px; font-weight: 500; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.sample-flag { margin-left: 8px; }

/* Channel tile */
.channel-row { display: flex; align-items: center; gap: 14px; }
.channel-row .av { --s: 56px; }
.yt-state { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: var(--surface-2); }

/* Team tile */
.team-row { display: flex; gap: 18px; flex-wrap: wrap; }
.team-member { display: grid; justify-items: center; gap: 6px; text-align: center; min-width: 72px; }
.team-member .av { --s: 52px; }
.team-member small { color: var(--text-2); }

/* ==========================================================================
   Layers (Unterseiten im Vordergrund)
   ========================================================================== */
.layer { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }
.layer-backdrop {
  position: absolute; inset: 0; background: var(--backdrop);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
}
.sheet {
  position: relative; display: flex; flex-direction: column;
  width: min(1240px, calc(100vw - 48px)); height: calc(100dvh - 48px);
  background: var(--bg); border-radius: 20px; box-shadow: var(--shadow-lg); overflow: hidden;
  transition: transform .45s var(--ease), filter .45s var(--ease);
}
:root[data-theme="light"] .sheet { background: var(--surface); }
.sheet.md { width: min(820px, calc(100vw - 48px)); height: min(860px, calc(100dvh - 48px)); }
.sheet.sm { width: min(560px, calc(100vw - 48px)); height: auto; max-height: calc(100dvh - 48px); }
.layer.covered .sheet { transform: scale(.965) translateY(-6px); }
.sheet-head {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px 12px 20px; min-height: 64px; flex: none;
  border-bottom: 1px solid var(--line);
}
.sheet-head h2 { font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: -.015em; flex: 1; min-width: 0; }
.sheet-head .actions { display: flex; align-items: center; gap: 8px; }
.sheet-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.sheet-pad { padding: 20px 24px 32px; }
.sheet-inner { animation: fadeIn .35s var(--ease) both .08s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Dialogs ---------- */
.dlg-wrap { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; }
.dlg-bg { position: absolute; inset: 0; background: var(--backdrop); }
.dlg {
  position: relative; width: min(440px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 20px;
}
:root[data-theme="dark"] .dlg { background: var(--surface); }
.dlg h3 { font-family: var(--display); font-size: 21px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 14px; padding-right: 32px; }
.dlg .x { position: absolute; top: 12px; right: 12px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.stack { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.dlg-content { min-width: 0; }
.invite-code {
  font-family: var(--mono); font-size: 26px; font-weight: 500; letter-spacing: .08em; text-align: center;
  padding: 18px 12px; border-radius: 14px; border: 2px dashed var(--line); background: var(--surface-2);
  user-select: all; overflow-wrap: anywhere;
}
.invite-meta { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.invite-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.invite-link { font-family: var(--mono); font-size: 11px; color: var(--text-3); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; left: 24px; bottom: 24px; z-index: 100; display: grid; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 420px;
  padding: 12px 14px 12px 16px; border-radius: 10px; background: #0F172A; color: #F1F4FA;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25); animation: toastIn .4s var(--ease) both;
}
:root[data-theme="dark"] .toast { background: #F1F4FA; color: #0F172A; }
.toast.out { animation: toastOut .25s ease-in both; }
.toast .av { --s: 28px; }
.toast button { color: #A5B4FC; font-weight: 500; }
:root[data-theme="dark"] .toast button { color: var(--blue); filter: brightness(.8); }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ==========================================================================
   Auth
   ========================================================================== */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; position: relative; overflow: hidden; }
.auth::before {
  content: ""; position: absolute; width: 900px; height: 900px; border-radius: 50%; top: -520px; left: 50%; translate: -50% 0;
  background: var(--glow);
  pointer-events: none;
}
.auth-card {
  position: relative; width: min(400px, 100%); background: var(--surface); border-radius: 20px;
  box-shadow: var(--shadow-hover); padding: 28px; animation: rise .6s var(--ease) both;
}
.auth-card .logo { margin-bottom: 20px; }
.auth-card h1 { font-family: var(--display); font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 4px; }
.auth-card .seg { width: 100%; margin: 20px 0; }
.auth-card .seg button { flex: 1; }
.auth-foot { margin-top: 16px; text-align: center; font-size: 13px; }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--text-2); font-size: 13px; }
.notice.green { background: var(--green-soft); color: var(--text); }
.empty-state { text-align: center; padding: 64px 16px; color: var(--text-2); display: grid; gap: 8px; justify-items: center; }
.empty-state .icon { width: 40px; height: 40px; color: var(--text-3); }

/* ==========================================================================
   Produktion (Board)
   ========================================================================== */
.board-wrap { height: 100%; display: flex; flex-direction: column; }
.board-tools { display: flex; align-items: center; gap: 10px; padding: 14px 24px 6px; flex-wrap: wrap; }
.board-tools .spacer { flex: 1; }
.board {
  flex: 1; min-height: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(176px, 1fr);
  gap: 12px; padding: 10px 24px 24px; overflow-x: auto; overscroll-behavior-x: contain;
}
.col { display: flex; flex-direction: column; min-height: 0; border-radius: 14px; background: var(--surface-2); transition: background-color .2s, box-shadow .2s; }
:root[data-theme="dark"] .col { background: var(--surface); }
.col.drop { box-shadow: inset 0 0 0 2px var(--accent); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px 14px; }
.col-head h3 { font-size: 14px; font-weight: 500; }
.col-head .count { color: var(--text-3); font-size: 13px; }
.col-head .icon-btn { margin-left: auto; }
.col-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.col-list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.pcard {
  display: grid; gap: 8px; padding: 12px; border-radius: 12px; background: var(--surface); text-align: left; cursor: grab;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 0 0 1px var(--line);
  transition: box-shadow .2s var(--ease), transform .2s var(--ease), opacity .2s;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
}
:root[data-theme="dark"] .pcard { background: var(--surface-2); box-shadow: none; }
.pcard:hover { box-shadow: 0 4px 14px rgba(0, 0, 0, .1), 0 0 0 1px var(--line); }
.pcard h4 { font-size: 14px; font-weight: 600; line-height: 1.3; }
.pcard-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--text-2); font-size: 12px; }
.pcard-meta .grow { flex: 1; }
.pcard-meta .stat { display: inline-flex; align-items: center; gap: 3px; }
.pcard-meta .stat.unread { color: var(--accent); font-weight: 700; }
.pcard .progress { height: 3px; }
.pcard.placeholder { opacity: .35; box-shadow: inset 0 0 0 2px var(--text-3); }
.pcard.ghost {
  position: fixed; z-index: 200; pointer-events: none; margin: 0; cursor: grabbing;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .28); transition: none;
  animation: lift .2s var(--ease-out) forwards;
}
@keyframes lift { to { transform: rotate(-2deg) scale(1.03); } }
body.dragging, body.dragging * { cursor: grabbing !important; user-select: none !important; }
.col-more { margin: 4px auto 0; }

/* ==========================================================================
   Projekt-Detail + Chat
   ========================================================================== */
.project { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, 1fr); height: 100%; }
.project-main { overflow-y: auto; padding: 20px 28px 40px; overscroll-behavior: contain; }
.project-chat { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
:root[data-theme="light"] .project-chat { background: var(--bg); }
.ptitle { font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; width: 100%; padding: 4px 0; }
.stages { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 18px 0 6px; }
.stage-btn { display: grid; gap: 6px; text-align: left; padding: 0; font-size: 12px; color: var(--text-3); font-weight: 500; }
.stage-btn i { height: 6px; border-radius: 3px; background: var(--surface-2); transition: background-color .3s var(--ease); }
:root[data-theme="dark"] .stage-btn i { background: var(--hover); }
.stage-btn.done i { background: color-mix(in srgb, var(--c) 55%, var(--surface-2)); }
.stage-btn.current { color: var(--text); }
.stage-btn.current i { background: var(--c); box-shadow: 0 4px 12px -4px var(--c); }
.stage-btn:hover { color: var(--text); }
.stage-actions { display: flex; gap: 8px; margin: 14px 0 6px; flex-wrap: wrap; }
.props { display: grid; grid-template-columns: 140px 1fr; gap: 4px 12px; margin: 22px 0; align-items: center; }
.props > .k { color: var(--text-2); font-size: 13px; display: flex; align-items: center; gap: 8px; min-height: 40px; }
.props > .v { min-width: 0; }
.props .input, .props .select { min-height: 36px; padding: 6px 10px; border-color: transparent; background: transparent; }
.props .input:hover, .props .select:hover { background: var(--surface-2); border-color: transparent; }
.props .input:focus, .props .select:focus { background: var(--surface); border-color: var(--blue); }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.section-head h3 { font-size: 15px; font-weight: 500; }
.section-head .spacer { flex: 1; }
.check-list { display: grid; gap: 2px; }
.check { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; margin: 0 -8px; }
.check:hover { background: var(--surface-2); }
.check input[type=checkbox] { appearance: none; width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--text-3); display: grid; place-items: center; flex: none; cursor: pointer; transition: background-color .2s var(--ease), border-color .2s; }
.check input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
.check input[type=checkbox]:checked::after { content: ""; width: 10px; height: 6px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); animation: pop .3s var(--ease-out); }
.check .input { flex: 1; min-height: 30px; padding: 4px 0; }
.check.done .input { text-decoration: line-through; color: var(--text-3); }
.check .icon-btn { opacity: 0; transition: opacity .15s; }
.check:hover .icon-btn, .check:focus-within .icon-btn { opacity: 1; }
.links { display: grid; gap: 6px; }
.link-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.link-row a { flex: 1; min-width: 0; }
.add-row { display: flex; gap: 8px; margin-top: 8px; }
.meta-foot { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 12px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mobile-tabs { display: none; }

/* Chat */
.chat-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.chat-head h3 { font-size: 15px; font-weight: 500; flex: 1; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 12px 10px 8px; overscroll-behavior: contain; }
.day-sep { text-align: center; margin: 14px 0 8px; font-size: 12px; color: var(--text-3); font-weight: 500; }
.msg { display: flex; gap: 10px; padding: 3px 8px; border-radius: 10px; position: relative; }
.msg.first { margin-top: 10px; }
.msg:hover { background: var(--surface-2); }
:root[data-theme="dark"] .msg:hover { background: var(--surface-2); }
.msg .gutter { width: 32px; flex: none; }
.msg .gutter time { display: none; font-size: 10px; color: var(--text-3); padding-top: 3px; }
.msg:hover .gutter time { display: block; }
.msg-body { flex: 1; min-width: 0; }
.msg-top { display: flex; align-items: baseline; gap: 8px; }
.msg-top strong { font-weight: 500; font-size: 13px; }
.msg-top time { color: var(--text-3); font-size: 11px; }
.msg-text { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.msg-text .mention { color: var(--blue); background: var(--blue-soft); border-radius: 4px; padding: 0 3px; font-weight: 500; }
.msg-text .mention.me { color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.msg.new { animation: msgIn .35s var(--ease) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } }
.msg-tools {
  position: absolute; right: 8px; top: -14px; display: none; gap: 2px; padding: 2px; border-radius: 10px;
  background: var(--surface); box-shadow: 0 2px 8px rgba(0, 0, 0, .15), 0 0 0 1px var(--line);
}
.msg:hover .msg-tools, .msg-tools.open { display: flex; }
.msg-tools button { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 16px; }
.msg-tools button:hover { background: var(--surface-2); }
.reactions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.reaction { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 12px; background: var(--surface-2); font-size: 12px; box-shadow: inset 0 0 0 1px transparent; transition: transform .16s var(--ease-out); }
.reaction.mine { background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--blue); }
.reaction:active { transform: scale(.9); }
.atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.att-img { width: 180px; height: 120px; border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.att-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s var(--ease); }
.att-img:hover img { transform: scale(1.04); }
.att-file { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); color: var(--text); max-width: 260px; }
.att-file:hover { text-decoration: none; background: var(--hover); }
.att-file small { color: var(--text-3); }
.typing { height: 20px; padding: 0 18px; font-size: 12px; color: var(--text-2); }
.typing i { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: currentColor; margin-right: 2px; animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; margin-right: 6px; }
@keyframes blink { 50% { opacity: .2; } }
.composer { padding: 8px 12px 14px; position: relative; }
.composer-box { border-radius: 14px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); transition: box-shadow .2s; }
.composer-box:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.composer textarea { width: 100%; border: 0; background: transparent; resize: none; padding: 12px 14px 4px; max-height: 180px; outline: none; line-height: 1.45; display: block; }
.composer-row { display: flex; align-items: center; gap: 2px; padding: 4px 6px 6px; }
.composer-row .spacer { flex: 1; }
.send-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; transition: transform .16s var(--ease-out), opacity .2s; }
.send-btn:disabled { opacity: .3; }
.send-btn:active { transform: scale(.9); }
.pending-atts { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 10px 0; }
.pending-att { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border-radius: 8px; background: var(--surface-2); font-size: 12px; max-width: 200px; }
.pending-att.uploading { opacity: .6; }
.mention-pop {
  position: absolute; left: 12px; bottom: calc(100% - 4px); min-width: 220px; padding: 6px; border-radius: 12px;
  background: var(--surface); box-shadow: 0 8px 30px rgba(0, 0, 0, .18), 0 0 0 1px var(--line); z-index: 5;
  animation: fadeIn .2s var(--ease) both;
}
:root[data-theme="dark"] .mention-pop { background: var(--surface-2); }
.mention-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border-radius: 8px; text-align: left; }
.mention-pop button.on, .mention-pop button:hover { background: var(--surface-2); }
.chat-drop { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 80%, transparent); border: 2px dashed var(--text-3); border-radius: 12px; font-weight: 500; z-index: 4; pointer-events: none; }
.chat-empty { text-align: center; color: var(--text-3); padding: 48px 16px; display: grid; gap: 6px; justify-items: center; }
.edit-box { margin-top: 4px; }
.edit-box .textarea { min-height: 60px; }

/* Chat-Übersicht: Liste links, Chat rechts */
.chats { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: 100%; }
.chat-list { overflow-y: auto; padding: 10px 8px 20px; border-right: 1px solid var(--line); overscroll-behavior: contain; }
.chat-list-label { padding: 16px 10px 6px; }
.chat-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border-radius: 12px; text-align: left; transition: background-color .15s, transform .16s var(--ease-out); }
.chat-item:hover { background: var(--surface-2); }
.chat-item:active { transform: scale(.98); }
.chat-item.on { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.chat-item .b { flex: 1; min-width: 0; display: grid; }
.chat-item .b > span { color: var(--text-2); font-size: 13px; }
.chat-item.unread strong { font-weight: 700; }
.chat-item .m { display: grid; justify-items: end; gap: 4px; color: var(--text-3); font-size: 11px; }
.chat-pane { display: flex; flex-direction: column; min-height: 0; }
.chat-pane .project-chat { flex: 1; border-left: 0; }
.chat-pane-bar { display: flex; align-items: center; gap: 8px; min-height: 53px; padding: 8px 12px 8px 18px; border-bottom: 1px solid var(--line); }
.chat-pane .chat-head { display: none; }
.chat-pane-bar .spacer { flex: 1; }
.m-only { display: none; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(0, 0, 0, .85); display: grid; place-items: center; padding: 24px; animation: fadeIn .2s ease both; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; animation: zoomIn .35s var(--ease) both; }
@keyframes zoomIn { from { transform: scale(.92); opacity: 0; } }

/* ==========================================================================
   Kalender
   ========================================================================== */
.cal-wrap { padding: 16px 24px 28px; }
.cal-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-tools h3 { font-family: var(--display); font-size: 24px; font-weight: 700; letter-spacing: -.015em; min-width: 170px; }
.cal-tools .spacer { flex: 1; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); background: var(--line); gap: 1px; user-select: none; }
.cal-dow { background: var(--surface); padding: 8px 10px; font-size: 12px; color: var(--text-2); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
:root[data-theme="dark"] .cal-dow, :root[data-theme="dark"] .cal-day { background: var(--surface); }
.cal-day { background: var(--surface); min-height: 112px; padding: 6px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; position: relative; transition: background-color .15s; }
.cal-day:hover { background: var(--surface-2); }
.cal-day.other { opacity: .45; }
.cal-day.past .num { color: var(--text-3); }
.cal-day .num { font-size: 13px; font-weight: 500; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; }
.cal-day.today .num { background: var(--accent); color: var(--accent-ink); }
.cal-day.mine-away { background: repeating-linear-gradient(-45deg, var(--surface), var(--surface) 6px, var(--surface-2) 6px, var(--surface-2) 12px); }
.cal-day.weekend:not(.mine-away) { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.cal-day.paint-preview { box-shadow: inset 0 0 0 2px var(--red); }
.ev { display: flex; align-items: center; gap: 5px; height: 22px; padding: 0 6px; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; width: 100%; transition: transform .15s var(--ease-out), filter .15s; }
.ev:hover { filter: brightness(.96); }
.ev.block { background: var(--red-soft); color: var(--red); }
.ev.block .av { --s: 16px; font-size: 9px; }
.ev.shoot { background: var(--green); color: #fff; }
.ev.upload { background: var(--surface-2); color: var(--text-2); }
.ev .t { overflow: hidden; text-overflow: ellipsis; }
.ev .v { margin-left: auto; opacity: .9; font-size: 11px; }
.cal-wrap.painting .cal-day { cursor: cell; }
.paint-hint { font-size: 13px; color: var(--red); font-weight: 500; }
.vote-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.vote-btn { height: 44px; border-radius: 12px; background: var(--surface-2); font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background-color .2s var(--ease), color .2s, transform .16s var(--ease-out); }
.vote-btn:active { transform: scale(.96); }
.vote-btn.on.yes { background: var(--green); color: #fff; }
.vote-btn.on.maybe { background: var(--amber); color: #fff; }
.vote-btn.on.no { background: var(--red); color: #fff; }
.voters { display: grid; gap: 6px; }
.voter { display: flex; align-items: center; gap: 10px; }
.voter .n { flex: 1; }
.day-list { display: grid; gap: 8px; }

/* ==========================================================================
   Team / Profil
   ========================================================================== */
.team { padding: 20px 24px 32px; display: grid; gap: 24px; }
.members { display: grid; gap: 4px; }
.member { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 12px; }
.member:hover { background: var(--surface-2); }
.member .av { --s: 44px; }
.member .info { flex: 1; min-width: 0; }
.member .info small { color: var(--text-2); }
.role-dev { background: var(--accent-grad); color: #fff; }
.invite-list { display: grid; gap: 8px; }
.invite { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); flex-wrap: wrap; }
.invite code { font-family: var(--mono); font-size: 14px; font-weight: 500; letter-spacing: .04em; }
.invite .grow { flex: 1; }
.profile { padding: 24px; display: grid; gap: 24px; }
.avatar-edit { display: flex; align-items: center; gap: 18px; }
.avatar-edit .av { --s: 88px; font-size: 34px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--surface), 0 0 0 2px transparent; transition: box-shadow .2s, transform .16s var(--ease-out); }
.swatch.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.swatch:active { transform: scale(.88); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row .spacer { flex: 1; }
.divider { height: 1px; background: var(--line); }
.switch { width: 44px; height: 26px; border-radius: 13px; background: var(--hover); position: relative; flex: none; transition: background-color .25s var(--ease); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .3s var(--ease); }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }
:root[data-theme="dark"] .switch.on::after { background: #fff; }

/* ==========================================================================
   Responsiv: Desktop zuerst, auf dem Handy Projekte & Chat nach vorn
   ========================================================================== */
@media (max-width: 1100px) {
  .t-next { grid-column: span 6; grid-row: span 1; }
  .t-board { grid-column: span 6; }
  .t-todos, .t-cal, .t-chats, .t-team { grid-column: span 6; }
  .t-fin { grid-column: span 12; }
  .flow { grid-template-columns: repeat(4, 1fr); }
  .project { grid-template-columns: minmax(0, 1fr) minmax(320px, .9fr); }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  .topbar { padding: 0 12px; padding-top: env(safe-area-inset-top); height: calc(var(--topbar) + env(safe-area-inset-top)); }
  .hide-m { display: none !important; }
  .home { padding: 4px 12px 32px; }
  .hello { margin: 8px 4px 16px; }
  .hello h1 { font-size: 24px; }
  .grid { gap: 12px; display: flex; flex-direction: column; }
  .tile { min-height: 0; padding: 16px; }
  .tile:hover { transform: none; }
  /* Reihenfolge: Projekte und Chat zuerst, Analysen ans Ende */
  .t-todos { order: 1; }
  .t-next { order: 2; }
  .t-cal { order: 3; }
  .t-chats { order: 4; }
  .t-board { order: 5; }
  .t-fin { order: 6; }
  .t-team { order: 7; }
  .hello h1 { font-size: 28px; }
  .flow-bar { height: 56px; }

  .layer { place-items: end center; }
  .sheet, .sheet.md, .sheet.sm {
    width: 100vw; height: calc(100dvh - 10px - env(safe-area-inset-top)); max-height: none;
    border-radius: 16px 16px 0 0;
  }
  .sheet-head { padding: 8px 8px 8px 16px; min-height: 56px; }
  .sheet-head h2 { font-size: 18px; }
  .sheet-pad, .team, .cal-wrap, .todos, .fin { padding-left: 14px; padding-right: 14px; }
  .board-tools { padding: 12px 14px 4px; }
  .board { grid-auto-columns: 82vw; padding: 8px 14px 16px; scroll-snap-type: x mandatory; scroll-padding: 14px; }
  .col { scroll-snap-align: start; }

  .project { display: flex; flex-direction: column; }
  .mobile-tabs { display: flex; padding: 8px 14px; gap: 8px; border-bottom: 1px solid var(--line); flex: none; }
  .mobile-tabs .chip { flex: 1; justify-content: center; }
  .project-main, .project-chat { flex: 1; min-height: 0; }
  .project[data-tab="chat"] .project-main, .project[data-tab="details"] .project-chat { display: none; }
  .project-main { padding: 14px 16px 32px; }
  .project-chat { border-left: 0; }
  .chat-head { display: none; }
  .ptitle { font-size: 22px; }

  .stage-btn span { display: none; }
  .stage-btn.current span { display: block; position: absolute; }
  .props { grid-template-columns: 1fr; gap: 0; }
  .props > .k { min-height: 0; margin-top: 10px; }
  .msg-tools { top: auto; bottom: 100%; }

  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; }
  .logo-text { display: none; }
  .tb-right { gap: 4px; }

  .chats { grid-template-columns: 1fr; }
  .chats[data-view="list"] .chat-pane, .chats[data-view="chat"] .chat-list { display: none; }
  .chat-list { border-right: 0; }
  .chat-pane-bar { padding-left: 8px; }
  .m-only { display: inline-grid; }

  .cal-day { min-height: 64px; padding: 4px; }
  .cal-day .ev { height: 6px; padding: 0; font-size: 0; border-radius: 3px; }
  .cal-day .ev * { display: none; }
  .cal-day .ev.launch { background: var(--teal); }
  .cal-dow { padding: 6px 4px; text-align: center; font-size: 11px; }
  .legend { width: 100%; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .bar-row { grid-template-columns: 90px 1fr 48px; }
  #toasts { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
}

/* Bewegung reduzieren: nur noch Überblendungen */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important;
  }
  .tile:hover { transform: none; }
  body.has-layer .home { transform: none; }
}

/* ==========================================================================
   Mitteilungen (Glocke oben rechts)
   ========================================================================== */
.bell .badge { top: auto; right: 3px; bottom: 3px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; box-shadow: 0 0 0 2px var(--bg); }
.bell[aria-expanded="true"] { background: var(--surface-2); }
.notif-panel {
  position: fixed; z-index: 80; width: min(400px, calc(100vw - 16px)); max-height: min(560px, calc(100dvh - 80px));
  display: flex; flex-direction: column; border-radius: 16px; overflow: hidden;
  background: var(--surface); box-shadow: 0 16px 48px rgba(0, 0, 0, .18), 0 0 0 1px var(--line);
}
:root[data-theme="dark"] .notif-panel { background: var(--surface); box-shadow: 0 16px 48px rgba(0, 0, 0, .5), 0 0 0 1px var(--line); }
.notif-head { padding: 14px 16px 10px; font-size: 16px; border-bottom: 1px solid var(--line); }
.notif-body { overflow-y: auto; padding: 6px; overscroll-behavior: contain; }
.notif-group { padding: 10px 10px 4px; font-size: 12px; font-weight: 500; color: var(--text-2); }
.notif { display: flex; align-items: center; gap: 6px; padding: 4px; border-radius: 12px; }
.notif:hover { background: var(--surface-2); }
.notif-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px; text-align: left; border-radius: 10px; }
.notif-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent); }
.notif.urgent .notif-text b { color: var(--red); }
.notif-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.notif-text b { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-text small { color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif .icon-btn { opacity: .6; }
.notif:hover .icon-btn { opacity: 1; }
.notif-empty { display: grid; justify-items: center; gap: 4px; padding: 32px 16px; color: var(--text-2); text-align: center; }
.notif-empty .icon { color: var(--green); }

/* ==========================================================================
   Seiten-Bau HQ – Ergänzungen
   ========================================================================== */
h1, h2, h3, h4 { font-weight: 600; }
.topbar, .topbar { display: flex; justify-content: space-between; }
.topbar { box-shadow: inset 0 -1px 0 var(--line); }
.tb-right .btn.accent { margin-right: 4px; }
.logo { gap: 10px; font-family: var(--display); font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.logo span span, .logo > span:not(.logo-text) { color: var(--accent); }
.logo .logo-text { color: var(--text); }
.logo-mark { width: 34px; height: 34px; border-radius: 0; background: none; object-fit: contain; display: block; }
.boot-logo img { width: 72px; height: 72px; }
.home { position: relative; }
.home::before {
  content: ""; position: absolute; z-index: -1; width: 900px; height: 700px; top: -360px; right: -260px;
  background: var(--glow); pointer-events: none;
}
body { overflow-x: hidden; }
.hello p { font-size: 15px; }
.tile { padding: 20px 22px 22px; }
.tile .label, .label { letter-spacing: .02em; }
.tile-stat { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.next-hero { background: var(--bg); box-shadow: var(--ring); }
.next-hero .muted { margin-top: 2px; }
.next-todo { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); min-width: 0; }
.next-todo b { color: var(--text); font-weight: 600; }
.next-todo .icon { color: var(--accent); }
.queue-item small { margin-left: 4px; }
.kpi b { font-size: 24px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { display: grid; gap: 2px; align-content: start; }
.kpi small { color: var(--text-2); font-size: 12px; }
.delta { font-size: 12px; font-weight: 500; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }

/* Kleine Häkchen-Kreise für To-dos */
.tick {
  width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center;
  box-shadow: inset 0 0 0 2px var(--text-3); transition: box-shadow .2s var(--ease), background-color .2s var(--ease), transform .16s var(--ease-out);
}
.tick:hover { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.tick:active { transform: scale(.86); transition-duration: .08s; }
.tick.on, .ticking .tick { background: var(--accent); box-shadow: none; }
.tick.on::after, .ticking .tick::after {
  content: ""; width: 10px; height: 6px; border: 2px solid var(--accent-ink); border-top: 0; border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px);
}

/* To-dos auf der Startseite */
.todo-mini { display: grid; gap: 2px; grid-template-columns: minmax(0, 1fr); }
.todo-mini-item { display: flex; align-items: center; gap: 12px; padding: 8px; margin: 0 -8px; border-radius: 12px; }
.tile .todo-mini-item[data-open]:hover { background: var(--surface-2); }
.todo-mini-item .t { flex: 1; min-width: 0; display: grid; }
.todo-mini-item .t small { font-size: 12px; }
.todo-mini-item.ticking .t { text-decoration: line-through; color: var(--text-3); transition: color .2s; }

/* Termine */
.next-event { margin-top: 12px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--c) 10%, var(--surface)); box-shadow: inset 3px 0 0 var(--c); }
.next-event > .icon { color: var(--c); }
.next-event .t { flex: 1; min-width: 0; }

/* Mini-Balken Finanzen auf der Startseite */
.mini-bars, .fin-chart { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin-top: 18px; align-items: end; }
.mb-col, .fc-col { display: grid; gap: 6px; justify-items: center; }
.mb-bars, .fc-bars { height: 70px; width: 100%; display: flex; gap: 3px; align-items: flex-end; justify-content: center; }
.fc-bars { height: 150px; gap: 4px; }
.mb-bars i, .fc-bars i { width: min(16px, 40%); min-height: 2px; border-radius: 5px 5px 2px 2px; transform-origin: bottom; animation: growY .8s var(--ease) both; animation-delay: calc(var(--i) * 50ms + .1s); }
.mb-bars i.in, .fc-bars i.in { background: var(--accent-grad); background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
.mb-bars i.out, .fc-bars i.out { background: var(--hover); }
.mb-col small, .fc-col small { font-size: 11px; color: var(--text-3); text-transform: capitalize; }
.settled .mb-bars i { animation: none; }

/* Neu-Menü */
.quick { display: grid; gap: 8px; }
.quick-item { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; text-align: left; background: var(--surface-2); transition: background-color .15s, transform .16s var(--ease-out); }
.quick-item:hover { background: var(--hover); }
.quick-item:active { transform: scale(.98); transition-duration: .08s; }
.quick-item b { display: block; font-weight: 600; }
.quick-item small { color: var(--text-2); }

/* Auswahl: Personen und Terminarten */
.who-pick, .kind-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.who, .kind {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 6px; border-radius: 100px;
  background: var(--surface-2); font-weight: 500; transition: background-color .15s, box-shadow .15s, transform .16s var(--ease-out);
}
.kind { padding: 0 12px; }
.who:active, .kind:active { transform: scale(.96); transition-duration: .08s; }
.who:hover, .kind:hover { background: var(--hover); }
.who.on { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent); }
.kind .icon { color: var(--c); }
.kind.on { background: color-mix(in srgb, var(--c) 14%, transparent); box-shadow: inset 0 0 0 1.5px var(--c); color: var(--c); }
.av.unassigned { background: transparent; color: var(--text-3); box-shadow: inset 0 0 0 1.5px var(--text-3); box-shadow: inset 0 0 0 1.5px var(--line), inset 0 0 0 1.5px var(--text-3); font-size: 12px; }

/* To-do-Seite */
.todos { padding: 18px 24px 32px; }
.todo-compose { display: flex; gap: 10px; align-items: center; padding: 4px 6px 4px 16px; border-radius: 16px; background: var(--surface-2); margin-bottom: 16px; transition: box-shadow .2s; color: var(--text-3); }
.todo-compose:focus-within { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); }
.todo-compose input { flex: 1; border: 0; background: transparent; height: 46px; font-size: 15px; outline: none; color: var(--text); }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.todo-group { margin-bottom: 18px; display: grid; gap: 2px; grid-template-columns: minmax(0, 1fr); }
.todo-group h4 { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; display: flex; gap: 8px; align-items: center; padding: 6px 2px; }
.todo-group h4 .count { color: var(--text-3); font-weight: 500; }
.todo-group.overdue h4 { color: var(--red); }
.todo { display: flex; align-items: center; gap: 12px; padding: 4px 10px; margin: 0 -10px; border-radius: 12px; transition: background-color .15s; }
.todo:hover { background: var(--surface-2); }
.todo-main { flex: 1; min-width: 0; display: grid; gap: 2px; text-align: left; padding: 8px 0; }
.todo-title { font-weight: 500; overflow-wrap: anywhere; }
.todo.done .todo-title { text-decoration: line-through; color: var(--text-3); }
.todo-sub { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12px; min-width: 0; }
.todo-proj { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 500; white-space: nowrap; border-radius: 6px; }
.todo-proj:hover { text-decoration: underline; }
.todo-meta { display: flex; align-items: center; gap: 8px; flex: none; }
.todo-list { display: grid; gap: 0; grid-template-columns: minmax(0, 1fr); }
.show-done { justify-self: start; margin: 4px 0; }

/* Projektansicht */
.v-link { display: flex; align-items: center; gap: 4px; }
.stage-btn i { height: 6px; }
.stage-btn.current { color: var(--c); }
.ev-list { display: grid; gap: 6px; }
.ev-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 12px; text-align: left; background: var(--surface-2); box-shadow: inset 3px 0 0 var(--c); transition: background-color .15s, transform .16s var(--ease-out); }
.ev-row:hover { background: var(--hover); }
.ev-row:active { transform: scale(.985); }
.ev-row > .icon { color: var(--c); }
.ev-row .t { flex: 1; min-width: 0; display: grid; }
.ev-row .t b { font-weight: 600; }
.progress.money { height: 6px; }
.progress.money > i { background: var(--green); }

/* Rechnungen und Kosten */
.inv-list { display: grid; gap: 6px; grid-template-columns: minmax(0, 1fr); }
.inv, .cost { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface); box-shadow: var(--ring); cursor: pointer; transition: box-shadow .2s var(--ease), transform .16s var(--ease-out); }
.inv:hover, .cost:hover { box-shadow: inset 0 0 0 1px var(--text-3); }
.inv:active, .cost:active { transform: scale(.99); }
.inv-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--text-3); }
.inv.open .inv-dot { background: var(--accent); }
.inv.overdue .inv-dot { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.inv.paid .inv-dot { background: var(--green); }
.inv.planned { background: transparent; box-shadow: inset 0 0 0 1px var(--line); border: 0; outline: 1px dashed var(--line); outline-offset: -1px; }
.inv-main { flex: 1; min-width: 0; display: grid; }
.inv-main b { font-weight: 600; }
.inv-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inv.paid .inv-amount { color: var(--text-2); }
.inv-spacer { width: 0; }
.ended .cost { opacity: .55; }
.fin { padding: 20px 24px 32px; display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.fin-kpis { gap: 12px; }
.fin-kpis .card { padding: 16px 18px; }
.card { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3 { font-size: 15px; font-weight: 600; flex: 1; }
.fin-chart { margin-top: 4px; }
.fin-sum { display: flex; justify-content: space-between; padding: 12px 14px 0; color: var(--text-2); }
.fin-sum b { color: var(--text); font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 80px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .tr { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar-row .tr i { display: block; height: 100%; background: var(--accent-grad); border-radius: 4px; transform-origin: left; animation: grow .8s var(--ease) both; }
.cat-card { margin-bottom: 18px; }
.cat-card .card-head b { font-size: 18px; font-weight: 800; }

/* Kalender-Einträge in Farbe der Terminart */
.ev { background: color-mix(in srgb, var(--c, var(--accent)) 14%, transparent); color: var(--c, var(--accent)); }
:root[data-theme="dark"] .ev { background: color-mix(in srgb, var(--c, var(--accent)) 22%, transparent); }
.ev.shooting, .ev.termin { background: var(--c); color: #fff; }
.ev.abwesend { background: var(--surface-2); color: var(--text-2); }
.ev.abwesend .av { --s: 16px; font-size: 9px; }
.ev.launch { --c: var(--teal); }
.ev .icon { width: 13px; height: 13px; flex: none; }
.cal-day .num { margin-bottom: 1px; }
.mine-away .num::after { content: ""; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .topbar { display: flex; }
  .logo-text { display: inline; font-size: 17px; }
  .home::before { right: -300px; width: 600px; }
  .fin-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inv, .cost { flex-wrap: wrap; }
  .inv-main { flex-basis: calc(100% - 60px); }
  .inv-amount { margin-left: 22px; }
  .inv .btn { margin-left: auto; }
  .todo-meta .pill { display: none; }
  .todo .todo-meta .pill.red, .todo .todo-meta .pill.amber { display: inline-flex; }
  .bar-row { grid-template-columns: 90px 1fr 64px; }
  .cal-day .ev { background: var(--c, var(--accent)); }
  .cal-day .ev.abwesend { background: var(--text-3); }
  .who-pick .who { height: 34px; }
}
@media (max-width: 420px) {
  .logo-text { display: none; }
}
.sheet:focus, .sheet:focus-visible, .dlg:focus, .dlg:focus-visible { outline: none; }
.col-dot { flex: none; }
.logo span span, .logo > span:not(.logo-text) { margin-left: .28em; }
.inv.planned { box-shadow: none; outline: 1px dashed var(--text-3); outline-offset: -1px; opacity: .9; }
/* Die Leuchtfläche darf die Seite nie breiter machen (sonst verrutschen auf dem Handy die Ebenen) */
html, body { overflow-x: clip; }
.home { overflow-x: clip; }
