/* Root DACH Team-Tool: dunkles Design im Stil von Root */
:root {
  --bg: #09090b;
  --rail: #0d0d10;
  --side: #111114;
  --surface: #151518;
  --surface2: #1b1b20;
  --surface3: #23232a;
  --border: #26262d;
  --text: #ececf1;
  --muted: #8d8d99;
  --accent: #e5384c;
  --accent-h: #f04b5e;
  --green: #3fdc7f;
  --blue: #5b93f5;
  --amber: #f0b73a;
  --danger: #ff5468;
  --radius: 12px;
  --rail-w: 68px;
  --side-w: 268px;
}
* { 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, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; } h4 { font-size: .95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
p { margin: 0 0 .8em; }
code { background: var(--surface3); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.boot { padding: 2rem; color: var(--muted); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; }
.right { text-align: right; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: var(--rail-w) var(--side-w) minmax(0, 1fr); height: 100vh; height: 100dvh; }
.rail { background: var(--rail); border-right: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 10px; }
.rail .logo, .rail .avatar { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-weight: 700; flex: none; }
.rail .logo { background: linear-gradient(135deg, var(--accent), #b3182b); color: #fff; font-size: 1.1rem; box-shadow: 0 6px 16px rgba(229, 56, 76, .25); }
.rail .avatar { background: var(--surface3); border-radius: 50%; color: var(--text); font-size: .95rem; margin-top: auto; position: relative; }
.rail .avatar::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; background: var(--green); border: 2px solid var(--rail); border-radius: 50%; }
.side { background: var(--side); display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); }
.side-head { padding: 16px 16px 10px; display: flex; align-items: center; gap: 10px; }
.side-head strong { font-size: 1rem; }
.side-head .role { margin-left: auto; }
.nav { overflow-y: auto; padding: 4px 10px 16px; flex: 1; }
.nav-section { margin-top: 14px; }
.nav-title { display: flex; align-items: center; gap: 6px; padding: 4px 8px; color: var(--muted); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; margin: 2px 0; border-radius: 10px; color: var(--text); cursor: pointer; background: none; border: 0; font: inherit; text-align: left; }
.nav-item:hover { background: var(--surface2); text-decoration: none; }
.nav-item.active { background: var(--surface3); }
.nav-item svg { width: 20px; height: 20px; flex: none; color: var(--muted); }
.nav-item.active svg { color: var(--accent); }
.nav-item .badge { margin-left: auto; }
.side-foot { padding: 10px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.topbar { display: flex; align-items: center; gap: 12px; padding: 0 20px; height: 58px; border-bottom: 1px solid var(--border); flex: none; }
.topbar h1 { margin: 0; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.topbar .hash { color: var(--muted); font-weight: 400; }
.btn.menu-btn { display: none; }
.content { flex: 1; overflow-y: auto; padding: 22px; }
.page { max-width: 1100px; margin: 0 auto; }
.scrim { display: none; }

/* ---------- Bausteine ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat .num { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat .lbl { color: var(--muted); font-size: .85rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; min-height: 40px; }
.btn:hover { background: var(--surface3); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-h); }
.btn.danger { color: var(--danger); border-color: rgba(255, 84, 104, .4); background: transparent; }
.btn.danger:hover { background: rgba(255, 84, 104, .1); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: .85rem; border-radius: 8px; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
label > input, label > select, label > textarea { display: block; margin-top: 5px; }
input, select, textarea {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font: inherit; min-height: 42px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(229, 56, 76, .55); outline-offset: 0; border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--accent); }
.check { display: flex; gap: 10px; align-items: flex-start; color: var(--text); font-size: .95rem; margin-bottom: 10px; }
.check input { margin-top: 5px; flex: none; width: 18px; height: 18px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }

.tag, .badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--surface3); color: var(--text); white-space: nowrap; }
.badge { background: var(--accent); color: #fff; }
.tag.green { background: rgba(63, 220, 127, .14); color: var(--green); }
.tag.red { background: rgba(255, 84, 104, .14); color: var(--danger); }
.tag.amber { background: rgba(240, 183, 58, .14); color: var(--amber); }
.tag.blue { background: rgba(91, 147, 245, .14); color: var(--blue); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--surface2); }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; overflow-x: auto; border-bottom: 1px solid var(--border); }
.tab { padding: 10px 14px; background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; font-size: .93rem; }
.alert.err, .err-box { background: rgba(255, 84, 104, .1); border-color: rgba(255, 84, 104, .4); color: #ffb3bc; }
.alert.ok, .ok-box { background: rgba(63, 220, 127, .1); border-color: rgba(63, 220, 127, .4); color: #aaf0c9; }
.alert.info { background: rgba(91, 147, 245, .1); border-color: rgba(91, 147, 245, .4); color: #bcd2fb; }
.err-box, .ok-box { padding: 12px 14px; border-radius: 10px; border: 1px solid; }

.score-grid { display: grid; gap: 12px; }
.score-item { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.score-item .head { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.score-item .head strong { font-size: .95rem; }
.score-item select { max-width: 210px; }
.total-box { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.total-box .big { font-size: 2.2rem; font-weight: 800; }
.meter { height: 8px; background: var(--surface3); border-radius: 99px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--amber), var(--green)); }

.note { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.note .meta { color: var(--muted); font-size: .8rem; margin-bottom: 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.note pre, pre.plain { white-space: pre-wrap; word-wrap: break-word; font: inherit; margin: 0; }
pre.code { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; white-space: pre-wrap; word-wrap: break-word; font: .85rem/1.5 Consolas, "Courier New", monospace; margin: 8px 0; }
.copy-row { position: relative; }
.copy-row .btn { position: absolute; top: 14px; right: 8px; }

/* ---------- Markdown / Leitfaden ---------- */
.doc { max-width: 880px; }
.doc h1 { font-size: 1.7rem; }
.doc h2 { margin-top: 1.8em; padding-bottom: .3em; border-bottom: 2px solid var(--accent); font-size: 1.3rem; scroll-margin-top: 70px; }
.doc h3 { margin-top: 1.4em; color: #c9cdf7; scroll-margin-top: 70px; }
.doc ul, .doc ol { padding-left: 1.4em; }
.doc li { margin-bottom: .35em; }
.doc table { margin: 10px 0 16px; }
.doc th { background: var(--surface2); }
.doc blockquote { border-left: 3px solid var(--accent); margin: 0 0 1em; padding: .2em 1em; color: var(--muted); }
.toc { position: sticky; top: 0; }
.toc a { display: block; padding: 4px 8px; color: var(--muted); font-size: .88rem; border-radius: 6px; }
.toc a:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.toc a.sub { padding-left: 20px; font-size: .82rem; }
.guide-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 30px; }

/* ---------- Dialog ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .65); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 22px; }
.modal.wide { width: min(760px, 100%); }
.toast-wrap { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: grid; gap: 8px; }
.toast { background: var(--surface3); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); max-width: 360px; }
.toast.err { border-color: rgba(255, 84, 104, .6); }

/* ---------- Anmeldung ---------- */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 16px; background: radial-gradient(900px 500px at 50% -10%, rgba(229, 56, 76, .16), transparent), var(--bg); }
.auth-body #app { width: 100%; display: grid; place-items: center; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 28px; }
.auth-card .logo { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), #b3182b); font-weight: 800; font-size: 1.3rem; color: #fff; margin-bottom: 14px; }
.auth-card h1 { margin-bottom: 6px; }

/* ---------- Mobil ---------- */
@media (max-width: 1000px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-layout { grid-template-columns: 1fr; }
  .toc { display: none; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .side { position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .2s ease; }
  .shell.open .side { transform: none; box-shadow: 10px 0 40px rgba(0, 0, 0, .6); }
  .shell.open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 30; }
  .btn.menu-btn { display: inline-flex; }
  .topbar { padding: 0 12px; }
  .content { padding: 14px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .field-row { grid-template-columns: 1fr; }
  .card { padding: 14px; }
  h1 { font-size: 1.3rem; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 36px; }
  input, select, textarea { font-size: 16px; }
}
@media print {
  body { background: #fff; color: #000; }
  .rail, .side, .topbar, .no-print, .toast-wrap { display: none !important; }
  .shell { display: block; height: auto; }
  .content { overflow: visible; padding: 0; }
  .card, .note { border-color: #bbb; background: #fff; }
  .muted, .small { color: #444; }
  .tag, .badge { border: 1px solid #888; background: #fff; color: #000; }
}

/* ---------- Rechtstexte ---------- */
.legal-body { background: var(--bg); }
.legal { max-width: 820px; margin: 0 auto; padding: 24px 16px 48px; }
.legal h2 { margin-top: 1.6em; }
.auth-links, .nav-legal { font-size: .8rem; color: var(--muted); }
.auth-links { margin-top: 18px; text-align: center; }
.nav-legal { padding: 8px 12px; }
.auth-links a, .nav-legal a { color: var(--muted); }
