/* Grundgestaltung: weißer Hintergrund und durchgehend Arial. */
body { background: #fff; color: #222; font-family: Arial, sans-serif; line-height: 1.6; }
.saved-response { white-space: pre-wrap; overflow-wrap: anywhere; }
button, input, select, textarea { font-family: inherit; }

/* Begrenzte Lesebreite und hellgrauer Textcontainer ohne Schatten. */
.shell { max-width: 880px; }
.study-card { background: #f3f3f3; border-radius: 4px; }
/* Titel über dem gemeinsamen grauen Startseitenkasten. */
.page-title { color: #000; }
.light-panel { background: #fafafa; border: 1px solid #e5e5e5; border-radius: 4px; padding: 20px; }
.light-panel > :last-child { margin-bottom: 0 !important; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 12px; }
.information-list { padding-left: 1.25rem; }
.information-list li { margin-bottom: 10px; }
hr { border-color: #bbb; }

/* Rote Aufmerksamkeitshinweise, ansonsten neutrale Bedienelemente. */
.attention { background: #fff0f0; color: #762d2d; border: 1px solid #dfaaaa; border-radius: 4px; padding: 20px; }
.form-check-input:checked { background-color: #444; border-color: #444; }
.btn-primary {
  --bs-btn-bg: #444; --bs-btn-border-color: #444;
  --bs-btn-hover-bg: #222; --bs-btn-hover-border-color: #222;
  --bs-btn-active-bg: #222; --bs-btn-active-border-color: #222;
  --bs-btn-disabled-bg: #444; --bs-btn-disabled-border-color: #444;
}

/* Next-Button auf jeder Bildschirmbreite mittig anzeigen. */
.actions { display: flex; flex-direction: column; align-items: center; gap: 20px; min-height: 48px; text-align: center; }

/* Ausgeblendete Ansichten und Buttons bleiben trotz Bootstrap unsichtbar. */
[hidden] { display: none !important; }

/* Dezente Kontaktzeile mit anklickbarer E-Mail-Adresse. */
footer { color: #666; font-size: 12px; }
footer a { color: inherit; }
/* Siebenstufige Skalen: feste Spalten, gestreifte Zeilen, auf Mobilgeräten horizontal scrollbar. */
.survey-block { border: 1px solid #d5d5d5; padding: 20px; }
/* Gleiche Überschriftengröße wie in den anderen grauen Informationskästen. */
.survey-intro-title { font-size: 1.15rem; margin-bottom: 12px; }
.rating-table tbody tr.unanswered { background: #fce8e8; }
.rating-table tbody tr.unanswered > th { box-shadow: inset 3px 0 #b42318; }
.survey-scroll { overflow-x: auto; }
.rating-table { width: 100%; min-width: 850px; table-layout: fixed; font-size: 14px; }
.rating-table th, .rating-table td { padding: 10px 5px; vertical-align: middle; }
.rating-table thead th { font-size: 12px; font-weight: 400; text-align: center; }
.rating-table th:first-child { width: 44%; text-align: left; }
.rating-table tbody th { font-weight: 400; }
.rating-table tbody tr:nth-child(even) { background: #eee; }
.rating-choice { display: flex; align-items: center; justify-content: center; min-height: 36px; cursor: pointer; }
.rating-choice input { width: 18px; height: 18px; accent-color: #444; cursor: pointer; }

/* Tasks: AI über dem Editor auf allen Bildschirmbreiten. */
.task-shell { max-width: 1180px; }
.task-workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.task-workspace > * { min-width: 0; }
.editor-panel { border: 1px solid #ddd; border-radius: 4px; overflow: hidden; }
.editor-heading { display: flex; align-items: center; justify-content: space-between; padding: 16px; background: #f3f3f3; border-bottom: 1px solid #ddd; }
/* AI-Kasten wächst mit dem Inhalt, statt die gesamte Editorhöhe auszufüllen. */
.task-workspace { align-items: start; }
.coding-column { min-width: 0; }
.task-workspace > aside { align-self: start; }
#low-autonomy .ai-chat { height: auto; max-height: min(520px, 70vh); margin-top: 16px; }
#send-ai { align-self: flex-start; }
#ai-status:empty, #ai-error:empty, #submission-status:empty { display: none; }
.ai-chat { max-height: 460px; overflow-y: auto; background: #e8edf1; border: 1px solid #d4dde5; border-radius: 8px; padding: 14px; scrollbar-gutter: stable; }
.chat-loading { color: #595959; font-style: italic; }
/* Separate graue Sprechblasen: Teilnehmende rechts, AIProcure links; gleiche Schrift. */
.chat-message { background: #e8e8e8; color: #000; margin: 0 0 14px auto; padding: 12px 14px; max-width: 92%; border-radius: 14px 14px 4px 14px; overflow-wrap: anywhere; font-family: 'Segoe UI', sans-serif; font-size: 14px; line-height: 1.55; }
.chat-message.ai-answer { background: #dedede; margin-left: 0; margin-right: auto; border-radius: 14px 14px 14px 4px; }
.ai-disclaimer { margin: 12px 0 0; text-align: center; font-size: 11px; font-style: italic; line-height: 1.4; color: #595959; }
.chat-message > strong { display: block; font-family: inherit; font-size: inherit; font-weight: 700; margin-bottom: 4px; }
.chat-message > div { white-space: pre-wrap; }
/* Markdown-Codeblöcke behalten ihre eigene Gestaltung. */
.ai-answer > div { white-space: normal; }
.answer-text { white-space: pre-wrap; }
.answer-text:empty { display: none; }
.answer-text code { font-family: Consolas, 'Courier New', monospace; font-size: 13px; color: #263238; background: #edf0f2; padding: 2px 5px; border-radius: 3px; }
.answer-code { margin: 12px 0; background: #edf0f2; border: 1px solid #dce1e5; border-radius: 5px; overflow: hidden; }
.answer-code-language { padding: 6px 12px; font-size: 11px; color: #58636c; border-bottom: 1px solid #dce1e5; }
.answer-code pre { padding: 12px; margin: 0; overflow-x: auto; white-space: pre; }
.answer-code code { font-family: Consolas, 'Courier New', monospace; font-size: 13px; color: #263238; }
#send-ai { --bs-btn-bg: #2459a6; --bs-btn-border-color: #2459a6; --bs-btn-hover-bg: #194582; --bs-btn-hover-border-color: #194582; --bs-btn-active-bg: #194582; --bs-btn-active-border-color: #194582; }
/* Submit bleibt direkt unter dem Editor, unabhängig von der Länge des Chats. */
.code-submit { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
@media (max-width: 767px) { .task-workspace { grid-template-columns: 1fr; } }

/* Ergebnis links, exakt der ausgewertete Abgabecode rechts; mobil untereinander. */
.results-workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.results-workspace > * { min-width: 0; }
.results-workspace td { overflow-wrap: anywhere; }
@media (max-width: 767px) { .results-workspace { grid-template-columns: 1fr; } }

/* High Autonomy: zentrierte Delegation und Bestätigung im gleichen Stil wie AI-Chatblasen. */
#delegate-ai { display: block; margin: 16px auto 0; }
.delegation-bubble { max-width: 100%; margin-top: 0; margin-bottom: 14px; }

.result-task { margin: 24px 0 40px; }
.result-task .editor-panel { margin: 16px 0 24px; }
.result-task td { white-space: nowrap; overflow-wrap: normal; font: 13px/1.5 Consolas, monospace; }

#high-autonomy .delegation-bubble { background: #e6f2ff; color: #18334f; }
.task-feedback { font-weight: 700; text-align: center; margin: 24px 0; }

/* Gemeinsamer Fortschritt, dezent und auf kleinen Bildschirmen zentriert. */
.study-progress { width: min(320px, calc(100% - 48px)); margin: 20px auto 0; text-align: center; }
.study-progress-label { color: #555; font-size: 13px; margin-bottom: 6px; }
.study-progress progress { display: block; width: 100%; height: 6px; border: 0; border-radius: 999px; overflow: hidden; background: #e5e7eb; color: #2459a6; appearance: none; }
.study-progress progress::-webkit-progress-bar { background: #e5e7eb; border-radius: 999px; }
.study-progress progress::-webkit-progress-value { background: #2459a6; border-radius: 999px; }
.study-progress progress::-moz-progress-bar { background: #2459a6; border-radius: 999px; }
.bonus-feedback { font-weight: 700; text-align: center; }
.results-intro h1 { margin-bottom: 12px; }

/* Angebote sind per Maus und Tastatur einzeln aufklappbar. */
.quotation { margin-top: 14px; padding: 16px 20px; background: #fff; border: 1px solid #d4dde5; border-radius: 8px; }
.quotation summary { cursor: pointer; font-weight: 700; }
.quotation[open] summary { margin-bottom: 16px; }
.quotation p:last-child { margin-bottom: 0; }

/* High Autonomy: nur so hoch wie die sichtbaren Sprechblasen und der Button. */
#high-autonomy .ai-chat { height: auto; max-height: none; margin-top: 16px; overflow: visible; scrollbar-gutter: auto; }
#high-autonomy #delegate-ai { margin: 0 auto; }
#high-autonomy .delegation-bubble { margin-bottom: 12px; }
#high-autonomy .delegation-bubble:has(~ :not([hidden])) { margin-bottom: 12px; }
#high-autonomy .delegation-bubble:not(:has(~ :not([hidden]))) { margin-bottom: 0; }

/* Eingabe folgt den Nachrichten im normalen Layout innerhalb des blauen Chatfensters. */
#chat-composer { margin-top: 16px; }

/* Zustimmung absetzen; Blockanweisungen so dezent wie Skalenbeschriftungen. */
.consent-panel { border: 1px solid #b8b8b8; border-radius: 4px; padding: 16px; }
.survey-block > h2 { font-size: 14px; font-weight: 400; line-height: 1.6; }

/* ERP table: fixed reading window with a persistent header and keyboard scrolling. */
.erp-scroll { max-height: 420px; overflow: auto; border: 1px solid #ccc; border-radius: 4px; background: #fff; }
.erp-scroll:focus-visible { outline: 2px solid #2459a6; outline-offset: 3px; }
.erp-table { width: 100%; min-width: 900px; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.erp-table th, .erp-table td { padding: 12px; border-bottom: 1px solid #ddd; text-align: right; vertical-align: middle; }
.erp-table thead th { position: sticky; top: 0; background: #e5e8eb; z-index: 1; font-weight: 600; }
.erp-table th:first-child { text-align: left; min-width: 210px; }
.erp-table tbody th { font-weight: 400; }
.erp-table tbody tr:nth-child(even) { background: #f5f5f5; }

.review-task > summary { font-size: 1.15rem; font-weight: 700; cursor: pointer; }
#peer-justification > summary { font-size: 1rem; }
