:root {
  --bg: #f3f3f1; --card: #fff; --ink: #1b1b1b; --muted: #6b6b6b; --line: #e4e1db;
  --gold: #c9a063; --gold-dark: #b48a4c; --gold-soft: #f3e9d8; --side: #1f1f1f; --side-ink: #eee;
  --ok: #2e7d32; --warn: #b26a00; --bad: #c62828; --info: #1565c0;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.45 "Segoe UI", "Open Sans", system-ui, sans-serif; color: var(--ink); background: var(--bg); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
a { color: var(--info); }
h1, h2, h3 { margin: 0 0 8px; font-weight: 600; }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; }

/* ---------- Layout */
.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-ink); padding: 18px 14px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; letter-spacing: .28em; font-size: 12px; font-weight: 600; }
.brand.big { justify-content: center; margin-bottom: 14px; color: var(--ink); }
.brand-mark { width: 26px; height: 26px; border: 3px solid var(--gold); border-radius: 50%; position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--gold); }
.sidebar-title { font-size: 17px; font-weight: 600; padding-bottom: 12px; border-bottom: 1px solid #333; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav a { color: var(--side-ink); text-decoration: none; padding: 11px 16px; border-radius: 24px; background: #2a2a2a; transition: background .15s; }
.nav a:hover { background: #343434; }
.nav a.active { background: var(--gold); color: #1b1b1b; font-weight: 600; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.sidebar-foot .link { color: var(--gold); background: none; border: 0; padding: 0; text-align: left; cursor: pointer; font: inherit; }
.main { padding: 22px 28px 60px; max-width: 1500px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); border-bottom: 3px solid var(--gold); display: inline-block; padding-bottom: 3px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Karten, Knöpfe, Formulare */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card + .card { margin-top: 16px; }
.card.accent { border-left: 4px solid var(--gold); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.btn { border: 0; border-radius: 22px; padding: 10px 20px; font: inherit; font-weight: 600; cursor: pointer; background: #e9e6df; color: var(--ink); transition: filter .15s, transform .05s; }
.btn:hover { filter: brightness(.96); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.gold { background: var(--gold); }
.btn.dark { background: var(--side); color: #fff; }
.btn.danger { background: #fde8e8; color: var(--bad); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.sm { padding: 6px 14px; font-size: 13px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #333; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #cfcac2; border-radius: 6px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
textarea { min-height: 90px; resize: vertical; }
.check { flex-direction: row; align-items: center; gap: 8px; padding-top: 22px; }
.check input { width: 18px; height: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .span2 { grid-column: span 2; }
.form-grid .span3 { grid-column: span 3; }
.form-grid .span4 { grid-column: span 4; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0 0 14px; }
legend { padding: 0 8px; font-weight: 600; color: var(--gold-dark); }
.feld.unsicher input, .feld.unsicher select { border-color: var(--warn); background: #fff8ec; }
.feld-leer input, .feld-leer select { background: #fafafa; }
.feld .tag { font-size: 11px; color: var(--warn); }
.chip { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; background: #eee; }
.chip.gold { background: var(--gold-soft); color: var(--gold-dark); }
.chip.ok { background: #e6f3e7; color: var(--ok); }
.chip.warn { background: #fff3e0; color: var(--warn); }
.chip.bad { background: #fde8e8; color: var(--bad); }
.chip.info { background: #e3eefb; color: var(--info); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.space { justify-content: space-between; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.toolbar label { min-width: 120px; }
.toolbar .search { flex: 1 1 260px; }

/* ---------- KPIs */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.kpi .big { font-size: 32px; font-weight: 300; }
.kpi .zeile { display: flex; justify-content: space-between; padding: 7px 0; border-top: 1px solid var(--line); }
.kpi .zeile b { color: var(--gold-dark); }
.kpi .titel { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: #444; }

/* ---------- Dropzone */
.dropzone { border: 2px dashed #cdbfa2; border-radius: var(--radius); background: #fcfaf6; padding: 34px 20px; text-align: center; cursor: pointer; transition: background .15s, border-color .15s; }
.dropzone.over { background: var(--gold-soft); border-color: var(--gold); }
.dropzone .ico { font-size: 42px; line-height: 1; margin-bottom: 8px; }
.dropzone b { display: block; font-size: 17px; }
.dropzone input { display: none; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 14px; }
.thumb { position: relative; border-radius: 8px; overflow: hidden; background: #ddd; aspect-ratio: 1; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.thumb .nr { position: absolute; left: 6px; top: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; padding: 1px 7px; border-radius: 10px; }
.thumb .art { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(27,27,27,.78); color: #fff; font-size: 11px; padding: 4px 6px; }
.thumb .x { position: absolute; right: 6px; top: 6px; background: rgba(0,0,0,.6); color: #fff; border: 0; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; line-height: 1; }
.fototipps { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 14px; }
.fototipps div { background: #f7f5f0; border-radius: 8px; padding: 8px 10px; font-size: 12.5px; }
.fototipps b { display: block; color: var(--gold-dark); }
.progress { margin-top: 16px; padding: 18px; border-radius: var(--radius); background: var(--gold-soft); display: flex; align-items: center; gap: 14px; }
.spinner { width: 26px; height: 26px; border: 3px solid #e0cfae; border-top-color: var(--gold-dark); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.bar { height: 6px; background: #e8dcc5; border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--gold-dark); width: 0; transition: width .3s; }

/* ---------- Prüfansicht */
.review { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
.review .thumbs { grid-template-columns: repeat(2, 1fr); margin-top: 0; }
.hinweisbox { border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; font-size: 14px; }
.hinweisbox.warn { background: #fff3e0; border-left: 4px solid var(--warn); }
.hinweisbox.bad { background: #fde8e8; border-left: 4px solid var(--bad); }
.hinweisbox.info { background: #e3eefb; border-left: 4px solid var(--info); }
.hinweisbox ul { margin: 4px 0 0; padding-left: 18px; }
.typwahl { display: flex; gap: 8px; flex-wrap: wrap; }
.typwahl label { flex-direction: row; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 20px; padding: 6px 14px; cursor: pointer; }
.typwahl input { width: auto; }
.typwahl label:has(input:checked) { background: var(--gold-soft); border-color: var(--gold); }
.note { display: inline-flex; gap: 3px; }
.note span { width: 14px; height: 14px; border-radius: 50%; background: #e0e0e0; }
.note.n1 span:nth-child(-n+1), .note.n2 span:nth-child(-n+2), .note.n3 span:nth-child(-n+3), .note.n4 span:nth-child(-n+4), .note.n5 span { background: var(--gold); }
.note.n4 span, .note.n5 span { background: var(--bad); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
tr.klick { cursor: pointer; } tr.klick:hover td { background: #faf8f3; }
/* ---------- Login, Toast, Lightbox */
.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 30% 20%, #2b2b2b, #141414); padding: 20px; }
.login-card { background: #fff; border-radius: 14px; padding: 34px 32px; width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.login-card h1 { text-align: center; }
.login-card p { text-align: center; margin: -8px 0 6px; }
.login-fehler { color: var(--bad); font-size: 14px; min-height: 18px; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--side); color: #fff; padding: 12px 20px; border-radius: 24px; box-shadow: 0 8px 30px rgba(0,0,0,.3); z-index: 50; max-width: 90vw; }
.toast.bad { background: var(--bad); } .toast.ok { background: var(--ok); }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); display: grid; place-items: center; z-index: 60; }
.lightbox img { max-width: 95vw; max-height: 92vh; object-fit: contain; }
.lb-close { position: absolute; top: 14px; right: 18px; font-size: 34px; background: none; border: 0; color: #fff; cursor: pointer; }
.leer { padding: 40px; text-align: center; color: var(--muted); }

.vt-vorschau ul { margin: 4px 0 10px; padding-left: 20px; }
.misch-hinweis { margin-top: 8px; }

/* Bilder sortieren und herunterladen (1.4) */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 55; padding: 16px; }
.modal-box { background: var(--card); border-radius: 14px; padding: 18px 22px; width: min(780px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.modal-box h2 { margin: 0; font-size: 18px; }
.lb-close.dunkel { position: static; color: var(--ink); font-size: 28px; line-height: 1; }

/* ================= Wissensportal ================= */
.nav .zahl { float: right; background: var(--bad); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.nav .trenner { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #888; margin: 10px 4px 0; }

/* Fragefeld */
.fragebox { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 18px; position: relative; }
.fragebox h1 { font-size: 22px; }
.frage-zeile { display: flex; gap: 10px; align-items: stretch; }
.frage-zeile input { font-size: 17px; padding: 14px 16px; border-radius: 28px; border: 2px solid #ddd5c6; }
.frage-zeile input:focus { outline: none; border-color: var(--gold); }
.mic { flex: none; width: 54px; border-radius: 50%; border: 0; background: var(--side); color: #fff; font-size: 22px; cursor: pointer; display: grid; place-items: center; }
.mic.an { background: var(--bad); animation: puls 1.1s ease-in-out infinite; }
.mic[disabled] { opacity: .35; cursor: not-allowed; }
@keyframes puls { 50% { box-shadow: 0 0 0 10px rgba(198,40,40,.15); } }
.senden { flex: none; border-radius: 28px; }
.vorschlag-liste { position: absolute; left: 18px; right: 18px; top: calc(100% - 10px); background: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.15); z-index: 20; overflow: hidden; }
.vorschlag-liste a { display: block; padding: 10px 16px; text-decoration: none; color: var(--ink); border-top: 1px solid var(--line); }
.vorschlag-liste a:first-child { border-top: 0; }
.vorschlag-liste a:hover, .vorschlag-liste a.aktiv { background: var(--gold-soft); }
.vorschlag-liste small { display: block; color: var(--muted); }
.hinweis-zeile { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* Kacheln */
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 18px; }
.kachel { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 18px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 6px; border: 2px solid transparent; transition: border-color .15s, transform .1s; min-height: 120px; }
.kachel:hover { border-color: var(--gold); transform: translateY(-1px); }
.kachel .sym { font-size: 30px; line-height: 1; }
.kachel b { font-size: 17px; }
.kachel span { color: var(--muted); font-size: 13px; }
.kachel.dunkel { background: var(--side); color: #fff; }
.kachel.dunkel span { color: #bbb; }

/* Antwort */
.antwort { margin-top: 16px; }
.antwort .kopf { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.quelle { font-size: 13px; color: var(--muted); }
.quelle a { font-weight: 600; }
.md h3 { font-size: 16px; margin: 14px 0 6px; color: var(--gold-dark); }
.md p { margin: 6px 0; }
.md ul, .md ol { margin: 6px 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md ol li::marker { font-weight: 700; color: var(--gold-dark); }
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 10px; }
.galerie.gross { grid-template-columns: 1fr; max-width: 820px; }
.galerie figure { margin: 0; background: #f4f2ee; border-radius: 8px; overflow: hidden; }
.galerie img { width: 100%; display: block; cursor: zoom-in; }
.galerie figcaption { font-size: 12px; color: var(--muted); padding: 4px 8px; }
video { width: 100%; max-height: 70vh; border-radius: 10px; background: #000; margin-top: 10px; }
.vorschlaege .satz { grid-template-columns: 1fr; }

/* Listen und Admin */
.liste-eintrag { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 10px; background: #f8f7f4; margin-bottom: 8px; cursor: pointer; border: 1px solid transparent; text-decoration: none; color: var(--ink); }
.liste-eintrag:hover { border-color: var(--gold); background: #fff; }
.liste-eintrag small { display: block; color: var(--muted); }
.reiter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.reiter a { padding: 8px 16px; border-radius: 20px; background: #e9e6df; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; }
.reiter a.active { background: var(--gold); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { flex-direction: row; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 20px; padding: 6px 12px; cursor: pointer; }
.checks input { width: auto; }
.checks label:has(input:checked) { background: var(--gold-soft); border-color: var(--gold); }
.tabelle-wrap { overflow-x: auto; }
td .btn.sm { white-space: nowrap; }

@media (max-width: 1000px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .span4, .form-grid .span3 { grid-column: span 2; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 12px 14px; gap: 8px; }
  .sidebar-title, .sidebar-foot .small, .nav .trenner { display: none; }
  .app > * { min-width: 0; }
  .nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px; padding: 0 14px 4px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 7px 12px; font-size: 14px; white-space: nowrap; flex: none; }
  .sidebar-foot { flex-direction: row; gap: 12px; margin: 0; }
  .main { padding: 14px 16px 50px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2, .form-grid .span3, .form-grid .span4 { grid-column: span 1; }
  .frage-zeile .senden { display: none; }
  .kacheln { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kachel { min-height: 100px; padding: 14px; }
}

/* Upload und Empfänger (1.1) */
.empfaenger { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.empfaenger .typwahl label { font-size: 14px; }
.upTitel { font-weight: 600; }
fieldset { min-width: 0; }
.liste-eintrag > div { min-width: 0; }
.liste-eintrag small { overflow-wrap: anywhere; }
