/* DevPlaner – Styles */
:root {
  /* Farben */
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f2f4f9;
  --surface-3: #e7eaf3;
  --border: #e1e5ee;
  --border-strong: #cdd3e1;
  --text: #1c2033;
  --text-2: #4f5670;
  --text-3: #646a82;
  --accent: #4f50e0;
  --accent-2: #4041c8;
  --accent-soft: #ecebff;
  --accent-solid: #4f50e0;      /* Hintergrund gefüllter Knöpfe */
  --on-accent: #ffffff;
  --ok: #0b7a55;
  --ok-soft: #dff6ec;
  --warn: #8a6100;
  --warn-soft: #fdf3d8;
  --danger: #c42f2f;
  --danger-soft: #fde6e6;
  --info: #1268a8;
  --info-soft: #e0f0fc;
  --focus: #4f50e0;
  --overlay: rgba(12, 14, 26, .45);

  /* Abstände (4er-Raster) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  /* Radien */
  --radius-xs: 6px; --radius-sm: 8px; --radius: 12px; --radius-lg: 16px; --radius-pill: 999px;
  /* Schrift */
  --fs-xs: 12px; --fs-sm: 13px; --fs-base: 14px; --fs-md: 15px; --fs-lg: 17px; --fs-xl: 20px; --fs-2xl: 26px;
  /* Schatten: ruhig, nur zur Hervorhebung */
  --shadow-sm: 0 1px 2px rgba(20, 24, 50, .04);
  --shadow: 0 1px 2px rgba(20, 24, 50, .04), 0 2px 8px rgba(20, 24, 50, .04);
  --shadow-lg: 0 12px 40px rgba(20, 24, 50, .18);
  --ease: cubic-bezier(.2, .7, .3, 1);
  --sidebar-w: 248px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11131c; --surface: #181b26; --surface-2: #202432; --surface-3: #2a2f42;
    --border: #2b3044; --border-strong: #3a4058; --text: #e9ebf5; --text-2: #b0b6cc; --text-3: #8b91a9;
    --accent: #9b9cff; --accent-2: #b0b1ff; --accent-soft: #2a2b55; --accent-solid: #5b5cf0; --on-accent: #ffffff;
    --ok: #3cc995; --ok-soft: #173a2f; --warn: #e8b13a; --warn-soft: #3d3218;
    --danger: #f27474; --danger-soft: #422224; --info: #5bb2f0; --info-soft: #18324a; --focus: #9b9cff;
    --overlay: rgba(0, 0, 0, .55);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);
    --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 2px 8px rgba(0, 0, 0, .18);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11131c; --surface: #181b26; --surface-2: #202432; --surface-3: #2a2f42;
  --border: #2b3044; --border-strong: #3a4058; --text: #e9ebf5; --text-2: #b0b6cc; --text-3: #8b91a9;
  --accent: #9b9cff; --accent-2: #b0b1ff; --accent-soft: #2a2b55; --accent-solid: #5b5cf0; --on-accent: #ffffff;
  --ok: #3cc995; --ok-soft: #173a2f; --warn: #e8b13a; --warn-soft: #3d3218;
  --danger: #f27474; --danger-soft: #422224; --info: #5bb2f0; --info-soft: #18324a; --focus: #9b9cff;
  --overlay: rgba(0, 0, 0, .55);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 2px 8px rgba(0, 0, 0, .18);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: var(--fs-base)/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 650; letter-spacing: -.005em; }
h2 { font-size: var(--fs-md); }
h3 { font-size: var(--fs-base); }
p { margin: 0 0 .6em; }
a { color: var(--accent); text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); }
.small { font-size: var(--fs-xs); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.prose { max-width: 72ch; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; z-index: 30; scrollbar-width: thin;
}
.brand { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-4) var(--sp-4) var(--sp-3); }
.brand-logo {
  width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--accent-solid); color: var(--on-accent);
  display: grid; place-items: center; font-weight: 800; font-size: var(--fs-sm);
}
.brand-name { font-weight: 700; font-size: var(--fs-md); letter-spacing: -.01em; flex: 1; }

.project-switch { padding: 0 var(--sp-3) var(--sp-3); border-bottom: 1px solid var(--border); }
.project-switch select { width: 100%; font-weight: 600; }
.project-actions { display: flex; gap: var(--sp-1); margin-top: var(--sp-2); }
.project-actions .btn { flex: 1; }
.project-actions .btn:last-child { flex: 0 0 auto; }

/* Navigation: gruppiert, ruhig */
.nav { padding: var(--sp-2) var(--sp-2) var(--sp-3); display: flex; flex-direction: column; gap: 1px; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-group + .nav-group, .nav > .nav-item + .nav-group { margin-top: var(--sp-3); }
.nav-group-head {
  display: flex; align-items: center; gap: var(--sp-1); width: 100%; border: 0; background: none; cursor: pointer;
  padding: var(--sp-1) 10px; border-radius: var(--radius-xs); text-align: left;
  font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3);
}
.nav-group-head:hover { color: var(--text-2); }
.nav-group-head:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.nav-group-label { flex: 1; }
.nav-chev { width: 12px; height: 12px; transition: transform .15s var(--ease); flex: 0 0 auto; }
.nav-group.collapsed .nav-chev { transform: rotate(-90deg); }
.nav-group-sum { font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav-group:not(.collapsed) .nav-group-sum { display: none; }
.nav-group-items { display: flex; flex-direction: column; gap: 1px; }
.nav-group.collapsed .nav-group-items { display: none; }
.nav-group.has-active .nav-group-head { cursor: default; }
.nav-group.has-active .nav-chev { opacity: .35; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--radius-sm); min-height: 34px;
  color: var(--text-2); text-decoration: none; font-weight: 500; font-size: 13.5px; border: 0; background: none; cursor: pointer; text-align: left;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-icon { width: 18px; height: 18px; flex: 0 0 18px; display: grid; place-items: center; font-size: 14px; color: var(--text-3); }
.nav-item:hover .nav-icon { color: var(--text-2); }
.nav-item.active .nav-icon { color: var(--accent); }
.ico-sm { width: 16px !important; height: 16px !important; }
.btn .ico, .icon-btn .ico { width: 16px; height: 16px; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; display: block; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count { font-size: 11.5px; color: var(--text-3); font-weight: 500; font-variant-numeric: tabular-nums; min-width: 16px; text-align: right; }
.nav-item.active .nav-count { color: var(--accent); }
.nav-key { font-size: 10px; color: var(--text-3); font-family: var(--mono); }

.sidebar-footer { padding: var(--sp-3) var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: var(--sp-1); align-items: center; }
.save-state { font-size: 11.5px; color: var(--text-3); width: 100%; padding: 0 var(--sp-2); }
.save-state.error { color: var(--danger); }

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4) var(--sp-8); background: color-mix(in srgb, var(--bg) 88%, transparent);
  position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(1.4) blur(8px); backdrop-filter: saturate(1.4) blur(8px);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-sub { color: var(--text-2); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.icon-btn.menu-btn, .icon-btn.sidebar-close { display: none; }
.main { padding: var(--sp-6) var(--sp-8) 64px; outline: none; max-width: 1440px; width: 100%; }
.sidebar-backdrop { display: none; }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px;
  padding: 7px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: var(--fs-sm); line-height: 1.3; cursor: pointer; white-space: nowrap;
  text-decoration: none; transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { background: var(--surface-3); }
.btn:focus-visible, .icon-btn:focus-visible, .nav-item:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .card-item:focus-visible,
.link-btn:focus-visible, .chip:focus-visible, .hint:focus-visible, .tabs button:focus-visible, .template:focus-within, .survey-link:focus-visible, [data-action][tabindex]:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}
.btn-primary { background: var(--accent-solid); border-color: var(--accent-solid); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent-solid) 88%, #000); border-color: color-mix(in srgb, var(--accent-solid) 88%, #000); }
.btn-primary:active { background: color-mix(in srgb, var(--accent-solid) 80%, #000); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
:root[data-theme="dark"] .btn-danger { background: #c42f2f; border-color: #c42f2f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-danger { background: #c42f2f; border-color: #c42f2f; } }
.btn-danger:hover { filter: brightness(1.06); }
.btn-danger-ghost, .btn.danger { color: var(--danger); }
.btn-danger-ghost:hover, .btn.danger:hover { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--text); }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: var(--fs-xs); border-radius: var(--radius-xs); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn.is-loading { pointer-events: none; opacity: .75; }
.is-busy { opacity: .6; cursor: progress; }
.icon-btn {
  width: 32px; height: 32px; border-radius: var(--radius-sm); border: 0; background: transparent;
  color: var(--text-2); cursor: pointer; display: inline-grid; place-items: center; font-size: 15px; flex: 0 0 auto;
  transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: .4; cursor: default; background: transparent; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }

input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="date"], input[type="search"], input[type="url"], select, textarea {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 7px 10px; width: 100%; min-width: 0; min-height: 36px; transition: border-color .12s, box-shadow .12s;
}
input[type="text"]:hover, input[type="password"]:hover, input[type="email"]:hover, input[type="number"]:hover, input[type="date"]:hover, input[type="search"]:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--text-3) 60%, var(--border-strong)); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; border-color: var(--focus); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-2); cursor: not-allowed; }
::placeholder { color: var(--text-3); opacity: 1; }
input[type="color"] { width: 46px; height: 36px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); padding: 3px; }
textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
select { cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--accent-solid); cursor: pointer; flex: 0 0 auto; }
input[type="range"] { width: 100%; accent-color: var(--accent-solid); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-4); min-width: 0; }
.field > label, .field-label { font-weight: 600; font-size: var(--fs-xs); color: var(--text-2); }
.field-hint { font-size: var(--fs-xs); color: var(--text-3); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--sp-3); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 var(--sp-3); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 var(--sp-3); }

/* ---------- Cards & Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: var(--sp-5); min-width: 0; }
.panel + .panel { margin-top: var(--sp-4); }
.stack > .panel + .panel, .cols > .panel + .panel { margin-top: 0; }
.panel-head { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-4); flex-wrap: wrap; min-height: 30px; }
.panel-head h2 { flex: 1 1 10rem; min-width: 0; font-size: var(--fs-md); }
.panel-head + p.muted, .panel-head + .muted.small { margin-top: calc(var(--sp-2) * -1); }
.panel > h2:first-child { margin-bottom: 6px; }
.panel > h2:first-child + p.small { margin-bottom: var(--sp-3); }
.panel-danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.panel-danger h2 { color: var(--danger); }
.section-gap { margin-top: var(--sp-4); }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.row { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.section-title { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin: var(--sp-6) 0 var(--sp-3); }
.section-title:first-child { margin-top: 0; }

.cols { display: grid; gap: var(--sp-4); }
.cols > *, .stack > *, .stats > * { min-width: 0; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-main-side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.cols-risk { grid-template-columns: minmax(300px, 1fr) minmax(0, 2fr); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); box-shadow: var(--shadow-sm); }
.stat-label { font-size: var(--fs-xs); color: var(--text-2); font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; line-height: 1.25; }
.stat-sub { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }
.stat-sub .progress { margin-top: 6px; }
.stat-sub a { text-decoration: none; }
/* Kompakte Nebenkennzahlen */
.stats-secondary { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.stats-secondary .stat { border: 0; border-radius: 0; box-shadow: none; background: transparent; padding: var(--sp-3) var(--sp-4); border-left: 1px solid var(--border); margin-left: -1px; }
.stats-secondary .stat-value { font-size: var(--fs-md); font-weight: 650; }
.stats-secondary .stat-label { font-weight: 500; }

.progress { height: 6px; background: var(--surface-3); border-radius: var(--radius-pill); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent-solid); border-radius: var(--radius-pill); transition: width .3s var(--ease); }
.progress.ok > span { background: var(--ok); }
.progress.warn > span { background: var(--warn); }
.progress.danger > span { background: var(--danger); }
.progress-lg { height: 10px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2); white-space: nowrap; line-height: 20px; min-height: 20px;
}
.badge-must { background: var(--danger-soft); color: var(--danger); }
.badge-should { background: var(--warn-soft); color: var(--warn); }
.badge-could { background: var(--info-soft); color: var(--info); }
.badge-wont { background: var(--surface-3); color: var(--text-2); }
.badge-ok, .badge-done, .badge-accepted, .badge-closed, .badge-low { background: var(--ok-soft); color: var(--ok); }
.badge-warn, .badge-risk, .badge-review, .badge-proposed, .badge-medium, .badge-mitigated { background: var(--warn-soft); color: var(--warn); }
.badge-danger, .badge-late, .badge-critical, .badge-rejected, .badge-high { background: var(--danger-soft); color: var(--danger); }
.badge-doing, .badge-info { background: var(--info-soft); color: var(--info); }
.badge-todo { background: var(--accent-soft); color: var(--accent); }
.badge-high { background: #fde9dc; color: #a8461a; }
:root[data-theme="dark"] .badge-high { background: #43291b; color: #f39a62; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge-high { background: #43291b; color: #f39a62; } }
.tag { display: inline-block; padding: 0 7px; border-radius: var(--radius-xs); background: var(--surface-2); border: 1px solid var(--border); font-size: 11.5px; color: var(--text-2); }

/* Leere Zustände: ein ruhiges Symbol, ein Satz, eine Aktion */
.empty { text-align: center; padding: var(--sp-10) var(--sp-5); color: var(--text-2); max-width: 520px; margin: 0 auto; }
.empty-icon {
  width: 48px; height: 48px; margin: 0 auto var(--sp-3); border-radius: var(--radius); background: var(--surface-2); color: var(--text-3);
  display: grid; place-items: center; font-size: 22px; line-height: 1;
}
.empty h3 { color: var(--text); margin-bottom: var(--sp-1); font-size: var(--fs-md); }
.empty p { font-size: var(--fs-sm); margin-bottom: var(--sp-4); }
.empty .row { justify-content: center; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 calc(var(--sp-5) * -1); padding: 0 var(--sp-5); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { font-size: var(--fs-xs); color: var(--text-2); font-weight: 600; background: var(--surface); position: sticky; top: 0; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
tbody tr:last-child td { border-bottom-color: transparent; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
tr.is-done td .title-cell { text-decoration: line-through; color: var(--text-3); }
td .title-cell { font-weight: 600; }
td input[type="number"] { width: 72px; padding: 4px 7px; min-height: 30px; }
td select { padding: 4px 7px; width: auto; min-height: 30px; }
tfoot td { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--border); }

/* ---------- Filter bar ---------- */
.filterbar { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-4); align-items: center; }
.filterbar input[type="search"] { flex: 1 1 220px; width: auto; }
.filterbar select { width: auto; flex: 0 1 auto; }
.quick-add { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.quick-add input { flex: 1; }

/* ---------- Kanban ---------- */
.board { display: grid; grid-template-columns: repeat(5, minmax(185px, 1fr)); gap: var(--sp-3); overflow-x: auto; padding-bottom: 10px; align-items: start; }
.column { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 300px; }
.column-head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-3) var(--sp-2); font-weight: 650; font-size: var(--fs-sm); }
.column-head .count { font-size: var(--fs-xs); color: var(--text-2); font-weight: 600; background: var(--surface); border-radius: var(--radius-pill); padding: 0 8px; }
.column-head .hours { margin-left: auto; font-size: 11.5px; color: var(--text-3); font-weight: 500; }
.column-body { padding: var(--sp-1) var(--sp-2) var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); flex: 1; min-height: 60px; border-radius: 0 0 var(--radius) var(--radius); transition: background .12s; }
.column-body.drag-over { background: var(--accent-soft); }
.card-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px;
  box-shadow: var(--shadow-sm); cursor: grab; display: flex; flex-direction: column; gap: 6px;
  border-left: 3px solid var(--border); transition: border-color .12s, box-shadow .12s;
}
.card-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.card-item.dragging { opacity: .45; }
.card-item.prio-must { border-left-color: var(--danger); }
.card-item.prio-should { border-left-color: var(--warn); }
.card-item.prio-could { border-left-color: var(--info); }
.card-item.prio-wont { border-left-color: var(--text-3); opacity: .75; }
.card-title { font-weight: 600; word-break: break-word; font-size: var(--fs-sm); }
.card-meta { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; font-size: var(--fs-xs); color: var(--text-2); }
.card-meta .sep { flex: 1; }
.card-move { display: none; }
.blocked-flag { color: var(--danger); font-size: var(--fs-xs); font-weight: 650; }

/* ---------- Roadmap / Gantt ---------- */
.gantt { position: relative; overflow-x: auto; }
.gantt-inner { position: relative; min-width: 640px; padding-top: 4px; }
.gantt-scale { position: relative; height: 26px; border-bottom: 1px solid var(--border); margin-left: 180px; font-size: 11px; color: var(--text-3); }
.gantt-tick { position: absolute; top: 4px; transform: translateX(-1px); padding-left: 4px; border-left: 1px solid var(--border); height: 22px; white-space: nowrap; }
.gantt-row { display: flex; align-items: center; height: 40px; border-bottom: 1px dashed var(--border); }
.gantt-label { width: 180px; flex: 0 0 180px; padding-right: 12px; font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.gantt-label:hover { color: var(--accent); }
.gantt-track { position: relative; flex: 1; height: 100%; }
.gantt-bar {
  position: absolute; top: 9px; height: 22px; border-radius: var(--radius-xs); min-width: 6px; cursor: pointer; overflow: hidden;
  display: flex; align-items: center; color: #fff; font-size: 11px; font-weight: 700; padding: 0 6px; white-space: nowrap;
}
.gantt-bar .fill { position: absolute; inset: 0 auto 0 0; background: rgba(255, 255, 255, .28); }
.gantt-bar span { position: relative; text-shadow: 0 1px 1px rgba(0, 0, 0, .25); }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); z-index: 2; pointer-events: none; }
.gantt-today::after { content: 'Heute'; position: absolute; top: -16px; left: 4px; font-size: 10px; color: var(--danger); font-weight: 700; }

.ms-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: var(--sp-4); border-top: 3px solid var(--accent); box-shadow: var(--shadow-sm); }
.ms-head { display: flex; gap: var(--sp-2); align-items: flex-start; }
.ms-head h3 { flex: 1; }
.ms-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ms-list li { display: flex; gap: var(--sp-2); align-items: center; font-size: var(--fs-sm); padding: 3px 4px; border-radius: var(--radius-xs); cursor: pointer; }
.ms-list li:hover { background: var(--surface-2); }
.ms-list li .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-list li.done .t { text-decoration: line-through; color: var(--text-3); }
.ms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--sp-4); }
.capacity { margin-top: 10px; font-size: var(--fs-xs); color: var(--text-2); }

/* ---------- Risiko-Matrix ---------- */
.matrix { display: grid; grid-template-columns: 26px repeat(5, 1fr); grid-template-rows: repeat(5, 54px) 26px; gap: 4px; max-width: 460px; }
.matrix-cell { border-radius: var(--radius-xs); display: grid; place-items: center; font-weight: 700; font-size: var(--fs-md); color: rgba(0, 0, 0, .72); cursor: default; position: relative; }
.matrix-cell.has { cursor: pointer; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .22); }
.matrix-cell.sel { box-shadow: inset 0 0 0 3px var(--text); }
.matrix-axis { font-size: 11px; color: var(--text-2); display: grid; place-items: center; font-weight: 600; }
.lvl-low { background: #bfead4; }
.lvl-medium { background: #f8e4a3; }
.lvl-high { background: #f7c39b; }
.lvl-critical { background: #f19b9b; }
.matrix-legend { display: flex; gap: var(--sp-3); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-2); margin-top: var(--sp-3); }
.matrix-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }

/* ---------- Listen / Einträge ---------- */
.item-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--sp-3) var(--sp-4); background: var(--surface); }
.item-head { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.item-head h3 { flex: 1; min-width: 160px; }
.item-body { margin-top: var(--sp-2); color: var(--text-2); font-size: var(--fs-sm); white-space: pre-wrap; word-break: break-word; }
.item-body strong { color: var(--text); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; margin: var(--sp-2) 0 0; font-size: var(--fs-sm); }
.kv dt { color: var(--text-3); font-weight: 500; }
.kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; }

.hint-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.hint { display: flex; gap: 10px; align-items: flex-start; padding: 7px 10px; border-radius: var(--radius-sm); background: transparent; font-size: var(--fs-sm); cursor: pointer; border: 0; text-align: left; width: 100%; color: var(--text); line-height: 1.45; }
.hint:hover { background: var(--surface-2); }
.hint .ic { flex: 0 0 auto; width: 16px; text-align: center; }
.hint.warn .ic { color: var(--warn); }
.hint.info .ic { color: var(--info); }

.bars { display: flex; flex-direction: column; gap: var(--sp-2); }
.bar-row { display: grid; grid-template-columns: 120px 1fr 70px; gap: 10px; align-items: center; font-size: var(--fs-sm); }
.bar-row .progress { height: 8px; }
.bar-row .v { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }

.donut-wrap { display: flex; gap: var(--sp-4); align-items: center; flex-wrap: wrap; }
.legend { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }

.vision-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.vision-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-4) var(--sp-5); box-shadow: var(--shadow-sm); }
.vision-card h3 { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: 2px; }
.vision-card .q { font-size: var(--fs-xs); color: var(--text-3); margin-bottom: var(--sp-2); }
.vision-card textarea { min-height: 110px; }

.notes-area { min-height: 420px; font-family: var(--mono); font-size: var(--fs-sm); }
.md-preview { line-height: 1.65; word-break: break-word; max-width: 80ch; }
.md-preview h1, .md-preview h2, .md-preview h3, .md-preview h4 { margin: 1em 0 .4em; }
.md-preview h1 { font-size: 22px; } .md-preview h2 { font-size: 18px; } .md-preview h3 { font-size: 15px; }
.md-preview code { font-family: var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.md-preview pre { background: var(--surface-2); padding: 12px; border-radius: var(--radius-sm); overflow-x: auto; }
.md-preview pre code { background: none; padding: 0; }
.md-preview ul { padding-left: 22px; }
.md-preview table { margin: 8px 0; }
.md-preview blockquote { margin: 0; padding: 4px 14px; border-left: 3px solid var(--accent); color: var(--text-2); }
.md-preview hr { border: 0; border-top: 1px solid var(--border); }
pre.export-preview { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; max-height: 520px; overflow: auto; font-size: 12.5px; white-space: pre-wrap; word-break: break-word; margin: 0; }

.tabs { display: inline-flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 3px; gap: 2px; border: 1px solid var(--border); max-width: 100%; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 5px 12px; border-radius: var(--radius-xs); cursor: pointer; font-weight: 600; color: var(--text-2); font-size: var(--fs-sm); white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-3); }
.template {
  position: relative; border: 1px solid var(--border-strong); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); cursor: pointer; background: var(--surface);
  text-align: left; display: flex; flex-direction: column; gap: 2px; transition: border-color .12s, background .12s;
}
.template:hover { border-color: var(--accent); }
.template.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.template strong { font-size: var(--fs-base); }
.template span { font-size: var(--fs-xs); color: var(--text-2); }
.template input { position: absolute; opacity: 0; pointer-events: none; }

.welcome { max-width: 820px; margin: var(--sp-6) auto; }
.welcome h2 { font-size: var(--fs-2xl); margin-bottom: var(--sp-2); letter-spacing: -.02em; font-weight: 700; }
.welcome .lead { color: var(--text-2); font-size: var(--fs-md); margin-bottom: var(--sp-6); max-width: 68ch; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-3) var(--sp-6); margin: var(--sp-8) 0; }
.feature-grid div { font-size: var(--fs-sm); color: var(--text-2); }
.feature-grid strong { display: block; color: var(--text); margin-bottom: 2px; }

.check-list { display: flex; flex-direction: column; gap: 6px; margin-top: var(--sp-2); }
.check-list label { display: flex; gap: var(--sp-2); align-items: flex-start; cursor: pointer; font-size: var(--fs-sm); }
.check-list label.done span { text-decoration: line-through; color: var(--text-3); }
.dep-list { max-height: 180px; overflow-y: auto; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: var(--sp-2) 10px; display: flex; flex-direction: column; gap: 4px; background: var(--surface); }
.dep-list label { display: flex; gap: var(--sp-2); align-items: center; font-size: var(--fs-sm); cursor: pointer; }
.dep-list label.disabled { opacity: .45; cursor: not-allowed; }

.kbd { font-family: var(--mono); font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; }

/* ---------- Modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: var(--sp-5); background: var(--overlay); animation: fade .14s ease-out; overscroll-behavior: contain; }
.modal-root[hidden] { display: none; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 640px;
  max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; animation: pop .16s var(--ease); border: 1px solid var(--border);
}
.modal.wide { max-width: 840px; }
.modal.narrow { max-width: 440px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.modal-head h2 { flex: 1; min-width: 0; font-size: var(--fs-lg); overflow-wrap: anywhere; }
.modal-body { padding: var(--sp-5) var(--sp-5) var(--sp-2); overflow-y: auto; flex: 1 1 auto; min-height: 0; scrollbar-gutter: stable; }
.modal-foot { display: flex; gap: var(--sp-2); justify-content: flex-end; padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--border); flex-wrap: wrap; flex: 0 0 auto; background: var(--surface); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.modal-foot .left { margin-right: auto; }
.form-error { color: var(--danger); background: var(--danger-soft); font-size: var(--fs-sm); margin-bottom: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm); }
.form-error[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(6px) scale(.985); opacity: 0; } }

.menu { display: flex; flex-direction: column; gap: 2px; margin: 0 calc(var(--sp-2) * -1); }
.menu-sep { border: 0; border-top: 1px solid var(--border); margin: var(--sp-1) var(--sp-2); width: auto; }
.menu button, .menu .btn { justify-content: flex-start; border-color: transparent; background: transparent; }
.menu button:hover, .menu .btn:hover { background: var(--surface-2); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: var(--sp-5); right: var(--sp-5); z-index: 200; display: flex; flex-direction: column; gap: var(--sp-2); align-items: flex-end; pointer-events: none; }
.toast {
  background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  display: flex; gap: var(--sp-3); align-items: center; font-size: var(--fs-sm); animation: pop .16s var(--ease); max-width: 420px; pointer-events: auto;
}
.toast.error { background: #c42f2f; color: #fff; }
/* Bei offenem Dialog erscheinen Meldungen oben, damit sie keine Dialog-Knöpfe verdecken */
.modal-root:not([hidden]) ~ .toasts { bottom: auto; top: var(--sp-5); }
.toast button { background: transparent; border: 1px solid currentColor; color: inherit; border-radius: var(--radius-xs); padding: 2px 8px; cursor: pointer; font-weight: 650; white-space: nowrap; }
.toast button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-main-side, .cols-risk { grid-template-columns: 1fr; }
  .topbar, .main { padding-left: var(--sp-6); padding-right: var(--sp-6); }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-100%); transition: transform .2s var(--ease), visibility .2s; box-shadow: var(--shadow-lg); visibility: hidden; }
  .app.sidebar-open .sidebar { transform: none; visibility: visible; }
  .app.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: var(--overlay); z-index: 25; animation: fade .15s ease-out; }
  .icon-btn.sidebar-close, .icon-btn.menu-btn { display: inline-grid; }
  .menu-btn { margin-left: -6px; }
  .nav-item { min-height: 40px; }
  .topbar { padding: 10px var(--sp-4); flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); }
  .topbar-title h1 { font-size: var(--fs-lg); }
  .topbar-sub { font-size: var(--fs-xs); }
  /* Aktionen: eine Zeile, Hauptaktion zuerst; was nicht passt, lässt sich seitlich wischen */
  .topbar-actions {
    width: calc(100% + var(--sp-4)); margin-right: calc(var(--sp-4) * -1); padding: 2px var(--sp-4) 2px 0;
    justify-content: flex-start; gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  .topbar-actions::-webkit-scrollbar { display: none; }
  .topbar-actions:empty { display: none; }
  .topbar-actions .btn { min-height: 32px; padding: 4px 10px; font-size: var(--fs-xs); flex: 0 0 auto; }
  .topbar-actions .btn-primary { order: -1; }
  .main { padding: var(--sp-4) var(--sp-4) 64px; }
  .cols-2, .cols-3, .vision-grid { grid-template-columns: 1fr; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board { grid-template-columns: repeat(5, minmax(240px, 82vw)); scroll-snap-type: x mandatory; }
  .column { scroll-snap-align: start; }
  .card-move { display: block; }
  .card-move select { padding: 3px 6px; font-size: var(--fs-xs); min-height: 30px; }
  .table-wrap { margin: 0 calc(var(--sp-4) * -1); padding: 0 var(--sp-4); }
  .panel { padding: var(--sp-4); }
  .hide-sm { display: none; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: 4px; }
  .bar-row { grid-template-columns: 90px 1fr 60px; }
  .toasts { left: var(--sp-4); right: var(--sp-4); bottom: var(--sp-4); align-items: stretch; }
  .toast { max-width: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
  .stats-secondary { gap: 0; }
  .stats-secondary .stat { border-top: 1px solid var(--border); margin-top: -1px; }
  .stat-value { font-size: 19px; }
}
@media (max-width: 520px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .modal-root { padding: 0; align-items: end; }
  .modal { max-height: 92vh; max-height: 92dvh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-foot { border-radius: 0; padding-bottom: max(var(--sp-3), env(safe-area-inset-bottom)); }
  .modal-head, .modal-body, .modal-foot { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .modal-foot .btn { flex: 1 1 auto; }
}

/* ---------- Bewegung reduzieren ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .spinner { animation-duration: 1.4s !important; animation-iteration-count: infinite !important; }
}

/* ---------- Druck ---------- */
@media print {
  .sidebar, .topbar, .toasts, .modal-root, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .main { padding: 0; max-width: none; }
  .panel { box-shadow: none; border: 0; padding: 0; }
}

/* ---------- Anmeldung / Start ---------- */
body.gated .app { display: none; }
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--sp-5); background: var(--bg); }
.gate[hidden] { display: none; }
.gate-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: var(--sp-8); width: 100%; max-width: 400px;
}
.gate-card.wide { max-width: 620px; }
.gate-card h1 { font-size: 22px; font-weight: 700; letter-spacing: -.015em; margin: var(--sp-6) 0 var(--sp-1); }
.gate-lead { margin-bottom: var(--sp-5); }
.gate-card .btn-primary[type="submit"] { min-height: 40px; margin-top: var(--sp-1); }
.gate-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.gate-msg { margin: var(--sp-3) 0; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--info-soft); color: var(--info); font-size: var(--fs-sm); }
.gate-msg.error { background: var(--danger-soft); color: var(--danger); }
.gate-msg[hidden] { display: none; }
@media (max-width: 520px) { .gate { align-items: start; padding-top: 12vh; } .gate-card { padding: var(--sp-6) var(--sp-5); box-shadow: none; } }
.setup-list { padding-left: 20px; }
.setup-list li { margin: 6px 0; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* ---------- KI ---------- */
.btn-ai { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); color: var(--accent); background: var(--accent-soft); }
.btn-ai:hover { background: var(--accent-soft); filter: brightness(.97); border-color: var(--accent); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
.spinner-lg { width: 34px; height: 34px; border-width: 3px; color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-busy { text-align: center; padding: 10px 0 14px; }
.ai-busy p { margin: 10px 0 0; }
.preview-list { display: flex; flex-direction: column; gap: 8px; }
.preview-item { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; background: var(--surface); }
.preview-item:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.preview-item input { margin-top: 3px; }
.preview-item > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-size: inherit; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Chat ---------- */
.chat-panel { display: flex; flex-direction: column; min-height: calc(100vh - 190px); }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 4px 2px 16px; max-height: calc(100vh - 300px); min-height: 260px; }
.msg { display: flex; flex-direction: column; max-width: 86%; }
.msg-user { align-self: flex-end; align-items: flex-end; }
.msg-assistant { align-self: flex-start; }
.msg-body { padding: 10px 14px; border-radius: var(--radius-lg); word-break: break-word; }
.msg-user .msg-body { background: var(--accent-solid); color: var(--on-accent); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg-assistant .msg-body { background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-assistant .msg-body > :first-child { margin-top: 0; }
.msg-assistant .msg-body > :last-child { margin-bottom: 0; }
.msg-meta { font-size: 11.5px; color: var(--text-3); margin-top: 3px; padding: 0 4px; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid var(--border); padding-top: 12px; }
.chat-input textarea { flex: 1; min-height: 46px; max-height: 200px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-pill); padding: 6px 12px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ---------- Fragebögen ---------- */
.cols-survey { grid-template-columns: minmax(220px, 1fr) minmax(0, 3fr); align-items: start; }
.survey-link { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; border: 1px solid transparent; background: none; border-radius: var(--radius-sm); padding: 8px 10px; cursor: pointer; width: 100%; }
.survey-link:hover { background: var(--surface-2); }
.survey-link.active { background: var(--accent-soft); border-color: var(--accent); }
.survey-link .t { font-weight: 600; word-break: break-word; }
.q-list { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 12px; }
.q-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.q-head { display: flex; gap: 8px; align-items: center; }
.q-num { font-weight: 700; color: var(--text-3); min-width: 22px; }
.q-head input { font-weight: 600; }
.q-item textarea { min-height: 60px; }
.ai-badge { align-self: flex-start; }
.add-q { display: flex; gap: 8px; align-items: flex-end; }
.add-q textarea { flex: 1; min-height: 46px; }

@media (max-width: 860px) {
  .cols-survey { grid-template-columns: 1fr; }
  .msg { max-width: 96%; }
  .chat-log { max-height: none; }
  .chat-panel { min-height: 0; }
}

.provider-table tr.is-active td { background: var(--accent-soft); }
.provider-table td code { font-size: 12px; word-break: break-all; }
#pc-model-select { margin-top: 8px; }

/* ---------- Öffentlicher Fragebogen ---------- */
.ps-wrap { max-width: 680px; margin: 0 auto; padding: var(--sp-10) var(--sp-4) 64px; }
.ps-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: var(--sp-8); }
.ps-eyebrow { font-size: var(--fs-xs); font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: var(--sp-2); }
.ps-card h1 { font-size: 24px; font-weight: 700; margin-bottom: var(--sp-2); letter-spacing: -.015em; }
.ps-center { text-align: center; padding: var(--sp-10) var(--sp-6); max-width: 480px; margin: var(--sp-10) auto 0; }
.ps-center .empty-icon { margin-bottom: var(--sp-4); }
.ps-center .empty-icon .ico, .rv-center .empty-icon .ico { width: 24px; height: 24px; }
.empty-icon.is-ok { background: var(--ok-soft); color: var(--ok); }
.ps-purpose { white-space: pre-wrap; margin-bottom: var(--sp-6); max-width: 65ch; }
.ps-card > .field { padding-bottom: var(--sp-5); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-6); }
.ps-questions { list-style: none; counter-reset: psq; padding: 0; margin: 0 0 var(--sp-2); }
.ps-questions > li { counter-increment: psq; position: relative; padding-left: 36px; margin-bottom: var(--sp-6); }
.ps-questions > li::before {
  content: counter(psq); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: var(--fs-xs); font-weight: 700; display: grid; place-items: center;
}
.ps-questions label, .ps-questions legend { font-size: var(--fs-md); color: var(--text); font-weight: 600; line-height: 1.4; }
.ps-submit { width: 100%; min-height: 44px; font-size: var(--fs-md); }
.ps-note { margin: var(--sp-3) 0 0; text-align: center; }
.ps-brand { text-align: center; margin-top: var(--sp-5); }
.ps-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 520px) {
  .ps-card { padding: var(--sp-5); }
  .ps-wrap { padding-top: var(--sp-4); }
  .ps-questions > li { padding-left: 0; padding-top: 32px; }
}

/* ---------- Projekt-Assistent ---------- */
.modal.wiz { max-width: 860px; }
.wiz-steps { list-style: none; display: flex; gap: 4px; padding: 0; margin: 0 0 16px; counter-reset: s; }
.wiz-steps li { flex: 1; min-width: 0; }
.wiz-steps button { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; cursor: pointer; padding: 4px 2px; color: var(--text-3); font-size: 11.5px; font-weight: 600; }
.wiz-steps button:disabled { cursor: default; }
.wiz-steps .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); font-size: 12px; }
.wiz-steps li.done .n { background: var(--ok-soft); color: var(--ok); }
.wiz-steps li.current .n { background: var(--accent-solid); color: var(--on-accent); }
.wiz-steps li.current button { color: var(--text); }
.wiz-steps .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wiz-intro { margin: 0 0 var(--sp-4); padding: 10px 12px; background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); font-size: var(--fs-sm); color: var(--text-2); }
.wiz-cap { margin: -4px 0 14px; font-size: 13px; color: var(--text-2); }
.wiz-cap[hidden] { display: none; }
.wiz-summary { grid-template-columns: 140px 1fr; }
.wiz-summary dd { white-space: pre-wrap; }
.field .field-hint + textarea, .field .field-hint + input { margin-top: 2px; }
.chip-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { position: relative; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span { display: inline-block; border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 5px 12px; font-size: 13px; color: var(--text-2); background: var(--surface); }
.chip-check input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip-check input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Antworten & Verschicken ---------- */
.resp-people { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.resp-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 2px 4px 2px 10px; font-size: 13px; background: var(--surface-2); }
.resp-chip .icon-btn { width: 24px; height: 24px; font-size: 12px; }
.resp-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.resp-list li { display: grid; grid-template-columns: 140px 1fr; gap: 10px; padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 13.5px; }
.resp-name { font-weight: 600; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.resp-text { white-space: pre-wrap; word-break: break-word; }
.share-sec { padding: 4px 0 16px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.share-sec:last-child { border-bottom: 0; margin-bottom: 0; }
.share-sec h3 { margin-bottom: 6px; }
@media (max-width: 640px) {
  .wiz-steps .t { display: none; }
  .wiz-summary { grid-template-columns: 1fr; }
  .resp-list li { grid-template-columns: 1fr; gap: 2px; }
}
.modal-root.no-anim, .modal-root.no-anim .modal { animation: none; }

/* ---------- Übersicht ---------- */
.stats-main { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: var(--sp-3); }
.stats-main .stat { padding: var(--sp-4); }
.stats-main .stat-value { font-size: 24px; }
.stats-main .stat-sub .badge { margin-left: 2px; }
.stats-secondary { margin-bottom: var(--sp-5); }
.ms-bar-row { grid-template-columns: minmax(0, 1.3fr) minmax(0, 2fr) 130px; }
.risk-mini { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.risk-mini li { flex-wrap: nowrap; padding: 6px 8px; margin: 0 -8px; border-radius: var(--radius-sm); cursor: pointer; font-size: var(--fs-sm); align-items: flex-start; }
.risk-mini li:hover { background: var(--surface-2); }
.risk-mini .badge { min-width: 28px; justify-content: center; }
.risk-mini-t { flex: 1; min-width: 0; }
.hint .ic { font-weight: 800; font-size: 11px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; }
.hint.warn .ic { background: var(--warn-soft); }
.hint.info .ic { background: var(--info-soft); }
@media (max-width: 1100px) {
  .stats-main { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* einspaltig: Verteilung (Nebeninfo) ans Ende */
  .dash-cols > .stack { display: contents; }
  .dash-cols > .stack > .dash-dist { order: 2; }
}
@media (max-width: 860px) {
  .stats-main .stat-value { font-size: 20px; }
  .ms-bar-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; }
  .ms-bar-row .v { white-space: nowrap; }
  .ms-bar-row .progress { grid-column: 1 / -1; grid-row: 2; }
}
