:root {
  --bg: #0a0e17; --surface: #111827; --surface-2: #172033; --surface-3: #1d2840; --border: #1f2b42; --border-2: #2a3855;
  --text: #e9eef8; --muted: #8e9bb4; --faint: #5d6b86;
  --primary: #5b8cff; --primary-2: #8b5cf6; --primary-soft: rgba(91,140,255,.14);
  --success: #34d399; --success-soft: rgba(52,211,153,.14); --danger: #f87171; --danger-soft: rgba(248,113,113,.14); --warn: #fbbf24; --warn-soft: rgba(251,191,36,.14);
  --shadow: 0 10px 30px -12px rgba(0,0,0,.6); --radius: 16px; --radius-sm: 10px;
  --grad: linear-gradient(135deg, #5b8cff 0%, #8b5cf6 100%);
  --glow: radial-gradient(60% 50% at 50% 0%, rgba(91,140,255,.16), transparent 70%);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f5fb; --surface: #ffffff; --surface-2: #f6f8fd; --surface-3: #eaeff9; --border: #e2e8f3; --border-2: #cfd8ea;
  --text: #0f172a; --muted: #5b6780; --faint: #94a0b8;
  --primary-soft: rgba(91,140,255,.12); --success-soft: rgba(16,185,129,.12); --danger-soft: rgba(239,68,68,.1); --warn-soft: rgba(245,158,11,.14);
  --success: #059669; --danger: #dc2626; --warn: #b45309;
  --shadow: 0 10px 30px -14px rgba(30,41,90,.25); --glow: radial-gradient(60% 50% at 50% 0%, rgba(91,140,255,.12), transparent 70%);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 14.5px/1.5 Inter, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
.fa-solid, .fa-regular { width: 1.15em; text-align: center; flex: none; }
.card-head .ic i { font-size: 15px; } .stat .ic i { font-size: 19px; } .empty .ic i { font-size: 22px; } .tag button i { font-size: 10px; width: auto; } .btn i { font-size: 13px; }
button { font: inherit; color: inherit; cursor: pointer; }
::selection { background: var(--primary-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }

/* Layout */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; }
.logo { width: 40px; height: 40px; border-radius: 12px; background: var(--grad); display: grid; place-items: center; color: #fff; box-shadow: 0 8px 20px -8px rgba(91,140,255,.7); }
.logo i { font-size: 19px; width: auto; }
.brand b { display: block; font-size: 15.5px; letter-spacing: -.01em; } .brand span { color: var(--muted); font-size: 12px; }
.nav-group { margin-top: 14px; } .nav-group > small { display: block; padding: 0 10px 6px; color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 10px; color: var(--muted); text-align: left; transition: background .15s, color .15s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item .pill { margin-left: auto; }
.side-foot { margin-top: auto; padding-top: 16px; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.me > div:not(.avatar) { min-width: 0; flex: 1; } .me b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .me span { color: var(--muted); font-size: 12px; }
.main { min-width: 0; background: var(--glow) no-repeat top center / 100% 340px; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: var(--bg); border-bottom: 1px solid var(--border); }
.top .spacer { flex: 1; }
.page { max-width: 1120px; margin: 0 auto; padding: 28px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; letter-spacing: -.02em; } .page-head p { color: var(--muted); margin-top: 4px; max-width: 640px; } .page-head .grow { flex: 1; min-width: 240px; }
.menu-btn { display: none; }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-head .ic { width: 36px; height: 36px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: none; }
.card-head h3 { font-size: 16px; letter-spacing: -.01em; } .card-head p { color: var(--muted); font-size: 13px; margin-top: 2px; } .card-head .grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 16px; } .g4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); } .g2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.stat { display: flex; align-items: center; gap: 14px; padding: 18px; margin: 0; }
.stat .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary); }
.stat .ic.green { background: var(--success-soft); color: var(--success); } .stat .ic.red { background: var(--danger-soft); color: var(--danger); } .stat .ic.amber { background: var(--warn-soft); color: var(--warn); }
.stat b { display: block; font-size: 26px; line-height: 1.1; letter-spacing: -.02em; } .stat span { color: var(--muted); font-size: 13px; }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); font-weight: 500; transition: transform .08s, background .15s, border-color .15s, opacity .15s; white-space: nowrap; }
.btn:hover { background: var(--surface-3); } .btn:active { transform: translateY(1px); } .btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 8px 18px -10px rgba(91,140,255,.9); } .btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); } .btn.danger:hover { background: var(--danger); color: #fff; }
.btn.success { background: var(--success-soft); border-color: transparent; color: var(--success); } .btn.success:hover { background: var(--success); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); } .btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; } .btn.icon { padding: 9px; }
input, select, textarea { width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--border-2); border-radius: 10px; padding: 9px 12px; font: inherit; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { min-height: 84px; resize: vertical; } input::placeholder, textarea::placeholder { color: var(--faint); }
select { cursor: pointer; } select option { background: var(--surface); color: var(--text); }
.hint-box { display: flex; gap: 10px; padding: 11px 14px; border-radius: 12px; background: var(--primary-soft); color: var(--text); font-size: 13px; margin: 4px 0 16px; } .hint-box i { color: var(--primary); margin-top: 3px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; } .kv > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; } .kv b { display: block; font-size: 20px; letter-spacing: -.01em; } .kv span { color: var(--muted); font-size: 12.5px; }
.cmd-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 28px; } .cmd-line { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); } .cmd-line code { min-width: 82px; color: var(--primary); } .cmd-line span { color: var(--muted); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.field { margin-bottom: 14px; } .field > label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; } .field small { display: block; margin-top: 5px; color: var(--muted); font-size: 12.5px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 18px; }
.fields .wide { grid-column: 1 / -1; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); } .toggle-row:last-child { border-bottom: 0; }
.toggle-row b { display: block; font-weight: 600; font-size: 14px; } .toggle-row span { color: var(--muted); font-size: 12.5px; }
.switch { position: relative; width: 44px; height: 25px; flex: none; display: inline-block; } .switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--border-2); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.3); transition: transform .2s; }
.switch input:checked + i { background: var(--grad); } .switch input:checked + i::after { transform: translateX(19px); } .switch input:focus-visible + i { box-shadow: 0 0 0 3px var(--primary-soft); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; } .row > .grow { flex: 1; min-width: 150px; }
.save-bar { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--border); }

/* Bits */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--primary-soft); color: var(--primary); }
.pill.green { background: var(--success-soft); color: var(--success); } .pill.red { background: var(--danger-soft); color: var(--danger); } .pill.amber { background: var(--warn-soft); color: var(--warn); } .pill.grey { background: var(--surface-3); color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); display: inline-block; } .dot.on { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; flex: none; aspect-ratio: 1; background-size: cover; background-position: center; background-repeat: no-repeat; } .avatar.sm { width: 28px; height: 28px; font-size: 11.5px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); } .empty .ic { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 16px; background: var(--surface-2); display: grid; place-items: center; color: var(--faint); }
.table-wrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
table { width: 100%; border-collapse: collapse; } th { text-align: left; padding: 10px 12px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; } tr:last-child td { border-bottom: 0; } tr.click { cursor: pointer; } tr.click:hover td { background: var(--surface-2); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; } .tag { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 12px; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 99px; font-size: 13px; } .tag button { border: 0; background: var(--surface-3); border-radius: 50%; width: 20px; height: 20px; display: grid; place-items: center; color: var(--muted); padding: 0; } .tag button:hover { background: var(--danger); color: #fff; }
.toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 12px 16px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--border-2); box-shadow: var(--shadow); animation: up .25s ease; max-width: 360px; } .toast.err { border-color: var(--danger); } .toast.ok { border-color: var(--success); }
@keyframes up { from { opacity: 0; transform: translateY(10px); } }
.chart { width: 100%; height: 190px; display: block; } .chart text { fill: var(--faint); font-size: 10px; } .chart .bar { fill: url(#barg); transition: opacity .15s; } .chart .bar:hover { opacity: .75; } .chart line { stroke: var(--border); }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); } .list-item:last-child { border-bottom: 0; } .list-item .grow { flex: 1; min-width: 0; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs { display: flex; flex-wrap: wrap; max-width: 100%; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 16px; } .tabs button { border: 0; background: none; padding: 7px 14px; border-radius: 9px; color: var(--muted); font-weight: 500; } .tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Chat history */
.chatbox { height: 62vh; overflow: auto; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg); }
.cm { display: flex; gap: 10px; padding: 6px 8px; border-radius: 10px; } .cm:hover { background: var(--surface); }
.cm .body { min-width: 0; flex: 1; } .cm .hd { font-size: 12.5px; color: var(--muted); } .cm .hd b { color: var(--text); cursor: pointer; margin-right: 4px; }
.cm .tx { white-space: pre-wrap; word-break: break-word; } .cm.deleted { background: color-mix(in srgb, var(--danger) 7%, transparent); } .cm.deleted .tx { opacity: .9; }
.cm.service { justify-content: center; } .cm.service .tx { color: var(--muted); font-size: 12.5px; font-style: italic; }
.cm .ac { display: none; gap: 2px; } .cm:hover .ac { display: flex; } .cm .ac button { border: 0; background: var(--surface-3); border-radius: 8px; width: 28px; height: 28px; }
.day { text-align: center; margin: 14px 0 8px; } .day span { background: var(--surface-2); color: var(--muted); font-size: 11.5px; padding: 3px 12px; border-radius: 99px; border: 1px solid var(--border); }
.bubble { padding: 10px 14px; border-radius: 14px; margin: 8px 0; max-width: 78%; white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border: 1px solid var(--border); }
.bubble.out { margin-left: auto; background: var(--primary-soft); border-color: transparent; } .bubble small { display: block; margin-top: 4px; color: var(--muted); font-size: 11.5px; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(70% 60% at 20% 10%, rgba(91,140,255,.22), transparent 60%), radial-gradient(60% 60% at 90% 90%, rgba(139,92,246,.2), transparent 60%), var(--bg); }
.login { width: min(440px, 100%); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(18px); border: 1px solid var(--border-2); border-radius: 24px; padding: 34px; box-shadow: 0 30px 80px -30px rgba(0,0,0,.7); text-align: center; }
.login .logo { width: 60px; height: 60px; border-radius: 18px; margin: 0 auto 18px; } .login .logo i { font-size: 27px; }
.login h1 { font-size: 26px; letter-spacing: -.02em; } .login .lead { color: var(--muted); margin: 8px 0 22px; }
.feat { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 22px 0 0; text-align: left; } .feat span { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12.5px; } .feat i { color: var(--success); font-size: 12px; width: auto; }
.code { font: 700 40px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 12px; padding: 18px 0 18px 12px; margin: 10px 0; background: var(--surface-2); border: 1px dashed var(--border-2); border-radius: 16px; }
.steps { text-align: left; margin: 20px 0 6px; display: grid; gap: 12px; } .steps div { display: flex; gap: 12px; align-items: center; } .steps em { width: 26px; height: 26px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-style: normal; font-weight: 700; font-size: 13px; flex: none; }
.spin { width: 16px; height: 16px; border: 2px solid var(--border-2); border-top-color: var(--primary); border-radius: 50%; animation: sp .8s linear infinite; display: inline-block; } @keyframes sp { to { transform: rotate(360deg); } }

:root.compact body { font-size: 13.5px; } .compact .card { padding: 14px; } .compact .page { padding-top: 16px; padding-bottom: 16px; } .compact table td, .compact table th { padding-top: 6px !important; padding-bottom: 6px !important; } .compact .nav-item { padding-top: 6px; padding-bottom: 6px; }
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; left: 0; top: 0; width: min(300px, calc(100vw - 48px)); height: 100dvh; max-height: 100vh; padding-top: calc(18px + env(safe-area-inset-top)); transform: translateX(-102%); transition: transform .25s ease; box-shadow: var(--shadow); }
  body.nav-open .side { transform: none; } body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; cursor: pointer; }
  .menu-btn { display: inline-flex; } .top { flex-wrap: wrap; padding: 12px 16px; } .page { padding: 18px 16px; } .page-head h1 { font-size: 22px; }
  .g2 { grid-template-columns: 1fr; } .chatbox { height: 56vh; } .bubble { max-width: 92%; }
}
@media (max-width: 600px) {
  .top { gap: 8px; padding: 10px 12px; }
  .top select { width: min(48vw, 220px) !important; min-width: 0 !important; }
  .top .spacer { flex: 1 1 0; }
  .page { padding: 14px 12px; }
  .page-head .grow { min-width: 0; }
  .card { padding: 16px; }
  .g4, .g2 { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Mehrfachauswahl, Dialog, kleine Kennzahlen */
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 8px; }
.field > label.check, label.check { display: flex; align-items: center; gap: 10px; margin: 0; padding: 11px 14px; font-weight: 500; font-size: 14px; cursor: pointer; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 12px; transition: border-color .15s, background .15s, box-shadow .15s; user-select: none; }
label.check:hover { border-color: var(--primary); }
label.check input { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; flex: 0 0 20px; padding: 0; border-radius: 6px; border: 1.5px solid var(--border-2); background: var(--surface); display: grid; place-content: center; cursor: pointer; box-shadow: none; }
label.check input::after { content: ''; width: 10px; height: 6px; border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform .12s; }
label.check input:checked { background: var(--grad); border-color: transparent; }
label.check input:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
label.check:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-soft); }
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 4vh 16px; overflow: auto; }
.modal { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; max-width: 820px; width: 100%; padding: 22px; box-shadow: var(--shadow); }
.modal-x { position: absolute; top: 12px; right: 12px; border: 0; background: var(--surface-2); color: var(--muted); width: 32px; height: 32px; border-radius: 10px; cursor: pointer; }
.mini { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.mini b { font-size: 15px; } .mini span { color: var(--muted); font-size: 12px; }
.hist { max-height: 280px; overflow: auto; }
tr.click { cursor: pointer; } tr.click:hover { background: var(--surface-2); }

/* Benutzer-Dialog */
.um-head { display: flex; align-items: center; gap: 14px; margin: 0 40px 16px 0; flex-wrap: wrap; }
.um-head h3 { margin: 0; font-size: 20px; } .um-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.um-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.um-stat { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 12px; min-width: 0; }
.um-stat .ic { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; display: grid; place-content: center; background: var(--primary-soft); color: var(--primary); }
.um-stat b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .um-stat span { display: block; color: var(--muted); font-size: 12px; }
.um-tabs { margin-bottom: 14px; }
.um-inputs { display: grid; grid-template-columns: 1fr 150px 120px; gap: 12px; margin-bottom: 4px; }
.ag-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.ag { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.ag-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; } .ag-h span { color: var(--muted); font-size: 12px; }
.ag-b { display: flex; flex-wrap: wrap; gap: 8px; }
.ab { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; transition: border-color .15s, background .15s; }
.ab:hover { border-color: var(--primary); background: var(--primary-soft); }
.ab.bad { color: var(--danger); } .ab.bad:hover { border-color: var(--danger); background: var(--danger-soft); }
.ab.ok { color: var(--success); } .ab.ok:hover { border-color: var(--success); background: var(--success-soft); }
.um-help { margin-top: 12px; color: var(--muted); font-size: 13px; } .um-help summary { cursor: pointer; } .um-help p { margin: 6px 0; }
.um-list { max-height: 360px; overflow: auto; }
@media (max-width: 700px) { .um-stats { grid-template-columns: repeat(2, 1fr); } .ag-grid, .um-inputs { grid-template-columns: 1fr; } }

/* Chatverlauf: Aktionsmenue */
.cm .cm-menu { border: 0; background: transparent; color: var(--faint); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; align-self: flex-start; flex: 0 0 30px; }
.cm:hover .cm-menu, .cm .cm-menu:focus { background: var(--surface-3); color: var(--text); }
.cm .cm-pick { width: 18px; height: 18px; flex: 0 0 18px; align-self: center; accent-color: var(--primary); } .cm.picked { background: var(--primary-soft); }
.pop { position: fixed; z-index: 200; min-width: 230px; max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; }
.pop-i { display: flex; align-items: center; gap: 10px; border: 0; background: none; color: var(--text); font: inherit; font-size: 14px; padding: 8px 10px; border-radius: 9px; cursor: pointer; text-align: left; }
.pop-i i { width: 16px; text-align: center; color: var(--muted); } .pop-i:hover { background: var(--surface-2); } .pop-i.bad, .pop-i.bad i { color: var(--danger); } .pop-i.bad:hover { background: var(--danger-soft); }
.pop-sep { padding: 10px 10px 4px; font-size: 12px; color: var(--muted); font-weight: 600; border-top: 1px solid var(--border); margin-top: 4px; }

.report { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; font: inherit; font-size: 14px; margin: 12px 0 0; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: 12.5px; }

/* Formularraster: Beschriftung, Eingabe und Hinweis stehen je Zeile auf einer Linie, auch wenn eine Beschriftung umbricht */
@supports (grid-template-rows: subgrid) {
  .fields > .field { display: grid; grid-template-rows: subgrid; grid-row: span 3; align-content: start; }
  .fields > .field > label { align-self: end; }
}

/* Sicherheit: Status-Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; font-size: 13px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.chip.on { color: var(--text); border-color: var(--success); background: var(--success-soft); } .chip.on i { color: var(--success); }

/* Seitenleiste: einklappbare Bereiche */
.nav-head { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 4px 10px 6px; border: 0; background: none; color: var(--faint); font: inherit; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; border-radius: 8px; }
.nav-head:hover { color: var(--text); } .nav-head i { font-size: 10px; transition: transform .15s; transform: rotate(-90deg); }
.nav-group.open > .nav-head i { transform: none; } .nav-group > .nav-items { display: none; } .nav-group.open > .nav-items { display: block; }
.row > input[type="date"], .row > input[type="datetime-local"] { width: auto; flex: 0 0 auto; }

button.chip { font: inherit; font-size: 13px; cursor: pointer; transition: border-color .15s, background .15s; }
button.chip:hover:not(:disabled) { border-color: var(--primary); }
button.chip:disabled { cursor: default; opacity: .7; }

/* Wortfilter-Listen */
details.wl > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 2px 0; } details.wl > summary::-webkit-details-marker { display: none; }
details.wl > summary::before { content: '\25B8'; color: var(--muted); transition: transform .15s; } details.wl[open] > summary::before { transform: rotate(90deg); }
.wl-name { font-weight: 600; font-size: 16px; } .wl-body { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.help-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; color: var(--muted); } .help-list b { color: var(--text); }
.pill.blue { background: var(--primary-soft); color: var(--primary); }
.role-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.role-row > .grow { flex: 1 1 220px; min-width: 200px; }
.role-row > select { flex: 0 0 230px; width: 230px; }
.table-wrap .pill { white-space: nowrap; }
.cond-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px; margin-bottom: 8px; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 12px; }
.cond-group { padding: 12px; margin: 8px 0; border: 1px dashed var(--border-2); border-radius: 12px; }
.rule-step { display: flex; gap: 14px; align-items: flex-start; margin: 14px 0; }
.rule-tag { flex: 0 0 64px; text-align: center; padding: 8px 0; border-radius: 10px; font-weight: 700; font-size: 13px; letter-spacing: .04em; background: var(--primary-soft); color: var(--primary); }
.rule-tag.alt { background: var(--warn-soft); color: var(--warn); } .rule-tag.ok { background: var(--success-soft); color: var(--success); }
.reply-form { margin-top: 8px; }
@media (max-width: 700px) { .rule-step { flex-direction: column; } .cond-row { flex-direction: column; } }
.an-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.an-tile { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 14px; }
.an-tile .ic { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border-radius: 11px; background: var(--primary-soft); color: var(--primary); }
.an-tile b { display: block; font-size: 22px; line-height: 1.15; }
.an-tile span { display: block; font-size: 12.5px; color: var(--muted); }
.an-tile small { display: block; font-size: 11.5px; color: var(--muted); }
.hist-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.hist-side { position: sticky; top: 12px; max-height: calc(100vh - 40px); overflow: auto; padding: 16px; }
.hist-flaglist { display: grid; gap: 8px; }
.hist-flag { padding: 10px 12px; border: 1px solid var(--border-2); border-radius: 12px; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.hist-flag:hover { border-color: var(--primary); background: var(--primary-soft); } .hist-flag.fresh { border-left: 3px solid var(--danger); }
.hist-snip { margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; word-break: break-word; font-size: 13.5px; }
.cm.flagged { border-left: 3px solid var(--warn); background: color-mix(in srgb, var(--warn) 6%, transparent); }
.cm.flagged.deleted { border-left-color: var(--danger); }
.cm-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; } .cm-orig { margin-top: 4px; font-size: 12.5px; color: var(--muted); font-style: italic; white-space: pre-wrap; word-break: break-word; }
.cm.flash { animation: cmflash 2.2s ease-out; } @keyframes cmflash { 0%, 55% { background: color-mix(in srgb, var(--primary) 35%, transparent); } 100% { background: transparent; } }
.cm-newest { position: absolute; right: 18px; bottom: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.4); z-index: 5; }
@media (max-width: 1100px) { .hist-wrap { grid-template-columns: 1fr; } .hist-side { position: static; max-height: 420px; } }

/* Datei-Auswahl im Look der Buttons */
input[type=file] { padding: 6px; color: var(--muted, #8a96ad); cursor: pointer; }
input[type=file]::file-selector-button { margin-right: 12px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface-3); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; transition: background .15s, border-color .15s; }
input[type=file]::file-selector-button:hover { background: var(--primary-soft); border-color: var(--primary); }

/* Auswahlfelder in Kartenköpfen dürfen die Beschreibung nicht verdrängen */
.card-head > select, .card-head > input, .card-head > div:not(.grow) > select { width: auto; min-width: 150px; max-width: 220px; flex: none; }
.card-head .grow { flex: 1 1 0; min-width: 0; }

/* Systemprotokolle */
.logbox { margin: 0; max-height: 460px; overflow: auto; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font: 12px/1.55 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-all; color: var(--text); }

/* Kartenköpfe mit Bedienelementen: Beschreibung bleibt lesbar, Bedienelemente rutschen bei Platzmangel darunter */
.card-head { flex-wrap: wrap; }
.card-head .grow { flex: 1 1 260px; }
.card-head > .row, .card-head > div:not(.grow):not(.ic) { margin-left: auto; }
/* Globale Standardwerte: alle Tabellen mit gleichen Spaltenbreiten */
.sysdef table { table-layout: fixed; width: 100%; }
.sysdef th:nth-child(1), .sysdef td:nth-child(1) { width: 38%; } .sysdef th:nth-child(2), .sysdef td:nth-child(2) { width: 34%; } .sysdef th:nth-child(3), .sysdef td:nth-child(3) { width: 28%; }

/* Befehlslisten: Befehlsnamen dürfen nicht aus ihrem Kasten laufen */
.cmd-line { align-items: flex-start; } .cmd-line code { flex: 0 0 auto; width: auto; min-width: 82px; max-width: 46%; white-space: normal; overflow-wrap: anywhere; } .cmd-line span { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }

/* Reiter und Auswahlfeld in einer Reihe sauber auf einer Linie */
.row > .tabs { margin-bottom: 0; } .row:has(> .tabs) { align-items: center; }

/* Nexora-Logo: das Symbol bringt Hintergrund und Rundung selbst mit */
.logo:has(img) { background: none; box-shadow: none; border-radius: 0; }
.logo img { width: 100%; height: 100%; display: block; border-radius: 22%; box-shadow: 0 8px 20px -8px rgba(91,140,255,.7); }
