:root {
  --bg: #f4f5f7; --card: #fff; --text: #1b1f24; --muted: #6b7280; --line: #e2e5ea;
  --accent: #1f5fbf; --accent-dark: #174a97; --danger: #b42318; --ok: #15803d;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header.top { display: flex; align-items: center; gap: 24px; padding: 10px 24px; background: var(--card); border-bottom: 1px solid var(--line); }
header.top .brand img { height: 34px; display: block; }
header.top nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
header.top nav a { padding: 8px 12px; border-radius: 6px; color: var(--text); }
header.top nav a.active, header.top nav a:hover { background: #eaf0fb; color: var(--accent-dark); text-decoration: none; }
header.top .who { font-size: 14px; white-space: nowrap; }
main { max-width: 1100px; margin: 24px auto; padding: 0 16px 48px; }
h1 { font-size: 24px; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 0 0 10px; }
h2.section { margin: 24px 0 10px; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0; }
.hl { color: #b45309; font-weight: 600; }
.ok-text { color: var(--ok); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.crumbs { font-size: 14px; color: var(--muted); margin: 0 0 12px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.row-between.wrap { flex-wrap: wrap; align-items: center; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn, button { display: inline-block; padding: 9px 16px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font-size: 15px; cursor: pointer; font-family: inherit; }
.btn:hover, button:hover { background: var(--accent-dark); text-decoration: none; }
.btn.secondary, button.secondary { background: #fff; color: var(--accent); }
.btn.secondary:hover, button.secondary:hover { background: #eaf0fb; }
button.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
button.danger:hover { background: #fdecea; }
button.small, .btn.small { padding: 5px 10px; font-size: 13px; }
button.link { background: none; border: none; color: var(--accent); padding: 2px 4px; }
button.link:hover { background: #eaf0fb; }
button.link:disabled { color: #c4c9d1; cursor: default; background: none; }
button.link.danger { color: var(--danger); }
form.inline { display: inline; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
.card.empty { text-align: center; color: var(--muted); padding: 32px; }
label { display: block; font-size: 14px; color: #374151; margin: 8px 0; }
label.check { display: flex; gap: 8px; align-items: center; }
input[type=text], input[type=search], input[type=password], textarea, select {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid #cfd4dc; border-radius: 6px; font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
}
textarea { resize: vertical; }
.form button[type=submit] { margin-top: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 20px; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.flash.error { background: #fdecea; color: var(--danger); border: 1px solid #f5c2bd; }
.flash.ok { background: #e7f6ec; color: #14532d; border: 1px solid #b7e1c3; }
code { background: #eef0f3; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
code.big { font-size: 20px; padding: 4px 10px; letter-spacing: 1px; user-select: all; }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; vertical-align: middle; background: #e5e7eb; color: #374151; white-space: nowrap; }
.badge.warn { background: #fef3c7; color: #92400e; }
.st-neu { background: #dbeafe; color: #1e3a8a; }
.st-rueckfrage { background: #fef3c7; color: #92400e; }
.st-geplant { background: #ede9fe; color: #5b21b6; }
.st-in_arbeit { background: #ffedd5; color: #9a3412; }
.st-test { background: #cffafe; color: #155e75; }
.st-umgesetzt { background: #dcfce7; color: #14532d; }
.st-abgelehnt { background: #f3f4f6; color: #6b7280; }
.badge.st-abgelehnt { text-decoration: line-through; }
.mst-konzept { background: #f3f4f6; color: #4b5563; }
.mst-entwicklung { background: #ffedd5; color: #9a3412; }
.mst-test { background: #ede9fe; color: #5b21b6; }
.mst-live { background: #dcfce7; color: #14532d; }
.mst-pausiert { background: #f3f4f6; color: #9ca3af; }
.kind-fehler { background: #fee2e2; color: #991b1b; }
.kind-frage { background: #e0f2fe; color: #075985; }
.prio-hoch { background: #fee2e2; color: #991b1b; }

/* Fortschritt */
.progress { display: flex; height: 6px; border-radius: 3px; background: #eceef1; overflow: hidden; margin: 10px 0 8px; }
.progress .seg { display: block; height: 100%; }
.progress .seg.st-umgesetzt { background: #22c55e; }
.progress .seg.st-test { background: #22d3ee; }
.progress .seg.st-in_arbeit { background: #fb923c; }
.progress .seg.st-geplant { background: #a78bfa; }
.stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: #374151; }

/* Projektliste */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 24px; }
.project-card { display: block; color: var(--text); margin: 0; transition: border-color .15s; }
.project-card:hover { border-color: var(--accent); text-decoration: none; }
.project-card.archived { opacity: .6; }
.project-card h2 { margin: 0; }

/* Module */
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 16px; }
.module-card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; color: var(--text); }
.module-card:hover { border-color: var(--accent); text-decoration: none; }
.module-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: #f7faff; }
.module-card .progress { margin: 8px 0 6px; }
.module-desc .pre { margin-top: 6px; color: #374151; }

/* Liste */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.tabs a { padding: 6px 11px; border-radius: 6px; color: var(--text); font-size: 14px; }
.tabs a:hover { background: #e9ecf0; text-decoration: none; }
.tabs a.active { background: #dfe3e8; font-weight: 600; }
.search { display: flex; gap: 6px; }
.search input, .search select { margin: 0; width: auto; padding: 6px 10px; font-size: 14px; }
.search input { width: 200px; }
table.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
table.list th, table.list td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { background: #f9fafb; font-weight: 600; font-size: 13px; color: var(--muted); }
table.list tr:last-child td { border-bottom: none; }
table.list td.nr, table.list th.nr { width: 44px; text-align: right; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f7f9fc; }
table.items td a { color: var(--text); font-weight: 500; }

/* Eintrag */
.item-layout { display: grid; grid-template-columns: 1fr 290px; gap: 20px; align-items: start; }
.item-layout h1 { font-size: 21px; }
.meta { margin-bottom: 14px; }
.desc { line-height: 1.5; }
.note { padding: 10px 12px; border-radius: 6px; margin: 0 0 14px; }
.timeline-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.comment { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.comment.admin { border-left: 3px solid var(--accent); }
.comment .pre { margin-top: 4px; line-height: 1.45; }
.event { font-size: 14px; padding: 2px 4px; }
.event-body { margin: 4px 0 0 0; padding: 8px 12px; background: #fafbfc; border-left: 3px solid var(--line); }
.atts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.att { display: flex; align-items: flex-start; gap: 4px; }
.att img { max-width: 220px; max-height: 160px; border: 1px solid var(--line); border-radius: 6px; display: block; }
.file-inline { font-size: 13px; }
.status-buttons { display: flex; flex-direction: column; gap: 2px; }
.status-opt { display: flex; align-items: center; gap: 8px; margin: 3px 0; cursor: pointer; }
.danger-zone { text-align: right; }

/* Einstellungen */
.module-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.module-row .order { display: flex; flex-direction: column; }
.module-row textarea { margin-top: 6px; font-size: 14px; }
.module-row .row-actions { display: flex; flex-direction: column; gap: 6px; }
.grid-mod { display: grid; grid-template-columns: 1fr 170px auto; gap: 10px; align-items: center; }
.grid-mod input, .grid-mod select { margin: 0; }
.module-new { border-top: 1px solid var(--line); padding-top: 14px; }

/* Login */
body.login { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { width: 360px; max-width: 92vw; padding: 28px; }
.login-card h1 { text-align: center; font-size: 20px; margin: 12px 0 16px; }
.login-logo { display: block; height: 44px; margin: 0 auto; }
.login-card button { width: 100%; margin-top: 12px; }

/* Unternavigation Projekt */
.nav-project { padding: 8px 4px; font-weight: 600; color: var(--muted); }
.subnav { background: var(--card); border-bottom: 1px solid var(--line); }
.subnav-inner { max-width: 1100px; margin: 0 auto; padding: 0 16px; display: flex; gap: 2px; overflow-x: auto; }
.subnav a { padding: 11px 14px; color: var(--text); border-bottom: 2px solid transparent; white-space: nowrap; font-size: 14.5px; }
.subnav a:hover { text-decoration: none; background: #f5f7fa; }
.subnav a.active { border-bottom-color: var(--accent); color: var(--accent-dark); font-weight: 600; }
.subnav a.right { margin-left: auto; color: var(--muted); }
.count { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 9px; background: #f59e0b; color: #fff; font-size: 11.5px; font-weight: 700; text-align: center; line-height: 18px; }
.tabs a .count { background: #9ca3af; }
.checks-row { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 8px; }
table.list.plain { border: none; }
table.list.plain td, table.list.plain th { padding: 6px 8px; }
input[type=month], input[type=date] { display: block; width: 100%; margin-top: 4px; padding: 7px 10px; border: 1px solid #cfd4dc; border-radius: 6px; font-size: 15px; font-family: inherit; }
td input[type=month], td select { margin: 0; }

/* Klärungen */
.q-mark { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; background: #fef3c7; color: #92400e; align-items: center; justify-content: center; font-size: 16px; vertical-align: 2px; }
.badge.q.st-neu { background: #dcfce7; color: #14532d; }
.badge.q.st-umgesetzt { background: #e5e7eb; color: #374151; }
.comment.internal { background: #fffbeb; border-style: dashed; }
.internal-badge { background: #fde68a; color: #78350f; }
.changes-ref .change-line { margin: 4px 0; }

/* Zeitplan */
.gantt-wrap { overflow-x: auto; padding: 14px; }
.gantt { display: grid; grid-auto-rows: minmax(52px, auto); position: relative; min-width: 600px; }
.g-head { font-size: 12px; color: var(--muted); text-align: center; padding: 4px 0 8px; border-bottom: 1px solid var(--line); grid-row: 1; min-height: 0; }
.g-head.g-year { font-weight: 700; color: var(--text); }
.g-label { grid-column: 1; padding: 8px 10px 8px 0; font-size: 14px; border-bottom: 1px solid #f0f2f5; }
.g-label a { color: var(--text); }
.g-cell { border-left: 1px solid #f0f2f5; border-bottom: 1px solid #f0f2f5; }
.g-now { background: #f2f7ff; }
.g-head.g-now { color: var(--accent-dark); font-weight: 700; }
.g-bar { position: relative; align-self: center; height: 30px; margin: 0 3px; border-radius: 6px; overflow: hidden; z-index: 1; display: flex; align-items: center; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.g-bar.mst-konzept { background: #e5e7eb; } .g-bar.mst-entwicklung { background: #fed7aa; } .g-bar.mst-test { background: #ddd6fe; }
.g-bar.mst-live { background: #bbf7d0; } .g-bar.mst-pausiert { background: repeating-linear-gradient(45deg, #f3f4f6, #f3f4f6 6px, #e5e7eb 6px, #e5e7eb 12px); }
.sw.mst-konzept { background: #e5e7eb; } .sw.mst-entwicklung { background: #fed7aa; } .sw.mst-test { background: #ddd6fe; } .sw.mst-live { background: #bbf7d0; } .sw.mst-pausiert { background: #e5e7eb; }
.g-fill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(0,0,0,.12); }
.g-text { position: relative; padding: 0 9px; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-none { align-self: center; padding-left: 8px; z-index: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.sw { display: inline-block; width: 14px; height: 10px; border-radius: 3px; }
.sw.now { background: #dbe8ff; }

/* Pflichtenheft */
.spec-layout { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
.spec-toc { padding: 8px; position: sticky; top: 12px; }
.spec-toc a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; color: var(--text); }
.spec-toc a:hover { background: #f3f5f8; text-decoration: none; }
.spec-toc a.active { background: #eaf0fb; color: var(--accent-dark); font-weight: 600; }
.spec-toc .legend { flex-direction: column; gap: 4px; padding: 8px 10px 4px; margin: 8px 0 0; border-top: 1px solid var(--line); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.approved { background: #22c55e; } .dot.draft { background: #cbd5e1; } .dot.changed { background: #f59e0b; } .dot.empty { background: none; border: 1px dashed #cbd5e1; }
.spec-head h2 { margin: 0; }
.approval { margin-top: 12px; padding: 9px 12px; border-radius: 6px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.approval.ok { background: #e7f6ec; color: #14532d; }
.approval.draft { background: #f3f4f6; color: #374151; }
.approval.changed { background: #fef3c7; color: #78350f; }
.markdown { line-height: 1.6; overflow-wrap: anywhere; }
.markdown h1 { font-size: 22px; margin: 18px 0 8px; } .markdown h2 { font-size: 19px; margin: 22px 0 8px; } .markdown h3 { font-size: 16px; margin: 18px 0 6px; }
.markdown > :first-child { margin-top: 0; }
.markdown table { border-collapse: collapse; margin: 10px 0; width: 100%; font-size: 14px; display: block; overflow-x: auto; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; vertical-align: top; }
.markdown th { background: #f9fafb; }
.markdown blockquote { margin: 10px 0; padding: 4px 14px; border-left: 3px solid #cbd5e1; color: #4b5563; }
.markdown pre { background: #f6f8fa; padding: 10px; border-radius: 6px; overflow-x: auto; }
.markdown ul, .markdown ol { padding-left: 24px; }
details > summary { cursor: pointer; }
details.card[open] > summary { margin-bottom: 10px; }
.diff { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 6px; }
.diff div { padding: 1px 10px; }
.diff .d-add { background: #e6ffec; } .diff .d-add::before { content: "+ "; color: #15803d; }
.diff .d-del { background: #ffebe9; text-decoration: line-through; color: #8a1c13; } .diff .d-del::before { content: "− "; }
.diff .d-ctx { color: #6b7280; } .diff .d-ctx::before { content: "  "; }
.diff .d-hunk { color: #9ca3af; background: #f6f8fa; }
textarea.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13.5px; line-height: 1.5; }

/* Änderungen */
.grid-change { display: grid; grid-template-columns: 150px 130px 1fr 1fr 1fr; gap: 0 12px; }
.day h3 { margin: 0 0 8px; font-size: 15px; color: var(--muted); }
ul.changes { list-style: none; margin: 0; padding: 0; }
ul.changes li { display: grid; grid-template-columns: 88px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid #f0f2f5; }
ul.changes li:first-child { border-top: none; }
ul.changes .badge { justify-self: start; align-self: start; margin-top: 2px; }
.change-body { line-height: 1.5; }
.ch-ADD { background: #dcfce7; color: #14532d; } .ch-IMP { background: #dbeafe; color: #1e3a8a; } .ch-FIX { background: #fee2e2; color: #991b1b; } .ch-DOC { background: #f3f4f6; color: #4b5563; }

@media (max-width: 800px) {
  .spec-layout { grid-template-columns: 1fr; }
  .spec-toc { position: static; }
  .grid-change { grid-template-columns: 1fr 1fr; }
  ul.changes li { grid-template-columns: 1fr; gap: 2px; }
  .item-layout, .grid2, .grid3 { grid-template-columns: 1fr; }
  .grid-mod { grid-template-columns: 1fr 1fr; }
  header.top { flex-wrap: wrap; gap: 8px 16px; padding: 10px 16px; }
  .hide-sm { display: none; }
  .search { width: 100%; }
  .search input { flex: 1; width: auto; }
}
