/* JetBrains Mono – selbst gehostet (SIL Open Font License, siehe fonts/OFL.txt) */
@font-face { font-family: "JetBrains Mono"; src: url(fonts/jbm-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(fonts/jbm-600.woff2) format("woff2"); font-weight: 500 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(fonts/jbm-800.woff2) format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --bg: #000000;
  --bg-2: #050706;
  --panel: #080a09;
  --panel-2: #0d110f;
  --line: #17201b;
  --line-2: #22302a;
  --text: #c9d6cf;
  --bright: #eafff4;
  --muted: #5d6f66;
  --accent: #00ff9c;
  --accent-dim: #00b36d;
  --accent-glow: rgba(0, 255, 156, .35);
  --ok: #00ff9c;
  --warn: #ffb000;
  --err: #ff3b5c;
  --info: #3ad7ff;
  --violet: #b98cff;
  --radius: 3px;
  --mono: "JetBrains Mono", "Cascadia Code", "Fira Code", Consolas, ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 var(--mono);
  font-variant-ligatures: none;
  -webkit-font-smoothing: antialiased;
}
/* dezente Scanlines */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .018) 0 1px, transparent 1px 3px);
}
::selection { background: var(--accent); color: #000; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-shadow: 0 0 6px var(--accent-glow); }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .7em; color: var(--bright); font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.45rem; }
h1::before { content: "> "; color: var(--accent); }
h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .08em; }
h2::before { content: "## "; color: var(--muted); font-weight: 400; }
h3 { font-size: .9rem; }
code { background: var(--panel-2); color: var(--accent); padding: 1px 5px; border: 1px solid var(--line); border-radius: 2px; font-size: .92em; }
pre { background: #000; border: 1px solid var(--line); padding: 10px 12px; border-radius: var(--radius); overflow-x: auto; font-size: .85rem; color: var(--accent); }
pre code { background: none; border: 0; padding: 0; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }

/* Layout */
.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 10px 24px; background: rgba(0, 0, 0, .92); border-bottom: 1px solid var(--line-2);
  position: sticky; top: 0; z-index: 10; flex-wrap: wrap; backdrop-filter: blur(4px);
}
.brand { font-weight: 800; font-size: 1.05rem; color: var(--accent); display: flex; align-items: center; gap: 2px; letter-spacing: .02em; text-shadow: 0 0 10px var(--accent-glow); }
.brand:hover { text-decoration: none; }
.brand .prompt { color: var(--muted); font-weight: 400; margin-right: 6px; text-shadow: none; }
.brand .cursor { display: inline-block; width: .6em; height: 1.1em; background: var(--accent); margin-left: 3px; animation: blink 1.1s steps(1) infinite; box-shadow: 0 0 8px var(--accent-glow); }
@keyframes blink { 50% { opacity: 0; } }
.nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.nav a { color: var(--muted); padding: 5px 10px; border: 1px solid transparent; border-radius: var(--radius); }
.nav a::before { content: "./"; opacity: .5; }
.nav a:hover, .nav a.active { color: var(--accent); border-color: var(--line-2); background: var(--panel); text-decoration: none; text-shadow: none; }
.agent-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.on { background: var(--ok); box-shadow: 0 0 10px var(--ok); animation: pulse 2s ease-in-out infinite; }
.dot.off { background: var(--err); box-shadow: 0 0 8px var(--err); }
@keyframes pulse { 50% { opacity: .45; } }
main { max-width: 1280px; margin: 0 auto; padding: 26px 16px 64px; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; position: relative; }
.card::before { content: ""; position: absolute; top: -1px; left: -1px; width: 10px; height: 10px; border-top: 1px solid var(--accent-dim); border-left: 1px solid var(--accent-dim); }
.card + .card { margin-top: 14px; }
.card h2 { display: flex; align-items: center; gap: 8px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Formulare */
label { display: block; font-size: .75rem; color: var(--muted); margin: 12px 0 4px; text-transform: uppercase; letter-spacing: .07em; }
input[type=text], input[type=password], input[type=email], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; border-radius: var(--radius); border: 1px solid var(--line-2);
  background: #000; color: var(--bright); font: inherit; caret-color: var(--accent);
}
input::placeholder, textarea::placeholder { color: #36443d; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 12px var(--accent-glow); }
input:disabled { color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: .85rem; margin: 8px 0; text-transform: none; letter-spacing: 0; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); }
.hint { font-size: .75rem; color: var(--muted); margin-top: 4px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; }
form.inline { display: inline; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: #000; color: var(--text);
  font: inherit; font-size: .82rem; cursor: pointer; white-space: nowrap; transition: all .12s;
}
.btn::before { content: "["; color: var(--muted); }
.btn::after { content: "]"; color: var(--muted); }
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; text-shadow: none; box-shadow: 0 0 10px var(--accent-glow); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 700; }
.btn.primary::before, .btn.primary::after { color: rgba(0, 0, 0, .45); }
.btn.primary:hover { background: #5dffc0; color: #000; box-shadow: 0 0 16px var(--accent-glow); }
.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: var(--err); color: var(--err); box-shadow: 0 0 10px rgba(255, 59, 92, .35); }
.btn.ok { color: var(--ok); }
.btn.sm { padding: 3px 8px; font-size: .74rem; }
.btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }

/* Badges */
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 2px; font-size: .7rem; font-weight: 600;
  background: transparent; color: var(--muted); border: 1px solid var(--line-2); white-space: nowrap;
  text-transform: uppercase; letter-spacing: .05em;
}
.badge.s-proposal { color: var(--violet); border-color: #4a3470; }
.badge.s-draft { color: var(--muted); }
.badge.s-todo { color: var(--info); border-color: #155a6b; }
.badge.s-in_progress { color: var(--warn); border-color: #6b4a00; box-shadow: 0 0 8px rgba(255, 176, 0, .2); }
.badge.s-question { color: #ff7a1a; border-color: #7a3a0c; background: rgba(255, 122, 26, .08); }
.badge.s-review { color: #39e6d0; border-color: #145c54; }
.badge.s-done { color: var(--ok); border-color: #0b5c3b; }
.badge.s-failed { color: var(--err); border-color: #6b1424; }
.badge.s-rejected { color: var(--muted); text-decoration: line-through; }
.badge.paused { color: var(--warn); border-color: #6b4a00; }
.badge.t-bug { color: var(--err); }
.badge.t-story { color: var(--info); }
.badge.t-idea { color: var(--violet); }
.badge.ai { color: var(--violet); }

.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid; background: #000; }
.flash::before { content: "$ "; color: var(--muted); }
.flash.ok { border-color: #0b5c3b; color: var(--ok); }
.flash.error { border-color: #6b1424; color: var(--err); }
.callout { padding: 11px 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent); margin: 12px 0; }
.callout.warn { border-left-color: var(--warn); }
.callout.err { border-left-color: var(--err); }

/* Projektkarten */
.project-card { display: flex; flex-direction: column; gap: 10px; transition: border-color .15s, box-shadow .15s; }
.project-card:hover { border-color: var(--line-2); box-shadow: 0 0 0 1px var(--line-2), 0 0 24px rgba(0, 255, 156, .06); }
.project-card .title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.project-card .title a { color: var(--bright); font-weight: 700; font-size: 1rem; }
.project-card .title a::before { content: "~/"; color: var(--accent-dim); font-weight: 400; }
.stats { display: flex; gap: 6px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi .v { font-size: 1.9rem; font-weight: 800; color: var(--bright); line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; margin-top: 4px; }

/* Backlog */
.section { margin-bottom: 20px; }
.section > h3, .section > summary h3, .section > div > h3 { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.section h3::before { content: "//"; color: var(--accent-dim); }
.section h3 .count { color: var(--accent); }
.section h3 .count::before { content: "["; color: var(--muted); }
.section h3 .count::after { content: "]"; color: var(--muted); }
details.section > summary { cursor: pointer; list-style: none; }
details.section > summary::-webkit-details-marker { display: none; }
.item-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--panel);
  border: 1px solid var(--line); border-left: 2px solid var(--line-2); border-radius: var(--radius);
}
.item:hover { border-color: var(--line-2); border-left-color: var(--accent); background: var(--panel-2); }
.item .handle { cursor: grab; color: var(--muted); user-select: none; padding: 0 2px; }
.item .t { flex: 1; min-width: 0; }
.item .t a { color: var(--bright); font-weight: 600; }
.item .t .sub { color: var(--muted); font-size: .76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .id { color: var(--accent-dim); font-size: .76rem; font-variant-numeric: tabular-nums; }
.item.dragging { opacity: .4; }

/* Item-Details / Protokoll (Terminal) */
.prose p { margin: .4em 0; }
.prose ul { margin: .4em 0; padding-left: 1.4em; list-style: "- "; }
.prose h3, .prose h4, .prose h5 { margin: 1em 0 .4em; color: var(--accent); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
.prose h3::before, .prose h4::before, .prose h5::before { content: "# "; color: var(--muted); }
.prose strong { color: var(--bright); }
.timeline {
  display: flex; flex-direction: column; gap: 2px; max-height: 660px; overflow-y: auto;
  background: #000; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px;
}
.ev { padding: 5px 10px; border-left: 2px solid var(--line-2); font-size: .82rem; }
.ev .meta { color: #3d4c45; font-size: .7rem; }
.ev.k-log { color: var(--text); }
.ev.k-tool { border-left-color: #1d2a24; color: #6f8a7d; font-size: .76rem; }
.ev.k-tool .body::before { content: "$ "; color: var(--accent-dim); }
.ev.k-status { border-left-color: var(--info); color: var(--info); }
.ev.k-question { border-left-color: #ff7a1a; background: rgba(255, 122, 26, .06); }
.ev.k-answer { border-left-color: var(--ok); background: rgba(0, 255, 156, .04); }
.ev.k-comment { border-left-color: var(--violet); }
.ev.k-result { border-left-color: var(--ok); background: rgba(0, 255, 156, .04); }
.ev.k-error { border-left-color: var(--err); color: var(--err); background: rgba(255, 59, 92, .05); }
.ev .body { white-space: pre-wrap; word-break: break-word; }
.ev.k-result .body, .ev.k-log .body, .ev.k-question .body { white-space: normal; }
.timeline::-webkit-scrollbar { width: 8px; }
.timeline::-webkit-scrollbar-thumb { background: var(--line-2); }
dl.meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: .82rem; }
dl.meta dt { color: var(--muted); }
dl.meta dt::after { content: ":"; }
dl.meta dd { margin: 0; word-break: break-word; color: var(--bright); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at center, rgba(0, 255, 156, .05) 0%, transparent 60%), #000; }
.login-card { width: 100%; max-width: 400px; box-shadow: 0 0 40px rgba(0, 255, 156, .07); }
.login-card .boot { color: var(--muted); font-size: .75rem; margin-bottom: 18px; line-height: 1.7; }
.login-card .boot b { color: var(--accent); font-weight: 400; }
.spinner { width: 11px; height: 11px; border: 2px solid var(--warn); border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Live-Leiste und Job-Ansicht */
.livebar {
  display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center;
  padding: 7px 24px; background: #000; border-bottom: 1px solid var(--line); font-size: .78rem;
  min-height: 34px;
}
.livebar.busy { border-bottom-color: #0b5c3b; box-shadow: 0 1px 12px rgba(0, 255, 156, .08); }
.livebar .lv { display: inline-flex; align-items: center; gap: 7px; color: var(--text); min-width: 0; }
.livebar a.lv:hover { color: var(--accent); text-decoration: none; }
.livebar .lv.err { color: var(--err); }
.livebar .lv.idle { color: var(--muted); }
.spinner.ok { border-color: var(--accent); border-right-color: transparent; }
.spinner.err { border-color: var(--err); border-right-color: transparent; animation-duration: 2.5s; }
.tag { font-size: .68rem; padding: 0 6px; border: 1px solid currentColor; border-radius: 2px; text-transform: uppercase; letter-spacing: .05em; }
.tag.ok { color: var(--ok); } .tag.warn { color: var(--warn); } .tag.err { color: var(--err); }
.job { border: 1px solid var(--line); border-left: 3px solid var(--accent); background: #000; padding: 10px 14px; border-radius: var(--radius); }
.job + .job { margin-top: 8px; }
.job.warn { border-left-color: var(--warn); }
.job.err { border-left-color: var(--err); }
.job-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.job-head a { color: var(--bright); }
.job-now { margin: 8px 0; color: var(--accent); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job.warn .job-now { color: var(--warn); }
.job.err .job-now { color: var(--err); }
.job-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: .74rem; color: var(--muted); }
.job-meta b { color: var(--bright); font-weight: 600; }

select.model-select { width: auto; padding: 4px 8px; font-size: .76rem; color: var(--accent); border-color: var(--line-2); cursor: pointer; }

.cmd-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cmd { border-left: 2px solid var(--line-2); padding-left: 10px; }
.cmd-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cmd-err { color: var(--err); font-size: .78rem; margin-top: 4px; word-break: break-word; }

.empty { color: var(--muted); padding: 8px 0; font-size: .82rem; }
.empty::before { content: "∅ "; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #000; }
::-webkit-scrollbar-thumb { background: var(--line-2); border: 2px solid #000; }
