:root {
  --bg: #131218;
  --panel: #1b1a22;
  --panel-2: #23212c;
  --line: #322f3f;
  --text: #ecebf2;
  --muted: #a09db0;
  --accent: #8b5cf6;
  --accent-strong: #7c3aed;
  --accent-soft: rgba(139, 92, 246, .16);
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --info: #7dd3fc;
  --radius: 10px;
  --mono: "Cascadia Code", Consolas, ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 "Segoe UI", system-ui, sans-serif; }
a { color: #c4b5fd; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; }
p { margin: 0 0 .6rem; }
code, pre, .mono { font-family: var(--mono); font-size: .85rem; }
pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.boot { padding: 3rem; text-align: center; color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Grundaufbau */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 1rem .75rem; display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .6rem; padding: 0 .4rem; font-weight: 700; }
.brand img { width: 30px; height: 30px; }
.brand span { display: block; font-size: .75rem; font-weight: 400; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav h3 { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .7rem .6rem .25rem; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: .45rem .6rem; border-radius: 7px; color: var(--text); }
.nav a:hover { background: var(--panel-2); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: #ddd6fe; font-weight: 600; }
.count { background: var(--accent-strong); color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 .45rem; font-weight: 600; }
.me { margin-top: auto; border-top: 1px solid var(--line); padding: .8rem .4rem 0; font-size: .88rem; }
.main { padding: 1.4rem 1.6rem 3rem; min-width: 0; }
.head { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; }
.head p { margin: .2rem 0 0; }
.menu-btn { display: none; }

/* Bausteine */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.panel > h2 { margin-bottom: .7rem; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.grow { flex: 1 1 200px; }
.grid { display: grid; gap: .8rem; }
.stats { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); margin-bottom: 1rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; color: var(--text); display: block; }
.stat:hover { border-color: var(--accent); text-decoration: none; }
.stat b { display: block; font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.alert b { color: var(--bad); }
.cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; display: flex; flex-direction: column; gap: .45rem; color: var(--text); }
.card:hover { border-color: var(--accent); text-decoration: none; }
.card .desc { color: var(--muted); font-size: .88rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }

.badge { display: inline-block; border-radius: 999px; padding: .05rem .55rem; font-size: .76rem; font-weight: 600; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.badge.v { color: #ddd6fe; border-color: rgba(139, 92, 246, .5); background: var(--accent-soft); font-family: var(--mono); }
.badge.ok { color: var(--ok); border-color: rgba(74, 222, 128, .4); }
.badge.warn { color: var(--warn); border-color: rgba(251, 191, 36, .4); }
.badge.bad { color: var(--bad); border-color: rgba(248, 113, 113, .45); }
.badge.info { color: var(--info); border-color: rgba(125, 211, 252, .4); }

button, .btn { font: inherit; cursor: pointer; border-radius: 7px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); padding: .42rem .8rem; }
button:hover, .btn:hover { border-color: var(--accent); text-decoration: none; }
button.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--accent); }
button.danger { color: var(--bad); }
button.link { border: 0; background: none; color: #c4b5fd; padding: 0; }
button.sm { padding: .2rem .55rem; font-size: .84rem; }
button:disabled { opacity: .5; cursor: not-allowed; }

label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .2rem; }
input, select, textarea { font: inherit; width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 7px; padding: .45rem .6rem; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
textarea { min-height: 5.5rem; resize: vertical; }
.field { margin-bottom: .75rem; }
.check { display: flex; gap: .5rem; align-items: center; color: var(--text); font-size: .92rem; margin-bottom: .35rem; }
.hint { font-size: .82rem; color: var(--muted); margin-top: .2rem; }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.path { font-family: var(--mono); font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }

dl.kv { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: .45rem 1rem; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .88rem; }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }

.tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); padding: .5rem .8rem; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.steps { display: flex; flex-wrap: wrap; gap: .3rem; list-style: none; padding: 0; margin: 0; }
.steps li { font-size: .8rem; padding: .2rem .65rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.steps li.done { color: var(--ok); border-color: rgba(74, 222, 128, .35); }
.steps li.now { color: #fff; background: var(--accent-strong); border-color: var(--accent-strong); font-weight: 600; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: .8rem; padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.feed li:last-child { border-bottom: 0; }
.feed time { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.feed .fehler { color: var(--bad); }
.feed .konflikt, .feed .pruefen { color: var(--warn); }
.empty { color: var(--muted); padding: .6rem 0; }
.todos { list-style: none; margin: 0; padding: 0; }
.todo { display: flex; gap: .7rem; align-items: flex-start; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.todo:last-child { border-bottom: 0; }
.todo input[type="checkbox"] { width: 1.15rem; height: 1.15rem; margin-top: .2rem; flex: none; }
.todo label { color: var(--text); font-size: 1rem; margin: 0; cursor: pointer; overflow-wrap: anywhere; }
.todo.done label { color: var(--muted); text-decoration: line-through; }
a.badge:hover { border-color: var(--accent); text-decoration: none; }
summary { cursor: pointer; }
.notice { border: 1px solid rgba(139, 92, 246, .45); background: var(--accent-soft); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1rem; }
.notice.warn { border-color: rgba(251, 191, 36, .45); background: rgba(251, 191, 36, .08); }
.code { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: .7rem .8rem; max-height: 60vh; overflow: auto; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .8rem; }
.split > div { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: .7rem .8rem; }

/* Anmeldung */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.auth form { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1.6rem; }
.auth .brand { padding: 0; margin-bottom: 1rem; }
.auth button { width: 100%; margin-top: .4rem; }
.error { color: var(--bad); font-size: .9rem; min-height: 1.3rem; }

/* Dialog & Meldungen */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(760px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); }
dialog::backdrop { background: rgba(8, 7, 12, .7); }
dialog header { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
dialog .body { padding: 1rem 1.1rem; }
dialog footer { display: flex; justify-content: flex-end; gap: .5rem; padding: .8rem 1.1rem; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--panel); }
html:has(dialog[open]) { overflow: hidden; }
#toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 50; max-width: min(420px, calc(100vw - 2rem)); }
.toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 8px; padding: .6rem .9rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
.toast.bad { border-left-color: var(--bad); }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(8, 7, 12, .6); }
  .menu-btn { display: inline-block; }
  .main { padding: 1rem .9rem 3rem; }
  dl.kv { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
  dl.kv dd { margin-bottom: .5rem; }
  .feed li { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
