:root {
  --bg: #0f172a;
  --bg-grad-1: #1e1b4b;
  --bg-grad-2: #0f172a;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #0f172a;
  --text-soft: #475569;
  --muted: #94a3b8;
  --primary: #4f46e5;
  --primary-d: #4338ca;
  --primary-soft: #eef2ff;
  --good: #16a34a;
  --good-soft: #dcfce7;
  --bad: #dc2626;
  --bad-soft: #fee2e2;
  --ring: rgba(79, 70, 229, 0.35);
  --border: #e2e8f0;
  --shadow: 0 10px 30px rgba(2, 6, 23, 0.10);
  --shadow-sm: 0 2px 8px rgba(2, 6, 23, 0.08);
  --radius: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

/* hidden-Attribut muss IMMER greifen (sonst überschreiben Klassen mit display: das Ausblenden). */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(99,102,241,0.25), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, rgba(168,85,247,0.18), transparent 55%),
    linear-gradient(160deg, var(--bg-grad-1), var(--bg-grad-2));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ===== Topbar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  cursor: pointer;
  user-select: none;
}
.brand-logo { font-size: 26px; line-height: 1; }
.brand-name { font-weight: 700; letter-spacing: 0.2px; font-size: 18px; }
.topbar-sub { color: #c7d2fe; font-size: 14px; font-weight: 500; }
.back-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.back-home:hover { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.32); }

/* ===== Layout ===== */
#app {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 18px 60px;
  flex: 1;
}
.screen { display: none; animation: fade 0.25s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ===== Hero ===== */
.hero { text-align: center; color: #fff; margin: 10px 0 22px; }
.hero h1 { font-size: clamp(24px, 5vw, 36px); margin: 0 0 10px; }
.hero-sub { color: #cbd5e1; max-width: 620px; margin: 0 auto; line-height: 1.55; }
.hero-sub strong { color: #fff; }

/* ===== Suche ===== */
.search-wrap { max-width: 420px; margin: 0 auto 22px; }
#search {
  width: 100%;
  padding: 13px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.96);
  font-size: 16px;
  outline: none;
  box-shadow: var(--shadow-sm);
}
#search:focus { box-shadow: 0 0 0 4px var(--ring); }

/* ===== Berufe-Grid ===== */
.job-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.job-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s;
  font: inherit;
  color: var(--text);
}
.job-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #c7d2fe; }
.job-card:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.job-icon {
  font-size: 30px;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  background: var(--primary-soft);
  border-radius: 14px;
}
.job-name { font-weight: 700; font-size: 16px; line-height: 1.3; }
.job-meta { color: var(--muted); font-size: 13px; }

/* ===== Karten allgemein ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* ===== Quiz-Kopf ===== */
.quiz-head { margin-bottom: 16px; }
.quiz-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.quiz-job { color: #fff; font-weight: 700; font-size: 17px; }
.quiz-count { color: #c7d2fe; font-size: 14px; font-weight: 600; white-space: nowrap; }

/* Badge "Fragen werden ergänzt …" während der Echtzeit-Generierung */
.gen-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 11px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.gen-badge[hidden] { display: none; }
.gen-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #818cf8;
  animation: genPulse 1.1s ease-in-out infinite;
}
@keyframes genPulse {
  0%   { transform: scale(0.8);  box-shadow: 0 0 0 0 rgba(129, 140, 248, 0.55); }
  70%  { transform: scale(1);    box-shadow: 0 0 0 7px rgba(129, 140, 248, 0); }
  100% { transform: scale(0.8);  box-shadow: 0 0 0 0 rgba(129, 140, 248, 0); }
}
@media (prefers-reduced-motion: reduce) { .gen-badge-dot { animation: none; } }
.progress {
  height: 10px;
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #818cf8, #6366f1);
  border-radius: 999px;
  transition: width 0.35s ease;
}

/* ===== Frage ===== */
.question-card { margin-bottom: 16px; }
.question-text { font-size: clamp(18px, 2.6vw, 22px); font-weight: 700; line-height: 1.4; margin: 4px 0 18px; }
.options { display: grid; gap: 10px; }
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 15px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 16px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.06s;
}
.option:hover:not(:disabled) { border-color: #a5b4fc; background: var(--primary-soft); }
.option:active:not(:disabled) { transform: scale(0.995); }
.option:disabled { cursor: default; }
.option .opt-key {
  flex: 0 0 28px;
  height: 28px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--surface-2);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-soft);
}
.option.correct { border-color: var(--good); background: var(--good-soft); }
.option.correct .opt-key { background: var(--good); color: #fff; }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.option.wrong .opt-key { background: var(--bad); color: #fff; }

/* ===== Feedback ===== */
.feedback {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border-left: 4px solid var(--primary);
}
.feedback-badge { font-weight: 800; margin-bottom: 6px; }
.feedback-badge.ok { color: var(--good); }
.feedback-badge.no { color: var(--bad); }
.feedback-badge.partial { color: #d97706; }
.feedback-why { margin: 0; color: var(--text-soft); line-height: 1.55; }
.feedback-why .fb-line { margin: 0 0 6px; }
.feedback-why .fb-line:last-child { margin-bottom: 0; }
.feedback-why .fb-muted { color: var(--muted); }

/* ===== Quiz-Fuss ===== */
.quiz-foot { display: flex; justify-content: space-between; gap: 12px; }

/* ===== Buttons ===== */
.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 13px 24px;
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.06s, box-shadow 0.15s, background 0.15s, opacity 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,0.4); }
.btn-primary:hover { background: var(--primary-d); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: rgba(255,255,255,0.9); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { background: #fff; }
.btn-danger { background: var(--bad); color: #fff; box-shadow: 0 6px 16px rgba(220,38,38,0.35); }
.btn-danger:hover { background: #b91c1c; }

/* ===== Ergebnis ===== */
.result-card { text-align: center; margin-bottom: 26px; }
.score-ring {
  width: 160px; height: 160px;
  margin: 6px auto 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--primary) 0deg, var(--surface-2) 0deg);
  position: relative;
}
.score-ring::before {
  content: "";
  position: absolute;
  inset: 14px;
  background: var(--surface);
  border-radius: 50%;
}
.score-pct { position: relative; font-size: 40px; font-weight: 800; }
.result-verdict { font-size: 24px; margin: 4px 0 6px; }
.result-verdict.pass { color: var(--good); }
.result-verdict.fail { color: var(--bad); }
.result-detail { color: var(--text-soft); margin: 0 0 20px; }
.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.result-actions.center { margin-top: 18px; }

/* ===== Review ===== */
.review-title { color: #fff; margin: 6px 0 14px; }
.review { display: grid; gap: 12px; }
.review-item {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--muted);
}
.review-item.ok { border-left-color: var(--good); }
.review-item.no { border-left-color: var(--bad); }
.review-item.partial { border-left-color: #d97706; }
.review-q { font-weight: 700; margin: 0 0 10px; line-height: 1.4; }
.review-line { margin: 4px 0; font-size: 15px; line-height: 1.5; }
.review-line .tag { font-weight: 700; }
.review-line.your .tag { color: var(--bad); }
.review-line.right .tag { color: var(--good); }
.review-why { margin: 10px 0 0; color: var(--text-soft); font-size: 15px; line-height: 1.55; }
.review-num { color: var(--muted); font-weight: 700; font-size: 13px; }

/* ===== Footer ===== */
.footer {
  text-align: center;
  color: rgba(255,255,255,0.5);
  font-size: 13px;
  padding: 18px;
}

@media (max-width: 480px) {
  #app { padding: 18px 14px 50px; }
  .card { padding: 18px; }
  .job-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .quiz-foot .btn { flex: 1; padding: 13px 14px; }
}

/* ===================================================================== */
/* ===== KI-Erweiterung: Badge, Generieren, RTX-Animation, Chat ======== */
/* ===================================================================== */

/* ---- KI-Badge auf Karten ---- */
.job-card { position: relative; }
.ai-badge {
  position: absolute;
  top: 10px; right: 10px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.5px;
  padding: 3px 8px; border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.45);
}
.job-del {
  position: absolute;
  top: 8px; left: 8px;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: #64748b;
  font-size: 12px; line-height: 1; font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.job-del:hover { background: var(--bad, #ef4444); color: #fff; transform: scale(1.08); }
.job-del:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

.ai-tools { display: flex; justify-content: center; margin: 14px 0 0; }

/* ---- Modus-Umschalter (Auswählen / Schreiben) ---- */
.mode-toggle {
  display: flex; gap: 0;
  max-width: 420px; margin: 0 auto 22px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px; padding: 4px;
}
.mode-btn {
  flex: 1; padding: 10px 14px;
  border: none; border-radius: 999px;
  background: transparent; color: #cbd5e1;
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.mode-btn:hover { color: #fff; }
.mode-btn.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4); }
.mode-hint { text-align: center; color: #cbd5e1; font-size: 14px; margin: -8px 0 22px; }

/* ---- Schreib-Modus ---- */
.write-area { display: grid; gap: 12px; }
#writeInput {
  width: 100%; box-sizing: border-box;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit; font-size: 16px; line-height: 1.5;
  color: var(--text); resize: vertical; min-height: 84px; outline: none;
}
#writeInput:focus { box-shadow: 0 0 0 4px var(--ring); border-color: #c7d2fe; }
#writeInput:disabled { opacity: 0.7; }
.write-actions { display: flex; justify-content: flex-end; }

/* ---- Buttons klein ---- */
.btn-sm { padding: 9px 16px; font-size: 14px; }

/* ---- Generieren-Panel ---- */
.generate-panel {
  margin-top: 26px;
  padding: 20px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  border: 1px dashed rgba(255, 255, 255, 0.2);
}
.generate-panel-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.gp-spark { font-size: 26px; line-height: 1; }
.gp-title { color: #fff; font-weight: 700; font-size: 17px; }
.gp-sub { color: #cbd5e1; font-size: 14px; }
.generate-row { display: flex; gap: 10px; flex-wrap: wrap; }
#genInput {
  flex: 1; min-width: 200px;
  padding: 13px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.96);
  font-size: 16px; outline: none;
  box-shadow: var(--shadow-sm);
}
#genInput:focus { box-shadow: 0 0 0 4px var(--ring); }
#genBtn:disabled { opacity: 0.55; cursor: progress; }

/* ---- Vorschlag-Banner + Fehler ---- */
.suggest-banner {
  margin-top: 14px; padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  border: 1px solid #c7d2fe;
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.suggest-text { color: var(--text); font-weight: 600; }
.suggest-text strong { color: var(--primary-d); }
.suggest-actions { display: flex; gap: 8px; }
.gen-error {
  margin-top: 12px; padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bad-soft); color: #991b1b;
  border: 1px solid #fecaca; font-weight: 600;
}

/* ---- RTX-Ladeanimation ---- */
.rtx-overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(8, 10, 26, 0.78);
  backdrop-filter: blur(8px);
  animation: fade 0.2s ease;
}
.rtx-overlay[hidden] { display: none; }
.rtx-box {
  width: 100%; max-width: 560px;
  background: linear-gradient(160deg, #11152e, #0b0f22);
  border: 1px solid rgba(124, 131, 253, 0.35);
  border-radius: 18px;
  padding: 22px;
  position: relative; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(124, 131, 253, 0.15), 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 60px rgba(99, 102, 241, 0.35);
}
.rtx-box::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, #22d3ee, #a855f7, #22d3ee, transparent);
  background-size: 200% 100%;
  animation: rtxEdge 2s linear infinite;
}
@keyframes rtxEdge { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.rtx-header { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.rtx-spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid rgba(124, 131, 253, 0.25);
  border-top-color: #22d3ee; border-right-color: #a855f7;
  animation: rtxSpin 0.8s linear infinite;
  flex: 0 0 auto;
}
@keyframes rtxSpin { to { transform: rotate(360deg); } }
.rtx-title { color: #e0e7ff; font-weight: 800; font-size: 16px; }
.rtx-job { color: #7dd3fc; font-size: 14px; margin-top: 2px; font-weight: 600; }
.rtx-dots span { animation: rtxBlink 1.4s infinite both; }
.rtx-dots span:nth-child(2) { animation-delay: 0.2s; }
.rtx-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes rtxBlink { 0%, 80%, 100% { opacity: 0; } 40% { opacity: 1; } }
.rtx-stage { position: relative; border-radius: 12px; overflow: hidden; max-height: 320px; }
.rtx-scan {
  position: absolute; left: 0; right: 0; top: 0; height: 90px; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, rgba(34, 211, 238, 0), rgba(34, 211, 238, 0.18), rgba(34, 211, 238, 0));
  filter: blur(2px);
  animation: rtxScan 2.2s ease-in-out infinite;
}
@keyframes rtxScan { 0% { transform: translateY(-100px); } 100% { transform: translateY(340px); } }
.rtx-skeletons { display: grid; gap: 14px; }
.sk-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px; padding: 14px;
}
.sk-line {
  height: 12px; border-radius: 6px; margin: 8px 0;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.12) 25%, rgba(148, 163, 184, 0.32) 37%, rgba(148, 163, 184, 0.12) 63%);
  background-size: 400% 100%;
  animation: rtxShimmer 1.4s ease infinite;
}
.sk-line.title { height: 16px; margin-bottom: 14px; }
.sk-opt { display: flex; align-items: center; gap: 10px; }
.sk-opt .sk-line { flex: 1; margin: 6px 0; }
.sk-key {
  flex: 0 0 22px; height: 22px; border-radius: 6px;
  background: linear-gradient(90deg, rgba(124, 131, 253, 0.18) 25%, rgba(124, 131, 253, 0.45) 37%, rgba(124, 131, 253, 0.18) 63%);
  background-size: 400% 100%;
  animation: rtxShimmer 1.4s ease infinite;
}
@keyframes rtxShimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.rtx-foot { margin-top: 16px; text-align: center; color: #94a3b8; font-size: 12px; letter-spacing: 0.3px; }

/* ---- Chat-Assistent ---- */
.chat-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 40;
  width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  box-shadow: 0 10px 26px rgba(99, 102, 241, 0.5);
  color: #fff; font-size: 26px; line-height: 1;
  display: grid; place-items: center;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}
.chat-fab:hover { transform: translateY(-2px) scale(1.04); }
.chat-fab.hidden { display: none; }
.chat-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 41;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 100px));
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: 18px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.45);
  border: 1px solid var(--border);
  animation: chatIn 0.18s ease;
}
.chat-panel[hidden] { display: none; }
@keyframes chatIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; color: #fff;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
}
.chat-head-title { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.chat-ai-dot { width: 9px; height: 9px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.3); }
.chat-close { background: transparent; border: none; color: #fff; font-size: 22px; cursor: pointer; line-height: 1; padding: 0 4px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.chat-msg { max-width: 85%; padding: 10px 13px; border-radius: 14px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.ai { align-self: flex-start; background: #fff; color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-msg.error { align-self: center; background: var(--bad-soft); color: #991b1b; text-align: center; }
.chat-typing { align-self: flex-start; display: flex; gap: 5px; padding: 13px 14px; background: #fff; border: 1px solid var(--border); border-radius: 14px; }
.chat-typing span { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; animation: rtxBlink 1.2s infinite; }
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
.chat-input-row { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); background: var(--surface); }
#chatInput { flex: 1; padding: 11px 14px; border-radius: 999px; border: 1px solid var(--border); font-size: 15px; outline: none; }
#chatInput:focus { box-shadow: 0 0 0 3px var(--ring); border-color: var(--primary); }
.chat-action { align-self: flex-start; max-width: 90%; }
.chat-action .btn { box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35); }
.chat-confirm {
  align-self: stretch;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  padding: 12px 14px;
}
.chat-confirm-text { margin: 0 0 10px; font-weight: 600; color: var(--text); line-height: 1.4; }
.chat-confirm-actions { display: flex; gap: 8px; }
.chat-confirm.done { opacity: 0.55; }

/* Markdown-Formatierung in KI-Nachrichten */
.chat-msg.ai { white-space: normal; }
.chat-msg.ai p { margin: 0 0 8px; }
.chat-msg.ai p:last-child { margin-bottom: 0; }
.chat-msg.ai .md-h { font-weight: 800; font-size: 15px; margin: 12px 0 6px; }
.chat-msg.ai > .md-h:first-child { margin-top: 0; }
.chat-msg.ai ul, .chat-msg.ai ol { margin: 6px 0; padding-left: 20px; }
.chat-msg.ai li { margin: 3px 0; }
.chat-msg.ai li:last-child { margin-bottom: 0; }
.chat-msg.ai strong { font-weight: 700; }
.chat-msg.ai a { color: #2563eb; text-decoration: underline; overflow-wrap: anywhere; }
.chat-msg.ai a:hover { color: #1d4ed8; }
.chat-msg.ai code {
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---- Eigenes Bestätigungs-Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(8, 10, 26, 0.6);
  backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 0.18s ease;
}
.modal-overlay.show { opacity: 1; }
.modal-box {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 0 1px rgba(2, 6, 23, 0.05);
  padding: 24px;
  transform: translateY(12px) scale(0.96);
  transition: transform 0.18s ease;
}
.modal-overlay.show .modal-box { transform: none; }
.modal-title { margin: 0 0 8px; font-size: 19px; font-weight: 800; color: var(--text); }
.modal-text { margin: 0 0 20px; color: var(--text-soft); line-height: 1.55; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
