:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #1b2430;
  --ink-2: #4a5566;
  --ink-3: #7a8494;
  --line: #e1e4e9;
  --brand: #1f2a37;
  --accent: #e8650a;
  --accent-ink: #ffffff;
  --accent-soft: #fdf0e6;
  --ok: #1f8a4c;
  --ok-soft: #e6f4ec;
  --danger: #c0352b;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); font-size: 16px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
[hidden] { display: none !important; }

/* Kopfzeile */
.topbar { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 24px; height: 56px; }
.brand { color: #fff; font-weight: 700; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { background: var(--accent); width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; font-weight: 800; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { white-space: nowrap; color: #cfd6e0; padding: 6px 12px; border-radius: 6px; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(255,255,255,.14); color: #fff; }
.user-menu { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.user-chip { color: #cfd6e0; font-size: .9rem; }
.btn-link { background: none; border: 0; color: #cfd6e0; cursor: pointer; font: inherit; font-size: .9rem; padding: 0; }
.btn-link:hover { color: #fff; text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }

/* Bausteine */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.muted { color: var(--ink-3); font-size: .9rem; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 2fr 1fr; }
.grid-cats { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; flex: 1; }
.breadcrumb { font-size: .9rem; color: var(--ink-3); margin-bottom: 8px; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none; }
.btn:hover { background: #f0f2f5; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #cf5908; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: #fdecea; }
.btn-sm { padding: 4px 10px; font-size: .85rem; }
.btn:disabled { opacity: .6; cursor: default; }

label { display: block; font-weight: 600; font-size: .9rem; margin: 14px 0 6px; }
input[type=text], input[type=password], input[type=search], select, textarea {
  width: 100%; font: inherit; padding: 9px 12px; border: 1px solid #cdd2da; border-radius: 8px; background: #fff; color: var(--ink); }
textarea { min-height: 220px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.hint { font-size: .82rem; color: var(--ink-3); margin-top: 4px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.error-box { background: #fdecea; color: var(--danger); border-radius: 8px; padding: 10px 12px; margin-top: 12px; font-size: .92rem; }

/* Suche (Startseite) */
.hero { background: var(--brand); color: #fff; border-radius: 14px; padding: 36px 28px; margin-bottom: 24px;
  background-image: linear-gradient(135deg, #1f2a37 0%, #2c3b4e 100%); }
.hero h1 { font-size: 1.8rem; margin-bottom: 6px; }
.hero p { color: #cfd6e0; margin: 0 0 18px; }
.search-box { display: flex; gap: 8px; max-width: 820px; flex-wrap: wrap; }
.search-box input { flex: 1 1 260px; width: auto; }
.search-box input { font-size: 1.05rem; padding: 12px 16px; border: 0; }
.search-box .btn { padding: 10px 20px; }

/* Kategorien */
.cat-tile { display: flex; gap: 12px; align-items: center; padding: 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--ink); box-shadow: var(--shadow); }
.cat-tile:hover { border-color: var(--accent); text-decoration: none; }
.cat-icon { font-size: 1.6rem; width: 44px; height: 44px; border-radius: 10px; background: var(--accent-soft); display: grid; place-items: center; flex: none; }
.cat-name { font-weight: 600; hyphens: auto; overflow-wrap: anywhere; }
.cat-tile > span:last-child { min-width: 0; }

/* Listen */
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list a.item { display: flex; gap: 12px; align-items: center; padding: 12px 4px; color: var(--ink); }
.list a.item:hover { background: #fafbfc; text-decoration: none; }
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 600; }
.item-meta { font-size: .85rem; color: var(--ink-3); }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: #eef0f3; color: var(--ink-2); white-space: nowrap; }
.badge-video { background: var(--accent-soft); color: #a8470a; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-open { background: #fff6dd; color: #8a6100; }
.empty { color: var(--ink-3); text-align: center; padding: 28px 8px; }

.tabs { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border-radius: 99px; color: var(--ink-2); font-weight: 500; font-size: .92rem; }
.tabs a.active { background: var(--brand); color: #fff; }
.tabs a:hover { text-decoration: none; background: #e8eaee; }
.tabs a.active:hover { background: var(--brand); }

/* Artikel */
.article-body { font-size: 1.02rem; }
.article-body h2 { margin-top: 1.4em; }
.article-body h3 { margin-top: 1.2em; }
.article-body ul, .article-body ol { padding-left: 1.4em; }
.article-body code { background: #f0f2f5; padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.article-body p { margin: 0 0 .9em; }
.media { display: grid; gap: 16px; margin: 16px 0; }
.media video, .media img { width: 100%; max-height: 70vh; border-radius: 8px; background: #000; display: block; }
.media img { background: none; width: auto; max-width: 100%; max-height: 480px; }
.media figure { margin: 0; }
.media figcaption { font-size: .85rem; color: var(--ink-3); margin-top: 4px; }
.files { list-style: none; padding: 0; margin: 8px 0 0; }
.files li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.files li:first-child { border-top: 0; }
.file-icon { font-size: 1.3rem; }

/* Fragen */
.answer { border-top: 1px solid var(--line); padding: 16px 0; }
.answer.solution { background: var(--ok-soft); border: 1px solid #bfe3cd; border-radius: 8px; padding: 16px; margin: 8px 0; }
.answer-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.author { font-weight: 600; }

/* Upload */
.dropzone { border: 2px dashed #cdd2da; border-radius: 10px; padding: 20px; text-align: center; color: var(--ink-2); cursor: pointer; background: #fafbfc; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { display: none; }
.pending-files { list-style: none; padding: 0; margin: 10px 0 0; font-size: .92rem; }
.pending-files li { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.pending-files li.removed { text-decoration: line-through; color: var(--ink-3); }
.progress { height: 8px; background: #e8eaee; border-radius: 99px; overflow: hidden; margin-top: 14px; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* Suche */
.result { padding: 14px 4px; border-top: 1px solid var(--line); }
.result:first-child { border-top: 0; }
.result mark { background: #ffe2b8; color: inherit; padding: 0 1px; border-radius: 2px; }
.result-title { font-weight: 600; font-size: 1.05rem; }

/* Tabelle */
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-3); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.table-wrap { overflow-x: auto; }

/* Anmeldung */
.auth-wrap { min-height: 80vh; display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand-mark { width: 44px; height: 44px; font-size: 1.3rem; color: #fff; margin-bottom: 12px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--brand); color: #fff;
  padding: 10px 18px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.2); z-index: 50; max-width: calc(100% - 32px); }

/* Benefits */
.benefits-banner { display: flex; align-items: center; gap: 16px; background: #2d6a4f; color: #fff; border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.benefits-banner:hover { text-decoration: none; background: #275d45; }
.bb-icon { font-size: 2rem; flex: none; }
.bb-text { flex: 1; line-height: 1.4; }
.bb-text strong { font-size: 1.1rem; }
.bb-arrow { font-size: 2rem; opacity: .8; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
label.check input { width: 18px; height: 18px; }

/* Sprache */
.lang-switch { background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 6px; padding: 3px 6px; font: inherit; font-size: .85rem; width: auto; cursor: pointer; }
.lang-switch option { color: #000; }
.lang-links { display: flex; justify-content: flex-end; gap: 4px; margin-bottom: 8px; }
.btn-lang { background: none; border: 1px solid var(--line); border-radius: 99px; padding: 3px 12px; font: inherit; font-size: .85rem; color: var(--ink-2); cursor: pointer; }
.btn-lang.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.hero-note { margin: 14px 0 0 !important; font-size: .92rem; }
.tr-note { background: #eef4ff; border: 1px solid #cddcf7; color: #23406e; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; font-size: .92rem; }
.btn-link-dark { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }

/* KI-Assistent */
.btn-ai { background: #fff; color: var(--brand); border-color: #fff; }
.btn-ai:hover { background: var(--accent-soft); }
.chat-wrap { max-width: 860px; margin: 0 auto; }
.chat-log { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.chat-empty { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg-user { justify-content: flex-end; }
.msg-user .bubble { background: var(--brand); color: #fff; border-radius: 14px 14px 4px 14px; padding: 10px 14px; max-width: 80%; overflow-wrap: anywhere; }
.msg-ai .bubble { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 4px 14px 14px 14px; padding: 12px 16px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.msg-ai .article-body p:last-child { margin-bottom: 0; }
.ai-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; flex: none; }
.ai-status { color: var(--ink-3); font-size: .9rem; display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite both; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.sources { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .88rem; }
.source-chip { background: #f0f2f5; color: var(--ink); padding: 3px 10px; border-radius: 99px; }
.source-chip:hover { background: var(--accent-soft); text-decoration: none; }
.ai-foot { margin-top: 10px; font-size: .88rem; color: var(--ink-3); }
.chat-input { display: flex; gap: 8px; align-items: flex-end; position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; }
.chat-input textarea { min-height: 52px; resize: none; }
.chat-input .btn { height: 52px; }

/* Mobil */
@media (max-width: 760px) {
  .grid-2 { grid-template-columns: 1fr; }
  .topbar-inner { height: auto; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; gap: 8px 16px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .user-menu { margin-left: auto; }
  .user-chip { display: none; }
  .hero { padding: 24px 18px; }
  .hero h1 { font-size: 1.4rem; }
  .card { padding: 16px; }
  .container { padding-top: 16px; }
}
