:root {
  --bg: #f6f7fb; --surface: #fff; --surface2: #f0f2f8; --text: #1b1e28; --muted: #6b7185;
  --border: #e3e6ef; --accent: #5b6cff; --accent-soft: #eceeff; --claude: #c8633f; --claude-soft: #fbeee8;
  --ok: #1f9d55; --ok-soft: #e5f6ec; --warn: #c27c0e; --warn-soft: #fdf3e1; --danger: #d93b3b; --danger-soft: #fdeaea;
  --radius: 10px; --shadow: 0 1px 2px rgba(20,24,40,.06), 0 1px 8px rgba(20,24,40,.04);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318; --surface: #1a1d24; --surface2: #22262f; --text: #e7e9ef; --muted: #9096a8;
    --border: #2c313c; --accent: #7d8bff; --accent-soft: #252a4a; --claude: #f0916b; --claude-soft: #3a261e;
    --ok: #4cc47f; --ok-soft: #173424; --warn: #f0b04a; --warn-soft: #3a2d14; --danger: #ff6b6b; --danger-soft: #3d1c1c;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0; line-height: 1.25; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 1.2rem 0 .4rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; background: var(--surface2); padding: .1em .35em; border-radius: 5px; }
pre code { display: block; padding: .8em; overflow-x: auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: .6rem; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.inline { display: inline; }
[hidden] { display: none !important; }

/* Formulare */
label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--muted); font-weight: 500; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: .5rem .65rem; width: 100%;
}
input[type=checkbox], input[type=radio] { width: auto; }
input[type=color] { padding: .15rem; height: 2.3rem; width: 4rem; }
textarea { resize: vertical; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.row input, .row select { width: auto; }
.row input.grow { width: 100%; }
input.short { width: 6rem !important; }
.check-label { flex-direction: row; align-items: center; gap: .5rem; color: var(--text); }
button, .button {
  font: inherit; font-weight: 500; font-size: .9rem; cursor: pointer; border-radius: 8px; padding: .5rem .9rem;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); display: inline-flex;
  align-items: center; gap: .35rem; text-decoration: none; white-space: nowrap;
}
button:hover, .button:hover { background: var(--surface2); text-decoration: none; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.primary:hover { background: var(--accent); filter: brightness(1.08); }
.danger { color: var(--danger); border-color: var(--danger); }
.danger:hover { background: var(--danger-soft); }
.danger-text { color: var(--danger) !important; }
button.small, .button.small { padding: .3rem .6rem; font-size: .8rem; }
button.link { background: none; border: none; padding: 0; color: var(--muted); font-size: inherit; }
button.link:hover { color: var(--text); background: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 8px; color: var(--muted); font-size: 1.1rem; }
.icon-btn:hover { background: var(--surface2); color: var(--text); text-decoration: none; }

/* Layout */
.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 1rem .75rem; display: flex; flex-direction: column; gap: .5rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.1rem; color: var(--text); padding: .2rem .5rem .6rem; }
.brand:hover { text-decoration: none; }
.search input { padding: .4rem .6rem; font-size: .9rem; background: var(--surface2); border-color: transparent; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a { display: flex; align-items: center; gap: .55rem; padding: .4rem .6rem; border-radius: 7px; color: var(--text); font-size: .92rem; }
.nav a:hover { background: var(--surface2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.archived { opacity: .55; }
.nav-head { display: flex; align-items: center; justify-content: space-between; margin-top: .8rem; padding: 0 .3rem 0 .6rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.sidebar-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding: .6rem .5rem 0; border-top: 1px solid var(--border); font-size: .88rem; }
.dot { width: .65rem; height: .65rem; border-radius: 50%; background: var(--accent); flex: none; }
.dot.big { width: .9rem; height: .9rem; }
.count { font-size: .72rem; background: var(--surface2); color: var(--muted); border-radius: 99px; padding: .05rem .45rem; font-weight: 600; }
.count.q { background: var(--warn-soft); color: var(--warn); }
.main { padding: 1.6rem 2rem 4rem; max-width: 1180px; width: 100%; }
.menu-btn { display: none; }
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }

.page-head { margin-bottom: 1.1rem; display: flex; flex-direction: column; gap: .4rem; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .5rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card.narrow { max-width: 560px; }
.card.highlight { border-color: var(--accent); }
.card.auth { width: 100%; max-width: 380px; padding: 1.8rem; }
.card.auth.wide { max-width: 460px; }
.auth-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.2rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0 1rem; }
.alert { padding: .6rem .8rem; border-radius: 8px; margin: 0 0 1rem; font-size: .92rem; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.empty { color: var(--muted); padding: 1.5rem 0; text-align: center; }

/* Tabs & Filter */
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: .55rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; align-items: center; gap: .4rem; font-weight: 500; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.filters { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip { padding: .25rem .7rem; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: .85rem; display: inline-flex; gap: .3rem; align-items: center; }
.chip:hover { text-decoration: none; background: var(--surface2); }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.filters select, .filters input { padding: .35rem .55rem; font-size: .88rem; }
.quick-add { margin-bottom: .6rem; }
.quick-add input { padding: .65rem .8rem; border-style: dashed; }
.quick-add.small input { padding: .4rem .6rem; font-size: .9rem; }

/* Todo-Liste */
.todo-list { list-style: none; margin: 0; padding: 0; }
.group .todo-list, .review-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card .todo-list { border: none; }
.todo-row { display: flex; align-items: flex-start; gap: .7rem; padding: .6rem .8rem; border-bottom: 1px solid var(--border); }
.todo-row:last-child { border-bottom: none; }
.card .todo-row { padding-left: 0; padding-right: 0; }
.todo-row:hover { background: color-mix(in srgb, var(--surface2) 50%, transparent); }
.todo-row.done .title { color: var(--muted); text-decoration: line-through; }
.todo-main { flex: 1; min-width: 0; color: var(--text); display: flex; flex-direction: column; gap: .15rem; }
.todo-main:hover { text-decoration: none; }
.todo-main:hover .title { color: var(--accent); }
.line1 { display: flex; gap: .5rem; align-items: baseline; }
.title { font-weight: 500; overflow-wrap: anywhere; }
.key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; color: var(--accent); background: var(--accent-soft); padding: .05rem .4rem; border-radius: 5px; font-weight: 600; white-space: nowrap; }
.key.big { font-size: 1rem; padding: .15rem .55rem; }
.meta { display: flex; flex-wrap: wrap; gap: .35rem .55rem; font-size: .78rem; color: var(--muted); align-items: center; }
.tag { background: var(--surface2); padding: 0 .4rem; border-radius: 5px; }
.tag.model { color: var(--accent); }
.tag.hash { background: none; color: var(--accent); padding: 0; }
.proj { font-weight: 600; color: var(--text); }
.who.claude { color: var(--claude); font-weight: 600; }
.due.overdue { color: var(--danger); font-weight: 600; }
.due.today { color: var(--warn); font-weight: 600; }
dd.overdue { color: var(--danger); font-weight: 600; }
.prio { font-weight: 600; }
.prio.p1 { color: var(--danger); }
.prio.p2 { color: var(--warn); }
.badge { font-size: .74rem; padding: .08rem .5rem; border-radius: 99px; font-weight: 600; background: var(--surface2); color: var(--muted); white-space: nowrap; }
.badge.st-in_arbeit { background: var(--claude-soft); color: var(--claude); }
.badge.st-zu_pruefen { background: var(--warn-soft); color: var(--warn); }
.badge.st-erledigt { background: var(--ok-soft); color: var(--ok); }
.badge.st-offen { background: var(--accent-soft); color: var(--accent); }
.check { margin: 0; }
.checkbox { width: 1.15rem; height: 1.15rem; border: 2px solid var(--border); border-radius: 50%; background: var(--surface); padding: 0; margin-top: .15rem; flex: none; display: inline-block; }
button.checkbox:hover { border-color: var(--ok); background: var(--ok-soft); }
.checkbox.on { background: var(--ok); border-color: var(--ok); position: relative; }
.checkbox.on::after { content: "✓"; color: #fff; font-size: .72rem; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.checkbox.ro { opacity: .7; }
.qmark { width: 1.15rem; height: 1.15rem; border-radius: 50%; background: var(--warn-soft); color: var(--warn); font-size: .75rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; margin-top: .15rem; }
.qmark.on { background: var(--ok-soft); color: var(--ok); }

/* Abnahme */
.review-list { border: none !important; background: none !important; }
.card.review header { margin-bottom: .5rem; }
.card.review .title { font-weight: 600; color: var(--text); }
.acceptance { background: var(--surface2); border-radius: 8px; padding: .6rem .8rem; margin-bottom: .7rem; font-size: .92rem; }
.review-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.review-actions input { flex: 1; min-width: 200px; width: auto; }
.area { font-size: .78rem; color: var(--muted); }

/* Detail */
.todo-head .meta { font-size: .85rem; }
.todo-head select { width: auto; padding: .2rem .5rem; font-size: .85rem; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 1rem; align-items: start; }
.props dl { display: grid; grid-template-columns: auto 1fr; gap: .45rem .8rem; margin: 0; font-size: .9rem; }
.props dt { color: var(--muted); }
.props dd { margin: 0; }
.prose { overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose blockquote { margin: .6rem 0; padding: .1rem .9rem; border-left: 3px solid var(--border); color: var(--muted); }
.prose table { border-collapse: collapse; font-size: .9rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: .3rem .5rem; }
.prose ul.contains-task-list { list-style: none; padding-left: 1rem; }
.question { border-left: 4px solid var(--warn); }
.answer { background: var(--ok-soft); border-radius: 8px; padding: .7rem .9rem; margin: .8rem 0; }
.answer-head { font-size: .8rem; color: var(--ok); font-weight: 600; margin-bottom: .3rem; }
.answer-form summary { cursor: pointer; font-weight: 600; margin: .6rem 0; color: var(--accent); }
.choices { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.choices.row { flex-direction: row; gap: 1.2rem; }
.choice { flex-direction: row; align-items: center; gap: .5rem; color: var(--text); font-size: .95rem; font-weight: 400; }
.choice.other input { flex: 1; }
.comment { border-bottom: 1px solid var(--border); padding: .6rem 0; }
.comment.claude .comment-head strong { color: var(--claude); }
.comment-head { font-size: .85rem; margin-bottom: .2rem; }
#kommentare form { margin-top: .8rem; }
.links { list-style: none; padding: 0; margin: 0 0 .5rem; display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; }
.activity { list-style: none; padding: 0; margin: .5rem 0 0; font-size: .8rem; display: flex; flex-direction: column; gap: .3rem; }
details > summary { cursor: pointer; }
h2.inline { display: inline; }

.edit-form .form-grid, form.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .9rem; margin-bottom: 1rem; }
.span2 { grid-column: 1 / -1; }

.table { width: 100%; border-collapse: collapse; font-size: .9rem; margin-bottom: .8rem; }
.table th, .table td { text-align: left; padding: .45rem .3rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 500; font-size: .8rem; }
.table .ua { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline-list { display: flex; gap: 1rem; list-style: none; padding: 0; flex-wrap: wrap; }

.qr { display: flex; justify-content: center; margin: 1rem 0; }
.qr svg { border-radius: 8px; }
.secret { word-break: break-all; }
.code-input { font-size: 1.4rem; letter-spacing: .3em; text-align: center; font-family: ui-monospace, Menlo, monospace; }
.codes { columns: 2; list-style: none; padding: 0; }
.codes li { margin: .3rem 0; }
.codes code { font-size: 1rem; }

@media (max-width: 900px) {
  .detail { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 20; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 30px rgba(0,0,0,.2); }
  .sidebar.open { transform: none; }
  .main { padding: 1rem 16px 3rem; }
  .menu-btn { display: inline-flex; margin-bottom: .6rem; }
  .grid2 { grid-template-columns: 1fr; }
  .filters { flex-direction: column; align-items: stretch; }
}

.token-box pre { background: var(--surface); border-radius: 6px; margin: .4rem 0; white-space: pre-wrap; word-break: break-all; }
.token-box pre code { background: none; color: var(--text); }
tr.muted td { color: var(--muted); }

.log { background: var(--surface2); border-radius: 8px; padding: .7rem .9rem; font-size: .8rem; max-height: 360px; overflow: auto; white-space: pre-wrap; }
.commit-list { margin: .4rem 0 0; padding-left: 1.1rem; }
.update-run summary { padding: .35rem 0; }
.danger-badge { background: var(--danger-soft); color: var(--danger); }
button[disabled] { opacity: .5; cursor: not-allowed; }
.user-actions[open] { min-width: 320px; }
.users td { vertical-align: top; }

/* Claude-Lauf */
.run-log { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.ev { border-radius: 10px; font-size: .92rem; }
.ev.sub { margin-left: 1.5rem; opacity: .85; }
.ev-who { font-size: .75rem; font-weight: 700; color: var(--muted); margin-bottom: .2rem; }
.ev-text { background: var(--surface); border: 1px solid var(--border); padding: .7rem .9rem; }
.ev-text .ev-who { color: var(--claude); }
.ev-user { background: var(--accent-soft); padding: .6rem .9rem; margin-left: 15%; }
.ev-user .ev-who { color: var(--accent); }
.ev-thinking { color: var(--muted); padding: 0 .9rem; font-size: .85rem; }
.ev-tool { background: var(--surface2); padding: .35rem .8rem; }
.ev-tool summary { display: flex; gap: .6rem; align-items: baseline; cursor: pointer; list-style: none; }
.ev-tool summary::before { content: "▸"; color: var(--muted); }
.ev-tool[open] summary::before { content: "▾"; }
.ev-tool.has-error .tool-name { color: var(--danger); }
.tool-name { font-family: ui-monospace, Menlo, monospace; font-size: .8rem; font-weight: 700; color: var(--claude); white-space: nowrap; }
.tool-arg { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ev pre, .diff, .cmd { font-family: ui-monospace, Menlo, monospace; font-size: .78rem; white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto; margin: .4rem 0; padding: .5rem .6rem; background: var(--surface); border-radius: 6px; }
.diff .del { color: var(--danger); display: block; }
.diff .add { color: var(--ok); display: block; }
.ev-result.err pre { color: var(--danger); }
.ev-done { color: var(--ok); font-size: .82rem; padding: .2rem .9rem; }
.ev-info { color: var(--muted); font-size: .82rem; padding: .1rem .9rem; }
.ev-error { background: var(--danger-soft); color: var(--danger); padding: .6rem .9rem; }
.run-input { position: sticky; bottom: 0; background: var(--bg); padding: .6rem 0 1rem; display: flex; flex-direction: column; gap: .5rem; border-top: 1px solid var(--border); }
.badge.run-laeuft, .badge.run-startet { background: var(--claude-soft); color: var(--claude); }
.badge.run-bereit { background: var(--warn-soft); color: var(--warn); }
.badge.run-fertig { background: var(--ok-soft); color: var(--ok); }
.badge.run-fehlgeschlagen { background: var(--danger-soft); color: var(--danger); }
.claude-start textarea { font-size: .88rem; }
.run-restart { margin-bottom: .8rem; }
.run-restart select { width: auto; padding: .3rem .5rem; font-size: .85rem; }
.file-btn { cursor: pointer; }
.ev-file { background: var(--ok-soft); padding: .6rem .9rem; font-weight: 500; }
.key.num { background: var(--surface2); color: var(--muted); }
.chat-head { margin-bottom: .8rem; }
.badge.run-ruht { background: var(--surface2); color: var(--muted); }
.run-input select { width: auto; padding: .35rem .5rem; font-size: .85rem; }
.goal { background: var(--accent-soft); border-radius: 10px; padding: .6rem .9rem; font-size: .92rem; margin-top: .3rem; }
.goal-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.section-title { font-size: 1rem; margin: 1.2rem 0 .2rem; display: flex; align-items: center; gap: .5rem; }
.claude-section .section-title { color: var(--claude); }
.move-form { margin: .5rem 0; }
.move-form select { width: auto; font-size: .85rem; padding: .3rem .5rem; }
.sidebar-version { font-size: .72rem; color: var(--muted); padding: .3rem .5rem 0; }
.list-icon { width: 1.3rem; text-align: center; font-size: 1rem; line-height: 1; flex: none; }
.list-icon.big { font-size: 1.6rem; width: auto; }
.icon-grid { display: flex; flex-wrap: wrap; gap: .35rem; }
.icon-choice { flex-direction: row; cursor: pointer; }
.icon-choice input { position: absolute; opacity: 0; pointer-events: none; }
.icon-choice span { display: inline-flex; align-items: center; justify-content: center; min-width: 2.3rem; height: 2.3rem; padding: 0 .4rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: 1.2rem; color: var(--text); }
.icon-choice.auto span { font-size: .8rem; font-weight: 600; }
.icon-choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); }
.icon-choice input:focus-visible + span { outline: 2px solid var(--accent); }
.list-edit { margin-top: .4rem; }
.advanced summary { cursor: pointer; }
.advanced .sub { border-top: 1px solid var(--border); padding-top: 1rem; margin-top: 1rem; }
tr.highlight-row td { background: var(--ok-soft); }
.activity { display: flex; align-items: center; gap: .6rem; color: var(--claude); font-size: .9rem; padding: .4rem .2rem .8rem; }
.spinner { width: 1rem; height: 1rem; border: 2px solid var(--claude-soft); border-top-color: var(--claude); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.question-admin { margin: .6rem 0; gap: 1rem; }
.question-admin select { width: auto; padding: .25rem .5rem; font-size: .85rem; }
.alert.withdrawn { background: var(--surface2); color: var(--muted); }
.q-history { margin-top: .8rem; }
