:root {
  --bg: #f4f6f8; --panel: #ffffff; --ink: #17212b; --muted: #5d6b78; --line: #dfe4ea; --line-2: #eef1f4;
  --brand: #0f766e; --brand-ink: #ffffff; --brand-soft: #e6f4f2;
  --warn: #b45309; --warn-soft: #fef3e2; --bad: #b91c1c; --bad-soft: #fdecec; --ok: #15803d; --ok-soft: #e8f6ec;
  --info-soft: #e8f0fb; --info: #1d4ed8;
  --radius: 8px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; font-size: 14px; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; font-weight: 600; }
h2 { font-size: 15px; margin: 0 0 10px; font-weight: 600; }
h3 { font-size: 13px; margin: 0 0 8px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.tabnum { font-variant-numeric: tabular-nums; }

/* Layout */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: #0e2a2f; color: #cfe3e1; display: flex; flex-direction: column; padding: 14px 10px; position: sticky; top: 0; height: 100vh; }
.side .logo { color: #fff; font-weight: 600; font-size: 15px; padding: 6px 10px 18px; display: flex; gap: 10px; align-items: center; }
.side .logo .mark { width: 28px; height: 28px; border-radius: 7px; background: var(--brand); display: grid; place-items: center; font-weight: 700; }
.side nav a { display: flex; align-items: center; justify-content: space-between; color: #cfe3e1; padding: 9px 12px; border-radius: 6px; margin-bottom: 2px; }
.side nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.side nav a.active { background: rgba(255,255,255,.13); color: #fff; }
.side nav .badge { background: #f59e0b; color: #1f1300; }
.side .foot { margin-top: auto; padding: 10px; font-size: 12px; border-top: 1px solid rgba(255,255,255,.1); }
.side .foot button { color: #cfe3e1; }
.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top .grow { flex: 1; }
.content { padding: 20px 24px 60px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; display: inline-block; }
.live.on i { background: #22c55e; }
.avatars { display: inline-flex; gap: 4px; }
.av { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; border: 1px solid #cde7e3; }

/* Bausteine */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .v { font-size: 24px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 12px; }
.kpi.alert .v { color: var(--bad); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 7px 12px; border-radius: 6px; cursor: pointer; font: inherit; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.btn:hover { border-color: #c3ccd5; background: #f9fafb; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: #0c625b; }
.btn.danger { color: var(--bad); border-color: #f1c4c4; }
.btn.small { padding: 4px 8px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font: inherit; }
.link.danger { color: var(--bad); }
input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #99d5ce; border-color: var(--brand); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); }
textarea { min-height: 70px; resize: vertical; }
label.f { display: block; }
label.f span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
label.f.req span::after { content: " *"; color: var(--bad); }
label.f.dirty input, label.f.dirty select, label.f.dirty textarea { background: #fffbea; border-color: #f2c94c; }
/* Mehrfachauswahl (Kontrollkästchen) */
div.f > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 6px 0; min-height: 34px; border-radius: 6px; }
.checks label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
div.f.dirty .checks { background: #fffbea; outline: 1px solid #f2c94c; padding-left: 6px; }
.form fieldset { border: 0; padding: 0; margin: 0 0 18px; }
.form legend { font-weight: 600; margin-bottom: 8px; font-size: 13px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; }
.fields .wide { grid-column: 1 / -1; }
.ro { padding: 7px 0; min-height: 34px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.brand { background: var(--brand-soft); color: var(--brand); }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 11px; font-weight: 600; background: var(--line-2); color: var(--muted); }
[hidden] { display: none !important; }
.notice { padding: 10px 12px; border-radius: 6px; background: var(--info-soft); color: #1e3a8a; margin-bottom: 12px; }
.notice.flex { display: flex; gap: 10px; align-items: center; }
.notice.warn { background: var(--warn-soft); color: #7c3a06; }
.notice.bad { background: var(--bad-soft); color: #7f1d1d; }
.notice.ok { background: var(--ok-soft); color: #14532d; }
.empty { color: var(--muted); padding: 14px 0; }

/* Tabellen */
table.t { width: 100%; border-collapse: collapse; background: var(--panel); }
table.t th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: default; background: #fafbfc; position: sticky; top: 0; }
table.t th[data-sort] { cursor: pointer; }
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #f7faf9; }
.tablewrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; background: var(--panel); }
.progress { height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; min-width: 80px; }
.progress i { display: block; height: 100%; background: var(--brand); }

/* Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: #e9edf1; border-radius: var(--radius); padding: 8px; min-height: 120px; }
.col.drop { outline: 2px dashed var(--brand); background: var(--brand-soft); }
.col h4 { margin: 2px 4px 8px; font-size: 12px; font-weight: 600; display: flex; justify-content: space-between; color: #334155; }
.kcard { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow); }
.kcard:active { cursor: grabbing; }
.kcard .n { font-weight: 600; margin-bottom: 3px; }
.kcard .m { font-size: 12px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.kcard.paused { opacity: .65; }

/* Detail */
.dhead { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; flex-wrap: wrap; }
.dhead .title { flex: 1; min-width: 240px; }
.dhead .sub { color: var(--muted); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stepper { display: flex; gap: 4px; margin: 6px 0 16px; overflow-x: auto; }
.stepper button { flex: 1; min-width: 110px; border: 0; background: var(--line-2); color: var(--muted); padding: 8px 10px; font: inherit; font-size: 12px; cursor: pointer; text-align: left; border-radius: 4px; position: relative; }
.stepper button.done { background: var(--brand-soft); color: var(--brand); }
.stepper button.cur { background: var(--brand); color: #fff; font-weight: 600; }
.stepper button small { display: block; opacity: .8; font-weight: 400; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 9px 14px; font: inherit; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--brand); font-weight: 600; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.savebar { position: sticky; bottom: 0; background: var(--panel); border-top: 1px solid var(--line); padding: 10px 0; display: flex; gap: 8px; align-items: center; margin-top: 6px; }

/* Checkliste */
.phase { margin-bottom: 16px; }
.phase-h { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.phase-h b { flex: 0 0 auto; }
.phase-h .progress { flex: 0 0 120px; }
.ci { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: start; padding: 6px 4px; border-bottom: 1px solid var(--line-2); }
.ci.done .tt { color: var(--muted); text-decoration: line-through; }
.ci .meta { font-size: 11px; color: var(--muted); }
.ci .acts { display: flex; gap: 8px; align-items: center; }
.ci input[type=date] { padding: 2px 6px; font-size: 12px; width: 130px; }

/* Feed */
.feed .it { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.feed .it .h { display: flex; gap: 8px; font-size: 12px; color: var(--muted); align-items: center; }
.feed .it .b { margin-top: 3px; white-space: pre-wrap; }
.bars .b { display: grid; grid-template-columns: 160px 1fr 40px; gap: 8px; align-items: center; margin: 5px 0; font-size: 13px; }
.bars .b .track { background: var(--line-2); height: 14px; border-radius: 3px; overflow: hidden; }
.bars .b .track i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.cols { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.cols .c { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.cols .c .bx { width: 100%; display: flex; gap: 2px; align-items: flex-end; flex: 1; }
.cols .c .bx i { flex: 1; background: #9fd3cc; border-radius: 2px 2px 0 0; min-height: 1px; }
.cols .c .bx i.w { background: var(--brand); }
.cols .c span { font-size: 10px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 7px 0; border-bottom: 1px solid var(--line-2); display: flex; gap: 8px; align-items: center; }
ul.plain li:last-child { border-bottom: 0; }

/* Modal / Toast */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border-radius: 10px; width: min(760px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal.sm { width: min(460px, 100%); }
.modal .mh { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal .mh h2 { margin: 0; flex: 1; }
.modal .mb { padding: 16px 20px; }
.modal .mf { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: #fafbfc; position: sticky; bottom: 0; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #1f2937; color: #fff; padding: 10px 14px; border-radius: 6px; box-shadow: var(--shadow); max-width: 380px; }
.toast.err { background: var(--bad); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #0e2a2f, #134e4a); padding: 16px; }
.login .card { width: min(380px, 100%); padding: 28px; }
.login h1 { margin-bottom: 4px; }
.login form > * + * { margin-top: 12px; }

.diff td { font-size: 12px; }
.diff .mine { background: #fffbea; }
code.k { background: var(--line-2); padding: 2px 6px; border-radius: 4px; font-size: 12px; word-break: break-all; }
pre.code { background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 6px; overflow: auto; font-size: 12px; }

@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side nav { display: flex; flex-wrap: wrap; }
  .side .foot { display: none; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .top { padding: 12px 16px; }
  .bars .b { grid-template-columns: 110px 1fr 32px; }
}

/* Zwei-Faktor-Anmeldung */
ol.steps { padding-left: 20px; margin: 0; }
ol.steps > li { margin-bottom: 14px; line-height: 1.5; }
.qr { width: 200px; height: 200px; margin: 10px 0; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 4px; }
.qr svg { width: 100%; height: 100%; display: block; }
input.otp { font-family: ui-monospace, Consolas, monospace; letter-spacing: .15em; font-size: 16px; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.codes code { font-family: ui-monospace, Consolas, monospace; font-size: 15px; background: var(--line-2); padding: 6px 10px; border-radius: 4px; text-align: center; }
