:root {
  --bg: #f4f6f8; --card: #fff; --ink: #1c2530; --muted: #6b7785;
  --line: #d9e0e7; --primary: #1f6feb; --primary-ink: #fff;
  --ki: #eef3fb; --user: #e8f6ee; --err: #fdecec; --err-ink: #b42318;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
}

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .6rem 1rem; background: var(--card);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 1.1rem; }
.topbar-actions { display: flex; align-items: center; gap: .6rem; }
.adminlink { color: var(--muted); text-decoration: none; font-size: .9rem; }

/* Workspace: zwei Spalten */
.workspace {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
  padding: 1rem; max-width: 1400px; margin: 0 auto; align-items: start;
}
@media (max-width: 900px) { .workspace { grid-template-columns: 1fr; } }
.pane {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 1rem;
}
.pane h2 { margin: 0 0 .6rem; font-size: 1rem; }
.pane-chat { display: flex; flex-direction: column; min-height: 70vh; }

/* Formfelder */
label { display: block; margin: .5rem 0; font-size: .85rem; color: var(--muted); }
input, textarea, select {
  width: 100%; margin-top: .25rem; padding: .5rem; font-size: .95rem;
  color: var(--ink); border: 1px solid var(--line); border-radius: 6px;
  font-family: inherit; background: #fff;
}
textarea { resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .6rem; }
.opt { color: var(--muted); font-weight: 400; }

/* Buttons */
button {
  cursor: pointer; border: 1px solid var(--line); background: #fff;
  color: var(--ink); padding: .5rem .8rem; border-radius: 6px; font-size: .9rem;
}
button.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
button.ghost { background: transparent; color: var(--muted); }
button:disabled, button.busy { opacity: .6; cursor: progress; }
kbd { font-size: .7rem; opacity: .8; }

.voicebar { display: flex; align-items: center; gap: .6rem; margin: .5rem 0; }
#recBtn.recording { background: var(--err); color: var(--err-ink); border-color: var(--err-ink); }

/* Report-Block */
.report-block { margin-top: 1rem; border-top: 1px dashed var(--line); padding-top: .8rem; }
.copy { margin-top: .3rem; font-size: .8rem; }
.report-actions { display: flex; gap: .6rem; margin-top: .6rem; }

/* Chat */
.chat { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; padding: .3rem; }
.msg { padding: .5rem .7rem; border-radius: 8px; white-space: pre-wrap; max-width: 90%; font-size: .9rem; }
.msg.ki { background: var(--ki); align-self: flex-start; }
.msg.user { background: var(--user); align-self: flex-end; }
.msg.error { background: var(--err); color: var(--err-ink); align-self: stretch; max-width: 100%; }
.msg.system { background: transparent; color: var(--muted); align-self: center; font-style: italic; font-size: .8rem; padding: .2rem .5rem; }
.chat-input { display: flex; gap: .5rem; margin-top: .6rem; }
.chat-input textarea { flex: 1; }
.chat-input button { white-space: nowrap; }

/* History-Menü */
.history-menu summary { cursor: pointer; list-style: none; color: var(--muted); font-size: .9rem; }
.history-menu { position: relative; }
.history-list {
  position: absolute; right: 0; top: 1.6rem; width: 280px; max-height: 50vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.12); padding: .3rem; z-index: 20;
}
.histitem { padding: .45rem .5rem; border-radius: 6px; cursor: pointer; font-size: .85rem; }
.histitem:hover { background: var(--ki); }

/* Login */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 2rem; width: 320px; box-shadow: 0 8px 30px rgba(0,0,0,.08);
}
.login-card h1 { margin: 0 0 1rem; font-size: 1.2rem; text-align: center; }
.login-card button { width: 100%; margin-top: 1rem; }
.error-text { color: var(--err-ink); font-size: .85rem; margin: .6rem 0 0; min-height: 1em; }
.hidden { display: none !important; }
