/* ============================================================
   IT-Ausstattung – Design
   Farben als Variablen; Dunkelmodus folgt dem System oder dem
   Schalter in der Seitenleiste (data-theme).
   ============================================================ */
:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --border: #e2e6ed;
  --border-strong: #c6ccd8;
  --text: #151a23;
  --text-2: #4a5363;
  --muted: #6d7686;
  --accent: #2a78d6;
  --accent-strong: #1c5db0;
  --accent-soft: #e6f0fc;
  --accent-ink: #ffffff;
  --side-bg: #0f1b31;
  --side-text: #c9d3e6;
  --side-muted: #7f8ca6;
  --side-hover: rgba(255, 255, 255, .07);
  --side-active: rgba(74, 148, 240, .2);
  --shadow: 0 1px 2px rgba(17, 24, 39, .05), 0 6px 18px -8px rgba(17, 24, 39, .12);
  --radius: 12px;

  --good: #17703c; --good-bg: #e3f4ea; --good-m: #2fa35f;
  --warn: #8a4e00; --warn-bg: #fdf0d2; --warn-m: #e3a41c;
  --info: #1c5db0; --info-bg: #e4eefb; --info-m: #3f86dc;
  --violet: #5343b8; --violet-bg: #ebe8fb; --violet-m: #7d6ce6;
  --muted-t: #566071; --muted-bg: #eceff4; --muted-m: #aab2c0;
  --danger: #b42b2b; --danger-bg: #fbe6e6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1016; --surface: #151a22; --surface-2: #1a2029; --border: #262d39; --border-strong: #384152;
    --text: #e9edf4; --text-2: #b4bccb; --muted: #8791a3;
    --accent: #4a94f0; --accent-strong: #7db2f7; --accent-soft: #16273f; --accent-ink: #08111f;
    --side-bg: #0a0d13; --side-text: #b9c3d6; --side-muted: #6f7b92;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 22px -10px rgba(0, 0, 0, .6);
    --good: #56c785; --good-bg: #13301f; --good-m: #3fae6d;
    --warn: #eeb44a; --warn-bg: #38290a; --warn-m: #d6961a;
    --info: #79b1f5; --info-bg: #14263f; --info-m: #4a94f0;
    --violet: #b0a5f4; --violet-bg: #241f47; --violet-m: #9184ec;
    --muted-t: #a6afbd; --muted-bg: #242a34; --muted-m: #566073;
    --danger: #f08383; --danger-bg: #3b1818;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1016; --surface: #151a22; --surface-2: #1a2029; --border: #262d39; --border-strong: #384152;
  --text: #e9edf4; --text-2: #b4bccb; --muted: #8791a3;
  --accent: #4a94f0; --accent-strong: #7db2f7; --accent-soft: #16273f; --accent-ink: #08111f;
  --side-bg: #0a0d13; --side-text: #b9c3d6; --side-muted: #6f7b92;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 22px -10px rgba(0, 0, 0, .6);
  --good: #56c785; --good-bg: #13301f; --good-m: #3fae6d;
  --warn: #eeb44a; --warn-bg: #38290a; --warn-m: #d6961a;
  --info: #79b1f5; --info-bg: #14263f; --info-m: #4a94f0;
  --violet: #b0a5f4; --violet-bg: #241f47; --violet-m: #9184ec;
  --muted-t: #a6afbd; --muted-bg: #242a34; --muted-m: #566073;
  --danger: #f08383; --danger-bg: #3b1818;
}

/* ---------- Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.i { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; }
.nowrap { white-space: nowrap; }
.text-warn { color: var(--warn); font-weight: 600; }
.is-hidden { display: none !important; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  background: var(--side-bg); color: var(--side-text); padding: 18px 14px;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 6px 8px 18px; }
.brand b { display: block; color: #fff; font-size: 16px; letter-spacing: .1px; }
.brand small { display: block; color: var(--side-muted); font-size: 12px; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #3b8be8, #2258b8); color: #fff; box-shadow: 0 6px 14px -6px rgba(42, 120, 214, .8); }
.brand-mark .i { width: 21px; height: 21px; }
.brand-mark.big { width: 56px; height: 56px; border-radius: 15px; }
.brand-mark.big .i { width: 30px; height: 30px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { margin: 16px 10px 6px; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--side-muted); font-weight: 600; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px; color: var(--side-text); font-weight: 500; }
.nav-link .i { width: 19px; height: 19px; opacity: .85; }
.nav-link:hover { background: var(--side-hover); color: #fff; }
.nav-link.active { background: var(--side-active); color: #fff; }
.nav-link.active .i { opacity: 1; color: #8dbdf7; }
.nav-count { margin-left: auto; font-style: normal; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: rgba(255, 255, 255, .09); color: var(--side-text); }
.side-foot { border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 12px; margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.me { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: 10px; }
.me:hover, .me.active { background: var(--side-hover); }
.me b { display: block; color: #fff; font-size: 14px; font-weight: 600; }
.me small { color: var(--side-muted); font-size: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #3b8be8, #7d6ce6); color: #fff; font-weight: 700; flex: none; }
.side-actions { display: flex; gap: 8px; padding: 0 6px; }
.side-actions form { margin: 0; }
.side-actions .icon-btn { color: var(--side-text); background: rgba(255, 255, 255, .06); border-color: transparent; }
.side-actions .icon-btn:hover { background: rgba(255, 255, 255, .13); color: #fff; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: inline; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: inline; }
  :root:not([data-theme="light"]) .i-moon { display: none; }
}
.main { min-width: 0; }
.topbar { display: none; }
.content { padding: 30px clamp(16px, 3vw, 40px) 60px; max-width: 1500px; margin: 0 auto; }
.scrim { display: none; }

@media (max-width: 960px) {
  .shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 40; transform: translateX(-102%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  .sidebar-open .sidebar { transform: none; }
  .sidebar-open .scrim { display: block; position: fixed; inset: 0; background: rgba(5, 10, 20, .55); z-index: 30; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; height: 54px; padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
  .topbar-title { font-weight: 700; }
  .content { padding-top: 20px; }
}

/* ---------- Seitenkopf ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-actions form { margin: 0; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.crumb:hover { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px;
  border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink); }
:root[data-theme="dark"] .btn-primary:hover { color: #fff; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; height: 44px; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--accent); border-color: var(--border-strong); }
.link { color: var(--accent); font-weight: 600; font-size: 14px; }
.link:hover { text-decoration: underline; }

/* ---------- Karten ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; min-width: 0; }
.card.narrow { max-width: 520px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card .hint, .head-meta { color: var(--muted); font-size: 13px; }
.table-card { padding: 20px 0 0; overflow: hidden; }
.table-card .card-head { padding: 0 20px; }
.count { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--muted-bg); color: var(--muted-t); }
.empty { color: var(--muted); padding: 10px 0 20px; text-align: center; }
.table-card .empty { padding: 22px 20px 30px; }
.empty .i { color: var(--good); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 { margin-bottom: 20px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.detail-grid > aside { position: sticky; top: 20px; }
@media (max-width: 1100px) { .detail-grid { grid-template-columns: minmax(0, 1fr); } .detail-grid > aside { position: static; } }
.stack-form { display: block; }

/* ---------- Kennzahlen ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
@media (max-width: 1200px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kpis { grid-template-columns: minmax(0, 1fr); } }
.kpi { position: relative; display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px 16px; box-shadow: var(--shadow); transition: border-color .12s, transform .12s; }
.kpi:hover { border-color: var(--accent); transform: translateY(-1px); }
.kpi-ic { position: absolute; right: 16px; top: 16px; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.kpi-v { display: block; font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.kpi-v small { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.kpi-l { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; padding-right: 30px; }
.kpi-warn .kpi-ic { background: var(--warn-bg); color: var(--warn); }
.kpi-warn .kpi-v { color: var(--warn); }

/* ---------- Balken / Lehrgänge ---------- */
.bars, .cohorts, .list { list-style: none; margin: 0; padding: 0; }
.bars li a { display: grid; grid-template-columns: 160px 1fr 34px; align-items: center; gap: 12px; padding: 7px 0; }
.bars li a:hover .bar-f { background: var(--accent-strong); }
.bar-l { display: flex; align-items: center; gap: 9px; color: var(--text-2); font-size: 14px; }
.bar-l .i { color: var(--muted); }
.bar-t { height: 10px; border-radius: 99px; background: var(--muted-bg); overflow: hidden; }
.bar-f { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.bar-v { text-align: right; font-weight: 700; }
@media (max-width: 520px) { .bars li a { grid-template-columns: 120px 1fr 28px; } }
.cohorts li a { display: grid; grid-template-columns: 170px 1fr 30px; gap: 12px; align-items: center; padding: 8px 0; }
.cohorts li a:hover .co-name { color: var(--accent); }
.co-name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.co-n { text-align: right; color: var(--muted); font-size: 13px; }
.stack { display: flex; gap: 2px; height: 12px; }
.seg { flex-basis: 0; min-width: 6px; background: var(--m); border-radius: 3px; }
.seg:first-child { border-radius: 99px 3px 3px 99px; }
.seg:last-child { border-radius: 3px 99px 99px 3px; }
.seg:only-child { border-radius: 99px; }
.legend, .legend-line { display: flex; gap: 6px 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; align-items: center; }
.legend span, .legend-line span { display: inline-flex; align-items: center; gap: 6px; }
.legend-line { margin: -4px 4px 20px; line-height: 1.6; }
@media (max-width: 520px) { .cohorts li a { grid-template-columns: 1fr 26px; } .cohorts .stack { grid-column: 1 / -1; grid-row: 2; } }

/* ---------- Listen ---------- */
.list li { border-top: 1px solid var(--border); }
.list li:first-child { border-top: 0; }
.list li > a, .list li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 0; }
.list li > a { flex: 1; padding: 0; }
.list li > a:hover b { color: var(--accent); }
.li-main { min-width: 0; }
.li-main b { display: block; font-weight: 600; }
.li-main small { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-side { color: var(--muted); font-size: 13px; text-align: right; flex: none; max-width: 45%; }

/* ---------- Tags / Badges / Punkte ---------- */
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.tone-good { --fg: var(--good); --bg: var(--good-bg); --m: var(--good-m); }
.tone-warn { --fg: var(--warn); --bg: var(--warn-bg); --m: var(--warn-m); }
.tone-info { --fg: var(--info); --bg: var(--info-bg); --m: var(--info-m); }
.tone-violet { --fg: var(--violet); --bg: var(--violet-bg); --m: var(--violet-m); }
.tone-muted { --fg: var(--muted-t); --bg: var(--muted-bg); --m: var(--muted-m); }
.tone-none { --fg: var(--muted); --bg: transparent; --m: transparent; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: var(--bg); color: var(--fg); white-space: nowrap; }
.badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--m); }
.badge.tone-none { padding-left: 10px; font-weight: 400; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--m); }
.dot.tone-none { background: transparent; box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.dots { display: inline-flex; gap: 5px; align-items: center; }

/* ---------- Tabs / Werkzeugleiste ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs.scroll { overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-color: var(--accent); }
.tab span { font-size: 12px; padding: 0 7px; border-radius: 99px; background: var(--muted-bg); color: var(--muted-t); line-height: 20px; }
.tab.active span { background: var(--accent-soft); color: var(--accent); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.search { position: relative; flex: 1 1 280px; max-width: 460px; }
.search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { width: 100%; height: 38px; padding: 0 12px 0 36px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); }
.toolbar select { height: 38px; padding: 0 30px 0 12px; border-radius: 9px; border: 1px solid var(--border-strong); background-color: var(--surface); }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 10px 14px; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr:target { background: var(--accent-soft); }
.table tr.is-inactive td { opacity: .6; }
.cell-main { display: block; min-width: 0; }
.cell-main b { display: block; font-weight: 600; }
.cell-main:hover b { color: var(--accent); }
.cell-main small { display: block; color: var(--muted); font-size: 12.5px; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.small-cell { font-size: 13px; color: var(--text-2); }
.small-cell.wrap { max-width: 460px; }
.row-actions { text-align: right; white-space: nowrap; width: 1%; }
.cat { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); }
.cat .i { color: var(--muted); }
.chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 12px; }
.chip b { font-weight: 700; }
.inline { display: inline; margin: 0; }
.sel { appearance: none; -webkit-appearance: none; border: 0; border-radius: 99px; padding: 3px 26px 3px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; background-color: var(--bg); color: var(--fg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 10px; min-width: 128px; }
.sel.tone-none { box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--muted); }
.sel:hover { filter: brightness(.97); }

/* ---------- Formulare ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span:first-child { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field small { font-weight: 400; color: var(--muted); }
.field-wide { grid-column: 1 / -1; }
.field input, .field select, .field textarea { width: 100%; padding: 9px 12px; min-height: 40px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .search input:focus, .toolbar select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); outline-offset: 0; }
.field input:disabled, .field select:disabled, .field textarea:disabled { background: var(--surface-2); color: var(--text-2); opacity: 1; cursor: default; }
.pw { position: relative; display: block; }
.pw input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 4px; top: 4px; width: 34px; height: 34px; border: 0; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.pw-toggle:hover { color: var(--accent); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.check small { display: block; color: var(--muted); font-weight: 400; }
.check.inline { align-items: center; min-height: 40px; }
.check-field .check { padding: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin: 0 0 20px; }
.card .form-actions { margin: 16px 0 0; }
.user-form .form-actions { margin-top: 12px; }

/* ---------- Meldungen ---------- */
.flash { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; transition: opacity .5s; }
.flash.fade { opacity: 0; }
.flash-ok { background: var(--good-bg); color: var(--good); }
.flash-err { background: var(--danger-bg); color: var(--danger); }
.flash span { flex: 1; }
.flash-x { border: 0; background: transparent; color: inherit; cursor: pointer; opacity: .7; display: grid; place-items: center; padding: 2px; }
.flash-x:hover { opacity: 1; }

/* ---------- Verlauf ---------- */
.timeline { list-style: none; margin: 0; padding: 0; max-height: 620px; overflow-y: auto; }
.timeline li { position: relative; display: flex; flex-direction: column; gap: 1px; padding: 0 0 18px 24px; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); z-index: 1; }
.timeline li::after { content: ""; position: absolute; left: 4px; top: 16px; bottom: -3px; width: 2px; background: var(--border); }
.timeline li:last-child { padding-bottom: 2px; }
.timeline li:last-child::after { display: none; }
.timeline b { font-size: 14px; }
.timeline span { font-size: 13px; color: var(--text-2); word-break: break-word; }
.timeline small { color: var(--muted); font-size: 12px; }

/* ---------- Benutzer ---------- */
.users-grid { align-items: start; }
.user-row { border-top: 1px solid var(--border); }
.user-row summary { display: flex; align-items: center; gap: 12px; padding: 12px 20px; cursor: pointer; list-style: none; }
.user-row summary::-webkit-details-marker { display: none; }
.user-row summary .li-main { flex: 1; }
.user-row summary:hover { background: var(--surface-2); }
.user-row[open] summary { background: var(--surface-2); }
.user-row.is-inactive .avatar { filter: grayscale(1); opacity: .6; }
.user-form { padding: 6px 20px 18px; background: var(--surface-2); }
.roles { margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--border); display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.roles dt { font-weight: 700; }
.roles dd { margin: 0; color: var(--muted); }

/* ---------- Seiten-Navigation ---------- */
.pager { display: flex; justify-content: center; align-items: center; gap: 16px; padding: 16px; border-top: 1px solid var(--border); font-size: 14px; }
.pager a { color: var(--accent); font-weight: 600; }
.pager .dis { color: var(--muted); opacity: .5; }
.pager .cur { color: var(--muted); }

/* ---------- Login ---------- */
.auth-wrap { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; }
.auth-hero { position: relative; overflow: hidden; display: flex; align-items: center; padding: 48px clamp(28px, 6vw, 88px); color: #fff; background: radial-gradient(1200px 600px at 10% 0%, #2a6fd0 0%, transparent 60%), linear-gradient(160deg, #0f1b31 0%, #14294d 100%); }
.auth-hero::after { content: ""; position: absolute; width: 520px; height: 520px; right: -180px; bottom: -200px; border-radius: 50%; border: 60px solid rgba(255, 255, 255, .05); }
.hero-inner { position: relative; max-width: 520px; z-index: 1; }
.hero-inner h2 { font-size: clamp(30px, 3.4vw, 42px); margin: 22px 0 12px; letter-spacing: -.02em; line-height: 1.1; }
.hero-inner p { color: #c3d0e8; font-size: 17px; line-height: 1.55; }
.hero-list { list-style: none; padding: 0; margin: 30px 0 0; display: flex; flex-direction: column; gap: 14px; color: #dbe5f7; }
.hero-list li { display: flex; align-items: center; gap: 12px; }
.hero-list .i { padding: 8px; box-sizing: content-box; width: 20px; height: 20px; border-radius: 10px; background: rgba(255, 255, 255, .1); color: #9cc5fa; }
.auth-panel { display: grid; place-items: center; padding: 32px 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 26px; letter-spacing: -.01em; margin-bottom: 6px; }
.auth-card > .muted { margin-bottom: 22px; }
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: minmax(0, 1fr); }
  .auth-hero { display: none; }
  .auth-panel { min-height: 100vh; align-content: center; }
}

@media print { .sidebar, .topbar, .toolbar, .page-actions, .row-actions, .tabs { display: none !important; } .shell { display: block; } body { background: #fff; } .card { box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Globale Suche ---------- */
.side-search { margin: 0 0 6px; }
.side-search label { position: relative; display: block; }
.side-search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--side-muted); width: 17px; height: 17px; pointer-events: none; }
.side-search input { width: 100%; height: 38px; padding: 0 34px 0 36px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .06); color: #fff; }
.side-search input::placeholder { color: var(--side-muted); }
.side-search input:focus { outline: 2px solid rgba(74, 148, 240, .6); outline-offset: 0; background: rgba(255, 255, 255, .1); }
.side-search kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font: 600 11px/1 ui-monospace, Menlo, monospace; color: var(--side-muted); border: 1px solid rgba(255, 255, 255, .15); border-radius: 5px; padding: 3px 6px; pointer-events: none; }
.side-search input:focus + kbd { display: none; }
.topbar-search { margin-left: auto; }
.bigsearch { display: flex; gap: 10px; margin-bottom: 20px; max-width: 760px; }
.bigsearch .search { max-width: none; flex: 1; }
.bigsearch .search input { height: 46px; font-size: 16px; border-radius: 11px; }
.bigsearch .btn { height: 46px; }
.result-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.rt { display: inline-flex; align-items: center; gap: 8px; padding: 6px 13px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); font-weight: 600; font-size: 13.5px; }
.rt span { font-size: 12px; padding: 0 7px; line-height: 20px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.rt:hover { border-color: var(--accent); }
.rt.zero { opacity: .55; }
.rt.zero span { background: var(--muted-bg); color: var(--muted-t); }
.more { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
mark { background: color-mix(in srgb, var(--warn-m) 38%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- Import ---------- */
.steps { margin: 0 0 14px; padding-left: 20px; color: var(--text-2); display: flex; flex-direction: column; gap: 4px; }
kbd { font: 600 12px/1 ui-monospace, Menlo, monospace; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border-strong); background: var(--surface-2); }
.paste { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important; font-size: 13px; white-space: pre; overflow: auto; }
.import-hint { margin: 10px 0 16px; line-height: 1.6; }
.import-sum { margin: -4px 0 14px; color: var(--text-2); }
.import-table td, .import-table th { white-space: nowrap; }
.row-dup td { background: var(--warn-bg); }
.field input[type=file] { padding: 7px 10px; }
.import-note { display: block; margin-top: 2px; max-width: 340px; white-space: normal; color: var(--warn); font-size: 12.5px; line-height: 1.35; }
.import-note .i { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }
.import-table td:nth-child(2) { min-width: 270px; }
