/* NuT-Werkstatt – Design-System
   Keine externen Schriften/CDNs (Datenschutz): System-Schriften. */

:root {
  --bg: #f5f3ee;
  --bg-elev: #ffffff;
  --bg-sunken: #ece9e1;
  --line: #e2ddd2;
  --line-strong: #cfc8b9;
  --text: #1d2321;
  --text-2: #4c5652;
  --text-3: #7a837f;
  --primary: #1f6f63;
  --primary-2: #175a50;
  --primary-soft: #dcefe9;
  --on-primary: #ffffff;
  --accent: #f0a23b;
  --accent-soft: #fdf0dc;
  --danger: #c2412d;
  --danger-soft: #fbe5e0;
  --ok: #2e8b57;
  --ok-soft: #e0f3e7;
  --info: #3466b0;
  --info-soft: #e3ecf9;
  --g7: #3f9a5b; --g7-soft: #e2f3e6;
  --g8: #3a72c4; --g8-soft: #e3ecfa;
  --g9: #d0772a; --g9-soft: #fcebdc;
  --g10: #8656c4; --g10-soft: #efe6fa;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(30, 35, 33, .06), 0 4px 16px rgba(30, 35, 33, .06);
  --shadow-lg: 0 12px 40px rgba(30, 35, 33, .18);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Noto Color Emoji";
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sidebar: 264px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131716; --bg-elev: #1b201f; --bg-sunken: #0f1211; --line: #2a302e; --line-strong: #3a423f;
    --text: #e8ecea; --text-2: #b4bdb9; --text-3: #85908b;
    --primary: #4cb8a4; --primary-2: #66c9b6; --primary-soft: #183a34; --on-primary: #0b1f1b;
    --accent: #f3b25b; --accent-soft: #3a2c17; --danger: #ef7a66; --danger-soft: #3b1e19;
    --ok: #5cc48a; --ok-soft: #173325; --info: #7aa6ea; --info-soft: #1a2840;
    --g7: #6cc487; --g7-soft: #1b3324; --g8: #7aa6ea; --g8-soft: #1a2840;
    --g9: #eb9b57; --g9-soft: #3a2616; --g10: #b490e6; --g10-soft: #2b2140;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131716; --bg-elev: #1b201f; --bg-sunken: #0f1211; --line: #2a302e; --line-strong: #3a423f;
  --text: #e8ecea; --text-2: #b4bdb9; --text-3: #85908b;
  --primary: #4cb8a4; --primary-2: #66c9b6; --primary-soft: #183a34; --on-primary: #0b1f1b;
  --accent: #f3b25b; --accent-soft: #3a2c17; --danger: #ef7a66; --danger-soft: #3b1e19;
  --ok: #5cc48a; --ok-soft: #173325; --info: #7aa6ea; --info-soft: #1a2840;
  --g7: #6cc487; --g7-soft: #1b3324; --g8: #7aa6ea; --g8-soft: #1a2840;
  --g9: #eb9b57; --g9-soft: #3a2616; --g10: #b490e6; --g10-soft: #2b2140;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--text-3); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.spacer { flex: 1; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

/* ---------- Shell ---------- */
.app { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) 1fr; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  background: var(--bg-elev); border-right: 1px solid var(--line); padding: 1rem .75rem;
}
.brand { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem 1rem; font-weight: 750; font-size: 1.08rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--primary), #2a9d8a); color: #fff; box-shadow: 0 4px 12px rgba(31,111,99,.35);
}
.brand-logo svg { width: 24px; height: 24px; }
.brand small { display: block; font-weight: 500; font-size: .72rem; color: var(--text-3); letter-spacing: .02em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); padding: 1rem .75rem .35rem; font-weight: 650; }
.nav a {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: 10px;
  color: var(--text-2); font-weight: 550; position: relative;
}
.nav a:hover { background: var(--bg-sunken); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav a .ico { width: 22px; text-align: center; font-size: 1.05rem; }
.nav a .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: .6rem; padding: .5rem; border-radius: 10px; color: var(--text); }
.me:hover { background: var(--bg-sunken); text-decoration: none; }
.me-name { font-weight: 650; line-height: 1.2; }
.me-role { font-size: .78rem; color: var(--text-3); }

.main { min-width: 0; padding: 1.75rem clamp(1rem, 3vw, 2.5rem) 4rem; max-width: 1180px; width: 100%; }
.topbar { display: none; }
.bottomnav { display: none; }

.page-head { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--text-3); margin-top: .2rem; }
.page-head .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.crumbs { font-size: .85rem; color: var(--text-3); margin-bottom: .4rem; display: flex; gap: .35rem; flex-wrap: wrap; }
.crumbs a { color: var(--text-3); }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: min(300px, 86vw);
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg);
  }
  .app.drawer-open .sidebar { transform: none; }
  .app.drawer-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 50; }
  .topbar {
    display: flex; align-items: center; gap: .5rem; position: sticky; top: 0; z-index: 40;
    background: color-mix(in srgb, var(--bg-elev) 92%, transparent); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line); padding: .55rem .75rem;
  }
  .topbar .brand { padding: 0; font-size: 1rem; }
  .topbar .brand-logo { width: 32px; height: 32px; border-radius: 9px; }
  .main { padding: 1rem 1rem 6rem; }
  .bottomnav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
    background: var(--bg-elev); border-top: 1px solid var(--line); padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom));
  }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: .68rem; color: var(--text-3); padding: .25rem 0; position: relative; font-weight: 600; }
  .bottomnav a .ico { font-size: 1.25rem; line-height: 1.2; }
  .bottomnav a.active { color: var(--primary); }
  .bottomnav a:hover { text-decoration: none; }
  .bottomnav .badge { position: absolute; top: 0; left: calc(50% + 6px); }
  h1 { font-size: 1.35rem; }
}

/* ---------- Komponenten ---------- */
.card {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem 1.2rem;
}
.card.flat { box-shadow: none; }
.card-title { display: flex; align-items: center; gap: .5rem; font-weight: 700; margin-bottom: .75rem; font-size: 1rem; }
.card-title .spacer { flex: 1; }
.card-link { display: block; color: inherit; transition: transform .12s ease, box-shadow .12s ease, border-color .12s; }
.card-link:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(30,35,33,.1); border-color: var(--line-strong); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 1px solid transparent;
  background: var(--primary); color: var(--on-primary); font: inherit; font-weight: 650; font-size: .92rem;
  padding: .55rem 1rem; border-radius: 10px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, transform .05s;
}
.btn:hover { background: var(--primary-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: var(--bg-elev); color: var(--text); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--bg-sunken); }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg-sunken); color: var(--text); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(.95); }
.btn.accent { background: var(--accent); color: #2b1d05; }
.btn.small { padding: .32rem .65rem; font-size: .82rem; border-radius: 8px; }
.btn.icon { padding: .45rem; width: 38px; height: 38px; }
.btn.block { width: 100%; }

.badge {
  display: inline-flex; align-items: center; gap: .25rem; font-size: .72rem; font-weight: 700; line-height: 1;
  padding: .28rem .5rem; border-radius: 999px; background: var(--bg-sunken); color: var(--text-2); white-space: nowrap;
}
.badge.count { background: var(--danger); color: #fff; min-width: 1.35rem; justify-content: center; padding: .22rem .4rem; }
.badge.required { background: var(--danger-soft); color: var(--danger); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--accent-soft); color: color-mix(in srgb, var(--accent) 70%, #5a3a00); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.primary { background: var(--primary-soft); color: var(--primary); }
.badge.g7 { background: var(--g7-soft); color: var(--g7); }
.badge.g8 { background: var(--g8-soft); color: var(--g8); }
.badge.g9 { background: var(--g9-soft); color: var(--g9); }
.badge.g10 { background: var(--g10-soft); color: var(--g10); }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  color: #fff; font-weight: 700; font-size: .85rem; letter-spacing: .02em; user-select: none;
}
.avatar.sm { width: 28px; height: 28px; font-size: .72rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.2rem; }

.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line-strong); background: var(--bg-elev); color: var(--text-2); font: inherit; font-size: .85rem;
  font-weight: 600; padding: .35rem .8rem; border-radius: 999px; cursor: pointer;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip.static { cursor: default; font-weight: 500; font-size: .8rem; padding: .25rem .65rem; background: var(--bg-sunken); border-color: transparent; }
.chip.static:hover { color: var(--text-2); }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.1rem; overflow-x: auto; scrollbar-width: none; }
.tabs button {
  background: none; border: 0; font: inherit; font-weight: 650; color: var(--text-3); padding: .65rem .9rem;
  border-bottom: 2.5px solid transparent; cursor: pointer; white-space: nowrap; display: flex; gap: .4rem; align-items: center;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Formulare */
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; }
.field > label, .label { font-weight: 650; font-size: .88rem; }
.field .hint { font-size: .8rem; color: var(--text-3); }
input[type=text], input[type=password], input[type=search], input[type=date], input[type=datetime-local], input[type=number], select, textarea {
  font: inherit; color: var(--text); background: var(--bg-elev); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: .6rem .75rem; width: 100%; transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.check { display: flex; gap: .55rem; align-items: flex-start; cursor: pointer; font-size: .92rem; margin-bottom: .55rem; }
.check input { width: 18px; height: 18px; margin: .15rem 0 0; accent-color: var(--primary); flex: none; }
.check small { display: block; color: var(--text-3); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 .9rem; }
.error-box { background: var(--danger-soft); color: var(--danger); padding: .6rem .8rem; border-radius: 10px; font-weight: 600; font-size: .9rem; margin-bottom: .9rem; }
.segmented { display: inline-flex; background: var(--bg-sunken); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; font: inherit; font-weight: 650; font-size: .86rem; color: var(--text-2); padding: .42rem .8rem; border-radius: 8px; cursor: pointer; }
.segmented button.active { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow); }

/* Leere Zustände */
.empty { text-align: center; padding: 2.25rem 1rem; color: var(--text-3); }
.empty .big { font-size: 2.4rem; margin-bottom: .3rem; }
.empty strong { display: block; color: var(--text-2); font-size: 1rem; margin-bottom: .2rem; }

/* Liste */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: .85rem; align-items: center; padding: .8rem .2rem; border-bottom: 1px solid var(--line); color: inherit; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { text-decoration: none; background: var(--bg-sunken); border-radius: 10px; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
.list-item .li-meta { font-size: .82rem; color: var(--text-3); display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.li-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 1.25rem; background: var(--bg-sunken); flex: none; }

/* Fortschritt */
.progress { height: 8px; background: var(--bg-sunken); border-radius: 99px; overflow: hidden; min-width: 80px; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 99px; transition: width .3s; }
.progress.warn > span { background: var(--accent); }

/* ---------- Toast & Modal ---------- */
.toasts { position: fixed; z-index: 200; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; max-width: min(380px, calc(100vw - 2rem)); }
.toast { background: var(--text); color: var(--bg); padding: .7rem 1rem; border-radius: 11px; box-shadow: var(--shadow-lg); font-weight: 550; animation: pop .2s ease; cursor: pointer; }
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@media (max-width: 860px) { .toasts { bottom: 5rem; left: 1rem; right: 1rem; max-width: none; } }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 20, 18, .5); z-index: 100; display: grid; place-items: center; padding: 1rem; animation: fade .15s; overflow-y: auto; }
.modal { background: var(--bg-elev); border-radius: 18px; box-shadow: var(--shadow-lg); width: min(640px, 100%); max-height: calc(100vh - 2rem); overflow-y: auto; animation: pop .2s ease; }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.3rem .4rem; position: sticky; top: 0; background: var(--bg-elev); z-index: 1; }
.modal-head h2 { margin: 0; flex: 1; }
.modal-body { padding: .6rem 1.3rem 1.3rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: .9rem 1.3rem 1.2rem; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--bg-elev); }
@keyframes fade { from { opacity: 0; } }
@media (max-width: 600px) {
  .modal-backdrop { padding: 0; place-items: end stretch; }
  .modal { border-radius: 18px 18px 0 0; max-height: 94vh; }
}

.lightbox { position: fixed; inset: 0; z-index: 150; background: rgba(0,0,0,.9); display: grid; place-items: center; padding: 1rem; cursor: zoom-out; }
.lightbox img, .lightbox video { max-height: 92vh; max-width: 96vw; border-radius: 8px; cursor: default; }
.lightbox .close { position: absolute; top: 1rem; right: 1rem; color: #fff; background: rgba(255,255,255,.15); }

/* ---------- Anhänge ---------- */
.attachments { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; margin: .75rem 0; }
.attachments.compact { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.att-media { position: relative; border-radius: 10px; overflow: hidden; background: var(--bg-sunken); aspect-ratio: 4 / 3; cursor: zoom-in; border: 1px solid var(--line); }
.att-media img, .att-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-media .play { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2rem; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.5); pointer-events: none; }
.att-file { display: flex; gap: .55rem; align-items: center; padding: .55rem .7rem; border-radius: 10px; background: var(--bg-sunken); color: var(--text); border: 1px solid var(--line); min-width: 0; grid-column: span 2; }
.att-file:hover { text-decoration: none; border-color: var(--line-strong); }
.att-file .fi { font-size: 1.4rem; }
.att-file .fn { font-weight: 600; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-file .fs { font-size: .75rem; color: var(--text-3); }

.picker { border: 2px dashed var(--line-strong); border-radius: 12px; padding: .9rem; text-align: center; color: var(--text-3); cursor: pointer; transition: border-color .12s, background .12s; }
.picker:hover, .picker.drag { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.picker-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .5rem; margin-top: .6rem; }
.picker-item { position: relative; border-radius: 9px; overflow: hidden; background: var(--bg-sunken); aspect-ratio: 1; display: grid; place-items: center; font-size: .72rem; text-align: center; padding: .3rem; border: 1px solid var(--line); }
.picker-item img, .picker-item video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.picker-item .rm { position: absolute; top: 4px; right: 4px; z-index: 2; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: .8rem; }
.picker-item .bar { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--primary); z-index: 2; transition: width .2s; }
.picker-item .nm { position: relative; z-index: 1; word-break: break-all; color: var(--text-2); }

/* ---------- Rich Text ---------- */
.prose { overflow-wrap: anywhere; }
.prose p:last-child { margin-bottom: 0; }
.prose ul { margin: .25rem 0 .75rem; padding-left: 1.3rem; }
.prose code { font-family: var(--mono); background: var(--bg-sunken); padding: .05rem .3rem; border-radius: 5px; font-size: .9em; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero {
  position: relative; overflow: hidden; color: #fff; padding: 3rem clamp(1.5rem, 4vw, 4rem); display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(circle at 20% 15%, #2fa48f 0, transparent 45%), radial-gradient(circle at 85% 80%, #f0a23b55 0, transparent 40%), linear-gradient(150deg, #134e46, #1f6f63 55%, #23806f);
}
.auth-hero .pattern { position: absolute; inset: 0; opacity: .14; pointer-events: none; }
.auth-hero h1 { font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.08; margin: 0 0 1rem; letter-spacing: -.02em; }
.auth-hero p { font-size: 1.08rem; opacity: .92; max-width: 30rem; }
.auth-hero .brand { color: #fff; padding: 0; }
.auth-hero .brand-logo { background: rgba(255,255,255,.18); box-shadow: none; }
.auth-hero .brand small { color: rgba(255,255,255,.75); }
.auth-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin-top: 2rem; max-width: 34rem; position: relative; }
.auth-features div { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); padding: .7rem .85rem; border-radius: 12px; font-weight: 600; font-size: .92rem; backdrop-filter: blur(4px); }
.auth-form { display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth-form .card { width: min(420px, 100%); padding: 1.75rem; }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 1.5rem 1.25rem 1.75rem; }
  .auth-hero h1 { font-size: 1.7rem; margin-top: 1.25rem; }
  .auth-features { display: none; }
  .auth-form { padding: 1.25rem 1rem 2rem; align-items: start; }
}

/* ---------- Dashboard ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 1.6rem 1.7rem; color: #fff; margin-bottom: 1.25rem;
  background: radial-gradient(circle at 90% 0%, #f0a23b66, transparent 45%), linear-gradient(135deg, #165c52, #1f6f63 60%, #2a8a78);
  box-shadow: 0 10px 30px rgba(31,111,99,.25);
}
.hero h1 { margin: 0 0 .35rem; font-size: 1.6rem; }
.hero p { margin: 0; opacity: .9; }
.hero .pattern { position: absolute; right: -40px; top: -30px; width: 280px; opacity: .15; pointer-events: none; }
.hero-next { margin-top: 1.1rem; display: inline-flex; align-items: center; gap: .9rem; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2); padding: .7rem 1rem; border-radius: 14px; color: #fff; }
.hero-next:hover { text-decoration: none; background: rgba(255,255,255,.2); }
.hero-next .count { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.hero-next .lbl { font-size: .75rem; opacity: .85; text-transform: uppercase; letter-spacing: .06em; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.stat { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.1; }
.stat span { font-size: .82rem; color: var(--text-3); font-weight: 600; }
.dash { display: grid; grid-template-columns: 1.35fr 1fr; gap: 1.1rem; align-items: start; }
@media (max-width: 1000px) { .dash { grid-template-columns: 1fr; } }

.todo { display: flex; gap: .8rem; align-items: center; padding: .75rem .85rem; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-elev); color: inherit; margin-bottom: .5rem; }
.todo:hover { text-decoration: none; border-color: var(--line-strong); background: var(--bg-sunken); }
.todo.required { border-left: 4px solid var(--danger); }
.todo.task { border-left: 4px solid var(--accent); }
.todo .t-title { font-weight: 650; }
.todo .t-meta { font-size: .8rem; color: var(--text-3); }

/* ---------- Beiträge ---------- */
.post-card { display: flex; gap: .9rem; padding: 1rem 1.1rem; color: inherit; }
.post-card:hover { text-decoration: none; }
.post-card .pc-main { flex: 1; min-width: 0; }
.post-card .pc-title { font-weight: 700; font-size: 1.02rem; margin-bottom: .15rem; color: var(--text); }
.post-card .pc-excerpt { color: var(--text-2); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card .pc-meta { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; font-size: .8rem; color: var(--text-3); margin-top: .45rem; }
.post-card .pc-thumbs { display: flex; gap: .35rem; margin-top: .55rem; }
.post-card .pc-thumbs img { width: 64px; height: 48px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); }
.type-pill { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; padding: .2rem .5rem; border-radius: 6px; }
.type-question { background: var(--info-soft); color: var(--info); }
.type-result { background: var(--ok-soft); color: var(--ok); }
.type-discussion { background: var(--bg-sunken); color: var(--text-2); }
.type-info { background: var(--accent-soft); color: color-mix(in srgb, var(--accent) 70%, #5a3a00); }
.posts { display: flex; flex-direction: column; gap: .65rem; }

.thread-post .tp-head { display: flex; gap: .75rem; align-items: center; margin-bottom: .9rem; }
.thread-post h1 { font-size: 1.5rem; margin: .4rem 0 .6rem; }
.comment { display: flex; gap: .75rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.comment .c-body { flex: 1; min-width: 0; }
.comment .c-head { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; margin-bottom: .2rem; }
.comment .c-head b { font-weight: 700; }
.comment.answer { background: var(--ok-soft); border-radius: 12px; padding: 1rem; border-top-color: transparent; margin: .25rem 0; }
.comment .c-actions { display: flex; gap: .25rem; margin-top: .35rem; }
.staff-tag { font-size: .68rem; font-weight: 750; color: var(--primary); background: var(--primary-soft); padding: .12rem .4rem; border-radius: 5px; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Themen ---------- */
.strand { margin-bottom: 1.6rem; }
.strand h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin-bottom: .7rem; display: flex; gap: .5rem; align-items: center; }
.topic-card { padding: 1rem 1.05rem; display: flex; flex-direction: column; gap: .5rem; min-height: 150px; position: relative; overflow: hidden; }
.topic-card .tc-icon { font-size: 1.7rem; width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; background: var(--bg-sunken); }
.topic-card .tc-title { font-weight: 700; font-size: 1rem; line-height: 1.3; color: var(--text); }
.topic-card .tc-meta { margin-top: auto; display: flex; gap: .6rem; font-size: .8rem; color: var(--text-3); align-items: center; }
.topic-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--gc, var(--primary)); }
.gc-7 { --gc: var(--g7); } .gc-8 { --gc: var(--g8); } .gc-9 { --gc: var(--g9); } .gc-10 { --gc: var(--g10); }
.gc-7 .tc-icon { background: var(--g7-soft); } .gc-8 .tc-icon { background: var(--g8-soft); } .gc-9 .tc-icon { background: var(--g9-soft); } .gc-10 .tc-icon { background: var(--g10-soft); }

.area-head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.area-icon { font-size: 2.1rem; width: 66px; height: 66px; border-radius: 18px; display: grid; place-items: center; background: var(--bg-sunken); flex: none; }
.subtopics { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .6rem; }

/* Projekttage */
.timeline { position: relative; padding-left: 1.6rem; }
.timeline::before { content: ""; position: absolute; left: .5rem; top: .5rem; bottom: .5rem; width: 2px; background: var(--line-strong); }
.tl-item { position: relative; margin-bottom: 1rem; }
.tl-item::before { content: ""; position: absolute; left: -1.38rem; top: 1.25rem; width: 14px; height: 14px; border-radius: 50%; background: var(--bg-elev); border: 3px solid var(--line-strong); }
.tl-item.next::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.tl-item.past::before { border-color: var(--primary); background: var(--primary); }
.date-box { width: 58px; flex: none; text-align: center; border-radius: 12px; background: var(--bg-sunken); padding: .4rem 0; }
.date-box .d { font-size: 1.45rem; font-weight: 800; line-height: 1.1; }
.date-box .m { font-size: .7rem; text-transform: uppercase; font-weight: 700; color: var(--text-3); letter-spacing: .05em; }

/* ---------- Chat ---------- */
.chat { display: grid; grid-template-columns: 250px 1fr; height: calc(100vh - 3.5rem); background: var(--bg-elev); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.chat-channels { border-right: 1px solid var(--line); overflow-y: auto; padding: .6rem; background: color-mix(in srgb, var(--bg-sunken) 45%, var(--bg-elev)); }
.chat-channels h2 { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); padding: .5rem .55rem; margin: 0; }
.channel { display: flex; gap: .6rem; align-items: center; padding: .55rem .6rem; border-radius: 11px; color: var(--text); }
.channel:hover { background: var(--bg-sunken); text-decoration: none; }
.channel.active { background: var(--primary-soft); }
.channel .ch-ico { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--bg-elev); border: 1px solid var(--line); flex: none; }
.channel .ch-main { min-width: 0; flex: 1; }
.channel .ch-name { font-weight: 650; font-size: .92rem; }
.channel .ch-last { font-size: .76rem; color: var(--text-3); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.chat-head h2 { margin: 0; font-size: 1.05rem; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .15rem; }
.day-sep { align-self: center; font-size: .72rem; font-weight: 700; color: var(--text-3); background: var(--bg-sunken); padding: .2rem .7rem; border-radius: 99px; margin: .8rem 0 .5rem; }
.msg { display: flex; gap: .55rem; align-items: flex-end; max-width: 78%; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg .bubble { background: var(--bg-sunken); padding: .5rem .8rem; border-radius: 16px 16px 16px 5px; position: relative; min-width: 0; }
.msg.mine .bubble { background: var(--primary); color: var(--on-primary); border-radius: 16px 16px 5px 16px; }
.msg.mine .bubble a { color: inherit; text-decoration: underline; }
.msg .who { font-size: .74rem; font-weight: 700; margin-bottom: .1rem; }
.msg .time { font-size: .66rem; opacity: .65; margin-left: .5rem; float: right; margin-top: .35rem; }
.msg.cont { margin-top: -.05rem; }
.msg.cont .avatar { visibility: hidden; }
.msg.cont .who { display: none; }
.msg .attachments { margin: .35rem 0 .1rem; grid-template-columns: repeat(auto-fill, minmax(150px, 220px)); }
.msg .del { opacity: 0; border: 0; background: none; cursor: pointer; color: var(--text-3); font-size: .8rem; align-self: center; }
.msg:hover .del { opacity: 1; }
.msg.first-of-group { margin-top: .55rem; }
.chat-compose { border-top: 1px solid var(--line); padding: .65rem; display: flex; flex-direction: column; gap: .5rem; }
.chat-compose .row { flex-wrap: nowrap; align-items: flex-end; }
.chat-compose textarea { min-height: 44px; max-height: 160px; resize: none; border-radius: 22px; padding: .6rem 1rem; }
.chat-compose .btn.icon { border-radius: 50%; width: 44px; height: 44px; flex: none; }
.chat-compose .picker-list { margin: 0; grid-template-columns: repeat(auto-fill, 72px); }
@media (max-width: 860px) {
  .chat { grid-template-columns: 1fr; height: calc(100dvh - 9.5rem); border-radius: 14px; }
  .chat-channels { display: none; }
  .chat.show-channels .chat-channels { display: block; }
  .chat.show-channels .chat-pane { display: none; }
  .msg { max-width: 90%; }
}

/* Tabellen */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 700; padding: .55rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--bg-sunken); }

/* Umfragen */
.q-block { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.q-block:last-child { border-bottom: 0; }
.q-text { font-weight: 700; margin-bottom: .6rem; }
.q-text .req { color: var(--danger); }
.opt { display: flex; gap: .65rem; align-items: center; padding: .6rem .8rem; border: 1px solid var(--line-strong); border-radius: 11px; margin-bottom: .4rem; cursor: pointer; transition: border-color .1s, background .1s; }
.opt:hover { border-color: var(--primary); }
.opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.opt input { accent-color: var(--primary); width: 18px; height: 18px; margin: 0; }
.scale { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.scale label { cursor: pointer; }
.scale input { position: absolute; opacity: 0; }
.scale span.s { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--line-strong); font-size: 1.45rem; transition: transform .1s, background .1s; }
.scale input:checked + span.s { background: var(--primary-soft); border-color: var(--primary); transform: scale(1.08); }
.scale input:focus-visible + span.s { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); }
.scale .ends { font-size: .78rem; color: var(--text-3); width: 100%; display: flex; justify-content: space-between; max-width: 280px; }
.result-bar { display: grid; grid-template-columns: minmax(0, 1fr) 3rem; gap: .2rem .7rem; align-items: center; margin-bottom: .55rem; font-size: .9rem; }
.result-bar .bar { grid-column: 1 / -1; height: 10px; border-radius: 99px; background: var(--bg-sunken); overflow: hidden; }
.result-bar .bar span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.result-bar .num { text-align: right; font-weight: 700; color: var(--text-2); }
.result-bar .names { grid-column: 1 / -1; font-size: .78rem; color: var(--text-3); margin-top: -.2rem; }
.text-answers { display: flex; flex-direction: column; gap: .4rem; }
.text-answers div { background: var(--bg-sunken); border-radius: 10px; padding: .55rem .75rem; font-size: .9rem; }
.q-builder { border: 1px solid var(--line); border-radius: 12px; padding: .9rem; margin-bottom: .7rem; background: var(--bg); }
.templates { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.templates button { text-align: left; border: 1px solid var(--line-strong); background: var(--bg-elev); border-radius: 12px; padding: .7rem .8rem; cursor: pointer; font: inherit; color: var(--text); }
.templates button:hover { border-color: var(--primary); background: var(--primary-soft); }
.templates b { display: block; font-size: .9rem; }
.templates small { color: var(--text-3); }

.notice { display: flex; gap: .7rem; align-items: flex-start; padding: .8rem 1rem; border-radius: 12px; background: var(--info-soft); color: var(--text); font-size: .9rem; margin-bottom: 1rem; }
.notice.warn { background: var(--accent-soft); }
.notice.ok { background: var(--ok-soft); }
.notice.danger { background: var(--danger-soft); }
.notice .n-ico { font-size: 1.2rem; line-height: 1.3; }

.loading { display: grid; place-items: center; padding: 3rem; color: var(--text-3); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.code-display { font-family: var(--mono); font-size: 1.15rem; font-weight: 700; letter-spacing: .08em; background: var(--bg-sunken); padding: .3rem .6rem; border-radius: 8px; user-select: all; }
.online-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); display: inline-block; box-shadow: 0 0 0 2px var(--bg-elev); }
details.collapse summary { cursor: pointer; font-weight: 650; color: var(--text-2); font-size: .9rem; }

.area-head { flex-wrap: wrap; }
.area-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.only-mobile { display: none; }
@media (max-width: 860px) {
  .only-mobile { display: inline-flex; }
  .area-head .actions { width: 100%; }
}
