/* ════════════════════════════════════════════════════════════════
   SafeSpace · Mod Dashboard – Design-System
   ════════════════════════════════════════════════════════════════ */

:root {
  --brand: #00a884;
  --brand-2: #25d366;
  --brand-ink: #04281f;
  --brand-soft: rgba(0, 168, 132, .12);
  --bg: #f0f2f5;
  --surface: #cbcbcb;
  --surface-2: #f7f8fa;
  --surface-3: #eef1f5;
  --border: #e3e7ec;
  --border-strong: #cfd6de;
  --text: #111b21;
  --muted: #5f6f7a;
  --danger: #d32f2f;
  --danger-soft: rgba(211, 47, 47, .10);
  --warn: #b26a00;
  --warn-soft: rgba(230, 150, 0, .14);
  --info: #1d6fd6;
  --info-soft: rgba(29, 111, 214, .10);
  --pink: #c2185b;
  --purple: #6d4bd6;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px -8px rgba(16, 24, 40, .12);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .35);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 256px;
  --topbar-h: 64px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b141a;
  --surface: #1f313b;
  --surface-2: #19272f;
  --surface-3: #1f2c34;
  --border: #22313a;
  --border-strong: #33444e;
  --text: #cad3d8;
  --muted: #8696a0;
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, .14);
  --warn: #f5b74a;
  --warn-soft: rgba(245, 183, 74, .14);
  --info: #6cb4ff;
  --info-soft: rgba(108, 180, 255, .14);
  --pink: #ff7fb2;
  --purple: #b19cff;
  --brand-soft: rgba(37, 211, 102, .12);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b141a;
    --surface: #111b21;
    --surface-2: #17232b;
    --surface-3: #1f2c34;
    --border: #22313a;
    --border-strong: #33444e;
    --text: #e9edef;
    --muted: #8696a0;
    --danger: #ff6b6b;
    --danger-soft: rgba(255, 107, 107, .14);
    --warn: #f5b74a;
    --warn-soft: rgba(245, 183, 74, .14);
    --info: #6cb4ff;
    --info-soft: rgba(108, 180, 255, .14);
    --pink: #ff7fb2;
    --purple: #b19cff;
    --brand-soft: rgba(37, 211, 102, .12);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

*, *::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 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
[hidden] { display: none !important; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
kbd {
  font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 3px 6px; border-radius: 6px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--muted);
}
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--brand-soft); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.grad { background: linear-gradient(120deg, var(--brand-2), var(--brand) 60%, var(--purple)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.ico { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
[data-icon] { display: inline-flex; line-height: 0; }

/* ── Anmeldung ── */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(37, 211, 102, .25), transparent 60%),
    radial-gradient(800px 500px at 110% 110%, rgba(109, 75, 214, .22), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 22px; padding: 36px 32px; box-shadow: var(--shadow-lg);
  animation: pop .45s cubic-bezier(.2, .9, .3, 1.15);
}
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

/* ── Marke ── */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-lg { flex-direction: column; text-align: center; gap: 14px; margin-bottom: 26px; }
.brand-lg h1 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.brand-lg p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-2), var(--brand)); box-shadow: 0 8px 22px -8px rgba(0, 168, 132, .7);
}
.brand-lg .brand-mark { width: 60px; height: 60px; border-radius: 18px; }
.brand-mark svg { width: 22px; height: 22px; fill: none; stroke: #04281f; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.brand-lg .brand-mark svg { width: 30px; height: 30px; }
.brand-text strong { display: block; font-weight: 800; letter-spacing: -.01em; line-height: 1.15; }
.brand-text small { color: var(--muted); font-size: 12px; }

/* ── Formularelemente ── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.field .hint { font-size: 12px; color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 400; }
input, select, textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; transition: border-color .15s, box-shadow .15s, background .15s; min-height: 42px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }
input[type="search"]::-webkit-search-cancel-button { display: none; }
input[type="checkbox"] { width: 17px; height: 17px; min-height: 0; accent-color: var(--brand); cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 6px 4px 10px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border); font-size: 13px;
}
.chip a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 360px; }
.chip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.chip button:hover { background: var(--danger-soft); color: var(--danger); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: 999px; border: 1px solid transparent; cursor: pointer; font-weight: 600; font-size: 14px;
  background: var(--surface-3); color: var(--text); transition: transform .12s, filter .15s, background .15s, border-color .15s; white-space: nowrap;
  text-decoration: none !important;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #04281f; box-shadow: 0 8px 20px -10px rgba(0, 168, 132, .9); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); background: var(--surface-3); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warn { background: var(--warn-soft); color: var(--warn); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn-xs { min-height: 26px; padding: 0 9px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; color: var(--muted); flex-shrink: 0; transition: color .15s, background .15s;
}
.icon-btn:hover { color: var(--text); background: var(--surface-3); }
.burger { display: none; }

/* ── App-Gerüst ── */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); display: flex; flex-direction: column; z-index: 40;
  background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; transition: transform .25s ease;
}
.sidebar .brand { padding: 20px 20px 18px; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 12px; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 16px 10px 6px; opacity: .85; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--muted);
  font-weight: 500; transition: background .15s, color .15s; position: relative; text-decoration: none;
}
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.nav a[hidden] { display: none; }
.sidebar-foot { margin-top: auto; padding: 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.me { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; color: var(--text) !important; }
.me:hover, .me.active { background: var(--surface-3); }
.me-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.me-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { color: var(--muted); font-size: 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
  color: #fff; font-weight: 800; font-size: 14px; text-transform: uppercase; background: var(--brand);
}
.avatar.sm { width: 28px; height: 28px; border-radius: 9px; font-size: 12px; }
.scrim { display: none; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 28px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.global-search { flex: 1; max-width: 560px; position: relative; margin: 0; }
.global-search input { padding-left: 40px; padding-right: 44px; border-radius: 999px; background: var(--surface); min-height: 40px; }
.gs-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.global-search kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }
.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 16px 28px 0; padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--warn-soft); color: var(--warn); font-weight: 600; border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
}
.banner .btn { margin-left: auto; }
.view { padding: 26px 28px 60px; width: 100%; max-width: 1360px; animation: rise .35s cubic-bezier(.2, .8, .2, 1) both; outline: none; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Karten ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; min-width: 0; }
.card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h3 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.card-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-stack { display: grid; gap: 18px; }
.section-gap { margin-top: 18px; }

/* ── KPI ── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  --c: var(--brand); position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 18px 16px; box-shadow: var(--shadow); text-align: left; cursor: default;
  transition: transform .2s, box-shadow .2s, border-color .2s; display: block; color: var(--text); text-decoration: none !important;
}
a.kpi:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c) 40%, transparent); box-shadow: 0 16px 34px -18px var(--c); }
.kpi::after { content: ""; position: absolute; right: -26px; top: -26px; width: 96px; height: 96px; border-radius: 50%; background: var(--c); opacity: .12; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.kpi-val { font-size: 32px; font-weight: 800; letter-spacing: -.03em; margin-top: 10px; font-variant-numeric: tabular-nums; color: var(--text); }
.kpi-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi.c-brand { --c: var(--brand); } .kpi.c-danger { --c: var(--danger); } .kpi.c-warn { --c: var(--warn); }
.kpi.c-info { --c: var(--info); } .kpi.c-purple { --c: var(--purple); } .kpi.c-pink { --c: var(--pink); }

/* ── Balkendiagramme ── */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(96px, 150px) 1fr 40px; align-items: center; gap: 12px; font-size: 13.5px; }
.bar-track { height: 10px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-2), var(--brand)); transform-origin: left; animation: grow .8s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes grow { from { transform: scaleX(0); } }
.bar-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.columns { display: flex; align-items: stretch; gap: 14px; height: 200px; padding-top: 4px; }
.columns .col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; gap: 6px; min-width: 0; }
.columns .col-area { flex: 1; min-height: 0; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.columns .col-bar { width: 100%; max-width: 46px; border-radius: 10px 10px 4px 4px; background: linear-gradient(180deg, var(--brand-2), var(--brand)); animation: rise-bar .7s cubic-bezier(.2, .8, .2, 1) both; transform-origin: bottom; }
@keyframes rise-bar { from { transform: scaleY(0); } }
.columns .col-val { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; min-height: 16px; }
.columns .col-lbl { font-size: 12px; color: var(--muted); }
.ico.sm { width: 14px; height: 14px; }

/* ── Listen (Dashboard) ── */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; background: var(--surface-2);
  border: 1px solid var(--border); cursor: pointer; transition: border-color .15s, transform .15s, background .15s; min-width: 0; text-align: left; width: 100%;
}
.list-item:hover { border-color: color-mix(in srgb, var(--brand) 45%, transparent); transform: translateX(3px); }
.list-item .grow { line-height: 1.3; }
.list-item b { display: block; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .meta { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.type-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; font-size: 16px; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .empty-ico { width: 52px; height: 52px; margin: 0 auto 10px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-3); color: var(--brand); }
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  white-space: nowrap; border: 1px solid transparent; line-height: 1.4;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.t-warn { background: var(--warn-soft); color: var(--warn); }
.t-ban { background: var(--danger-soft); color: var(--danger); }
.t-info { background: var(--surface-3); color: var(--muted); }
.s-active { background: var(--brand-soft); color: var(--brand); }
.s-lifted { background: var(--surface-3); color: var(--muted); }
.s-expired { background: var(--danger-soft); color: var(--danger); }
.s-active::before { animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.stage { display: inline-grid; place-items: center; min-width: 30px; height: 24px; padding: 0 8px; border-radius: 8px; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; background: var(--surface-3); color: var(--text); }
.stage.s2 { background: var(--warn-soft); color: var(--warn); }
.stage.s3 { background: var(--danger-soft); color: var(--danger); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; background: var(--surface-3); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.role-sa { background: var(--purple); color: #fff; }
.role-adm { background: var(--info-soft); color: var(--info); }

/* ── Tabelle ── */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .search { flex: 1 1 260px; position: relative; min-width: 200px; }
.toolbar .search input { padding-left: 38px; }
.toolbar .search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.toolbar select { width: auto; min-width: 150px; flex: 0 1 auto; }
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
th {
  text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; transition: background .12s; }
tbody tr.clickable:hover td { background: var(--brand-soft); }
tbody tr.selected td { background: color-mix(in srgb, var(--brand) 9%, transparent); }
td.chk, th.chk { width: 40px; padding-right: 0; }
.phone { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 650; letter-spacing: .01em; white-space: nowrap; }
.cell-sub { font-size: 12.5px; color: var(--muted); }
.reason { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-card td, .table-card th { padding-left: 12px; padding-right: 12px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.pager .pages { display: flex; gap: 6px; align-items: center; }
.bulkbar {
  position: sticky; bottom: 16px; z-index: 20; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 14px; padding: 12px 16px; border-radius: 999px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); width: max-content; max-width: 100%;
}
.bulkbar .btn-ghost { color: var(--bg); border-color: color-mix(in srgb, var(--bg) 25%, transparent); }
.bulkbar .btn-ghost:hover { background: color-mix(in srgb, var(--bg) 12%, transparent); color: var(--bg); }
.bulkbar .btn-primary { color: #04281f; }

/* ── Profil / Detail ── */
.hero-card { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.hero-card .big-mark { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; font-size: 24px; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.hero-card .phone { font-size: 22px; }
.suggest { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: var(--radius); border: 1px solid; }
.suggest.warn1 { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }
.suggest.warn2 { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.suggest.warn3, .suggest.ban { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.suggest .s-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface); }
.suggest strong { display: block; margin-bottom: 2px; }
.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 14px 1fr; gap: 14px; position: relative; padding-bottom: 16px; cursor: pointer; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 2px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); margin-top: 4px; }
.tl-body { padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); transition: border-color .15s; min-width: 0; }
.tl-item:hover .tl-body { border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.tl-body p { margin-top: 6px; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.quote { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.msg-box {
  background: #d9fdd3; color: #111b21; border-radius: 4px 16px 16px 16px; padding: 12px 14px; white-space: pre-wrap;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08); line-height: 1.55; overflow-wrap: anywhere;
}
.divider { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.evidence { display: flex; flex-direction: column; gap: 6px; }
.evidence a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

/* ── Suche ── */
.search-big { position: relative; }
.search-big input { font-size: 17px; padding: 15px 16px 15px 46px; border-radius: 16px; min-height: 56px; }
.search-big .ico { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 20px; height: 20px; }
.result { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.result + .result { margin-top: 10px; }

/* ── Banner / Info ── */
.info { display: flex; gap: 12px; padding: 13px 15px; border-radius: var(--radius-sm); background: var(--info-soft); color: var(--text); font-size: 14px; }
.info .ico { color: var(--info); margin-top: 2px; }
.info.warn { background: var(--danger-soft); } .info.warn .ico { color: var(--danger); }
.info.ok { background: var(--brand-soft); } .info.ok .ico { color: var(--brand); }

/* ── Dialoge ── */
.dialog {
  border: 0; padding: 0; background: transparent; color: var(--text); max-width: calc(100vw - 32px); width: 560px;
  max-height: calc(100vh - 48px); overflow: visible;
}
.dialog::backdrop { background: rgba(5, 10, 14, .6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.dialog[open] { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); animation: pop .25s cubic-bezier(.2, .9, .3, 1.1); }
.dialog.lg { width: 880px; }
.dialog.sm { width: 420px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.dlg-head h3 { font-size: 17px; font-weight: 750; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; }
.dlg-body { padding: 20px; overflow-y: auto; min-height: 0; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 20px 20px; }
.dlg-foot .grow { margin-right: auto; }
.dialog form { display: contents; }
.dialog .dlg-body form.stack { gap: 16px; }

/* ── Toasts ── */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; padding: 12px 16px;
  background: var(--text); color: var(--bg); border-radius: 14px; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 550;
  animation: toast-in .3s cubic-bezier(.2, .9, .3, 1.2);
}
.toast.out { opacity: 0; transform: translateY(6px); transition: .25s; }
.toast .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 900; flex-shrink: 0; background: var(--brand); color: #04281f; }
.toast.error .dot { background: var(--danger); color: #fff; }
.toast.info .dot { background: var(--info); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateX(16px) scale(.98); } }

/* ── Palette ── */
.palette-input { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; min-height: 56px; font-size: 16px; padding: 0 20px; background: transparent; }
.palette-input:focus { box-shadow: none; background: transparent; border-color: var(--border); }
.palette-list { padding: 8px; max-height: 360px; overflow-y: auto; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--text); }
.palette-item.sel { background: var(--brand-soft); color: var(--brand); }
.palette-item .ke { margin-left: auto; font-size: 12px; color: var(--muted); }

/* ── Skeleton ── */
.skeleton { height: 14px; border-radius: 8px; background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite; margin: 14px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Responsiv ── */
@media (max-width: 1100px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 280px; }
  .sidebar { transform: translateX(-102%); box-shadow: none; }
  .nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(5, 10, 14, .5); z-index: 35; }
  .main { margin-left: 0; }
  .burger { display: grid; }
  .topbar { padding: 0 14px; gap: 8px; }
  .global-search kbd { display: none; }
  .view { padding: 18px 14px 110px; }
  .banner { margin: 12px 14px 0; }
  .page-head h2 { font-size: 22px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .bar-row { grid-template-columns: 96px 1fr 34px; }
  .toolbar select { flex: 1 1 140px; }
  .dialog.lg, .dialog { width: calc(100vw - 24px); }
  .dialog[open] { max-height: calc(100dvh - 24px); }
  .card { padding: 18px; }
  .toasts { left: 14px; right: 14px; bottom: 14px; align-items: stretch; }
  .toast { min-width: 0; max-width: none; }
}
@media (max-width: 560px) {
  .topbar .icon-btn:not(.burger):not(#themeBtn) { display: none; }
  .search-big input { font-size: 16px; }
  .table-wrap table { min-width: 620px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-val { font-size: 26px; }
  .bulkbar { border-radius: 16px; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .sidebar, .topbar, .toasts, .banner, .no-print { display: none !important; }
  .main { margin: 0; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; }
}



/* ════════════════════════════════════════════════════════════════
   Schlichtes Schwarz/Weiß-Theme
   ════════════════════════════════════════════════════════════════ */
:root {
  --bg: #f7f7f7; --surface: #ffffff; --surface-2: #f4f4f4; --surface-3: #ececec;
  --border: #e6e6e6; --border-strong: #d2d2d2;
  --text: #111111; --muted: #6a6a6a;
  --brand: #111111; --brand-2: #111111; --brand-soft: rgba(0,0,0,.06);
  --danger: #c62828; --danger-soft: rgba(198,40,40,.09);
  --warn: #111111; --warn-soft: #efefef;
  --info: #111111; --info-soft: #efefef;
  --pink: #111111; --purple: #111111;
  --radius: 10px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,.05); --shadow-lg: 0 20px 50px -20px rgba(0,0,0,.35);
}
:root[data-theme="dark"] {
  --bg: #0b0b0b; --surface: #151515; --surface-2: #1d1d1d; --surface-3: #272727;
  --border: #2a2a2a; --border-strong: #3b3b3b;
  --text: #f2f2f2; --muted: #9b9b9b;
  --brand: #ffffff; --brand-2: #ffffff; --brand-soft: rgba(255,255,255,.08);
  --danger: #ff7b72; --danger-soft: rgba(255,123,114,.14);
  --warn: #f2f2f2; --warn-soft: #232323; --info: #f2f2f2; --info-soft: #232323;
  --pink: #f2f2f2; --purple: #f2f2f2;
  --shadow: none; --shadow-lg: 0 20px 50px -20px rgba(0,0,0,.9);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0b; --surface: #151515; --surface-2: #1d1d1d; --surface-3: #272727;
    --border: #2a2a2a; --border-strong: #3b3b3b;
    --text: #f2f2f2; --muted: #9b9b9b;
    --brand: #ffffff; --brand-2: #ffffff; --brand-soft: rgba(255,255,255,.08);
    --danger: #ff7b72; --danger-soft: rgba(255,123,114,.14);
    --warn: #f2f2f2; --warn-soft: #232323; --info: #f2f2f2; --info-soft: #232323;
    --pink: #f2f2f2; --purple: #f2f2f2;
    --shadow: none; --shadow-lg: 0 20px 50px -20px rgba(0,0,0,.9);
  }
}
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
::selection { background: var(--text); color: var(--bg); }

/* Marke & Navigation */
.brand-mark { background: var(--text); box-shadow: none; border-radius: 10px; }
.brand-mark svg { stroke: var(--bg); }
.grad { background: none; color: inherit; -webkit-text-fill-color: currentColor; }
.nav a { text-decoration: none; }
.nav a:hover { text-decoration: none; }
.nav a.active { background: var(--surface-3); color: var(--text); font-weight: 650; }
.nav a.active::before { display: none; }
.avatar { background: var(--text) !important; color: var(--bg); }
.me, .me:hover { text-decoration: none; }

/* Buttons */
.btn { text-transform: none; letter-spacing: 0; font-size: 14px; border-radius: 8px; border: 1px solid transparent; }
.btn-primary { background: var(--text); color: var(--bg); box-shadow: none; }
.btn-primary:hover { filter: none; opacity: .85; }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); }
.btn-ghost { border-color: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warn { background: var(--surface-3); color: var(--text); }
.global-search input { border-radius: 8px; }
.icon-btn { border-radius: 8px; }

/* Eingaben */
input:focus, select:focus, textarea:focus { border-color: var(--text); box-shadow: 0 0 0 3px var(--brand-soft); background: var(--surface); }
input[type="checkbox"] { accent-color: var(--text); }

/* Anmeldung */
.auth { background: var(--bg); }
.auth-card { border-radius: 14px; box-shadow: var(--shadow-lg); }

/* Badges: neutral, nur Ban/Abgelaufen rot */
.badge { background: var(--surface-3); color: var(--text); border: 0; border-radius: 6px; text-transform: none; letter-spacing: 0; font-size: 12px; }
.badge::before { border-radius: 50%; }
.t-warn, .t-info { background: var(--surface-3); color: var(--text); }
.t-ban { background: var(--danger-soft); color: var(--danger); }
.s-active { background: var(--surface-3); color: var(--text); }
.s-lifted { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--border-strong); }
.s-expired { background: var(--danger-soft); color: var(--danger); }
.stage { background: var(--surface-3); color: var(--text); border-radius: 6px; }
.stage.s2 { background: var(--text); color: var(--bg); opacity: .65; }
.stage.s3 { background: var(--text); color: var(--bg); }
.tag { border-radius: 6px; }
.role-sa { background: var(--text); color: var(--bg); } .role-adm { background: var(--surface-3); color: var(--text); }

/* Flächen */
.kpi::after { display: none; }
.kpi-ico { background: var(--surface-3); color: var(--text); }
a.kpi:hover { border-color: var(--text); box-shadow: none; transform: none; }
.list-item:hover { border-color: var(--text); transform: none; }
.bar-fill { background: var(--text); box-shadow: none; }
.col-bar { background: var(--text); }
.tl-dot { background: var(--text); box-shadow: 0 0 0 4px var(--surface-3); }
.tl-item:hover .tl-body { border-color: var(--text); }
tbody tr.clickable:hover td, tbody tr.selected td { background: var(--surface-2); }
.msg-box { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: none; }
.suggest { background: var(--surface-2); border-color: var(--border-strong); }
.suggest.warn1, .suggest.warn2 { background: var(--surface-2); border-color: var(--border-strong); }
.suggest.warn3, .suggest.ban { background: var(--danger-soft); border-color: var(--danger); }
.info, .info.ok { background: var(--surface-2); } .info .ico, .info.ok .ico { color: var(--text); }
.banner { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.empty .empty-ico { background: var(--surface-3); color: var(--text); }
.bulkbar { background: var(--text); color: var(--bg); }
.bulkbar .btn-primary { background: var(--bg); color: var(--text); }
.toast .dot { background: var(--bg); color: var(--text); }
.toast.error .dot { background: var(--danger); color: #fff; }
.palette-item.sel { background: var(--surface-3); color: var(--text); }

.type-ico { background: var(--surface-3) !important; filter: grayscale(1); }
