* { box-sizing: border-box; }
body { margin: 0; background: #eef3f5; color: #183144; font: 1rem/1.55 system-ui, sans-serif; }
main { width: min(100% - 2rem, 70rem); margin: clamp(1rem, 4vw, 3rem) auto; }
header, section { background: white; border: 1px solid #cddde1; border-radius: 12px; padding: clamp(.85rem, 3vw, 1.6rem); margin-bottom: 1rem; }
header { color: white; background: #183144; border-bottom: 5px solid #e5a57c; }
header p, h1, h2 { margin: 0 0 .45rem; }
h1 { font-size: clamp(1.65rem, 5vw, 2.8rem); line-height: 1.14; }
a { color: #215c61; }
nav, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; }
.exam { border-top: 5px solid #215c61; }
.exercise { border-top: 5px solid #a65929; }
label { display: block; margin: .7rem 0; font-weight: 650; }
input, select, textarea { display: block; width: 100%; max-width: 36rem; padding: .55rem; border: 1px solid #78929d; border-radius: 6px; color: inherit; background: white; font: inherit; }
input[type=checkbox] { display: inline; width: auto; margin-right: .45rem; }
fieldset { min-width: 0; border: 1px solid #cddde1; border-radius: 8px; margin: 1rem 0; }
button { font: inherit; font-weight: 650; padding: .55rem .8rem; border: 0; border-radius: 6px; color: white; background: #215c61; cursor: pointer; }
:focus-visible { outline: 3px solid #a65929; outline-offset: 3px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: .3rem 1rem; }
.time { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
body:has(form[action*="task="]) main { width: min(100% - 2rem, 42rem); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
td, th { padding: .5rem; border-bottom: 1px solid #cddde1; vertical-align: top; }
th { background: #edf4f6; }
.notice, .badge { padding: .55rem .7rem; background: #dcf0e7; border-radius: 6px; overflow-wrap: anywhere; }
.notice[role=alert] { background: #f9e3db; }
.badge { display: inline-block; font-weight: 650; }
progress, meter { width: 100%; accent-color: #215c61; }
.report-distributions { display: grid; gap: .9rem; margin-top: 1.35rem; }
.report-distribution { padding: .85rem 1rem; border: 1px solid #dce6e9; border-radius: 8px; }
.report-distribution h3 { margin: 0 0 .45rem; }
.report-distribution ul { list-style: none; margin: 0; padding: 0; }
.chart { display: grid; grid-template-columns: minmax(0, 13rem) minmax(2rem, 1fr) minmax(2ch, auto); align-items: center; gap: .65rem; padding: .16rem 0; overflow-wrap: anywhere; }
.chart strong { text-align: right; font-variant-numeric: tabular-nums; }
.chart-track { display: block; width: 100%; height: .48rem; }
.chart-track line { stroke: #cddde1; stroke-width: 1px; }
.chart-track rect { fill: #215c61; }
@media (max-width: 480px) {
    .chart { grid-template-columns: minmax(0, 1.55fr) minmax(2rem, 1fr) minmax(2ch, auto); gap: .45rem; }
}

@page { size: A4 portrait; margin: 14mm; }
@media print {
    body { background: white; color: black; font-size: 10pt; }
    main { width: auto !important; margin: 0; }
    header, section { padding: 0; border: 0; color: black; background: white; }
    header { padding-bottom: 5mm; border-bottom: 1px solid #666; }
    h1 { font-size: 19pt; }
    h2, h3 { break-after: avoid; }
    .screen-only, .print-admin main > :not(header):not(#statistik) { display: none !important; }
    .scroll { overflow: visible; }
    table { font-size: 8pt; table-layout: fixed; }
    td, th { padding: 2mm 1mm; overflow-wrap: anywhere; }
    tr, .chart { break-inside: avoid; }
    .report-distributions { gap: 3mm; margin-top: 4mm; }
    .report-distribution { padding: 2mm 0 0; border: 0; border-top: .25mm solid #bfc5c7; border-radius: 0; }
    .report-distribution h3 { margin: 0 0 1mm; }
    .chart { grid-template-columns: 56mm minmax(0, 1fr) minmax(2ch, auto); gap: 3mm; padding: .35mm 0; }
    .chart-track { height: 1.5mm; }
    .chart-track line { stroke: #c5c9cb; }
    .chart-track rect { fill: #283b43; }
    .task-sheet a::after { content: " [" attr(href) "]"; overflow-wrap: anywhere; }
}

.code-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr)); gap: .75rem; }
.code-card { min-width: 0; padding: .8rem 1rem; border: 1px dashed #78929d; }
.code-card h3, .code-card p { margin: 0 0 .35rem; }
.code-card code, .activation-address { overflow-wrap: anywhere; }
.code-reference { color: #46616d; font-size: .875em; }

@media print {
    .print-admin.print-codes main > #codebogen { display: block !important; }
    .print-admin.print-codes main > #statistik { display: none !important; }
    .code-cards { display: block; }
    .code-card { break-inside: avoid; padding: 3mm 4mm; margin-bottom: 3mm; border-color: #666; }
    .code-card h3, .code-card p { margin-bottom: 1mm; }
    .code-reference { color: black; }
}

.course-access main, .print-task main { width: min(100% - 2rem, 45rem); }
.join-panel button { min-height: 2.75rem; }
.feedback-choices { padding: .5rem 0 .25rem; border: 0; }
.feedback-choices legend { padding: 0; font-size: 1.12rem; font-weight: 700; }
.feedback-choices > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.feedback-choices label { position: relative; display: flex; align-items: center; gap: .55rem; min-height: 3rem; margin: 0; padding: .55rem .7rem; border: 1px solid #a3b6bf; border-radius: 9px; background: #f7fafb; cursor: pointer; }
.feedback-choices input { width: 1.1rem; height: 1.1rem; padding: 0; margin: 0; flex: 0 0 auto; accent-color: #215c61; }
.feedback-choices label:has(input:checked) { border-color: #215c61; box-shadow: inset 0 0 0 1px #215c61; background: #e4f2ee; }
.feedback-details { margin: 1.1rem 0; border-top: 1px solid #cddde1; padding-top: .7rem; }
.feedback-details summary { cursor: pointer; font-weight: 650; }
.student-tasks { list-style: none; display: grid; gap: .55rem; padding: 0; margin: 0; }
.student-tasks a { display: grid; grid-template-columns: minmax(3.6rem, auto) minmax(0, 1fr) auto; align-items: center; gap: .65rem; padding: .75rem; border: 1px solid #cddde1; border-radius: 9px; color: inherit; text-decoration: none; }
.student-tasks a:hover { border-color: #215c61; background: #f3f9f8; }
.task-id, .task-status { font-size: .875rem; }
.task-id { color: #46616d; }
.task-status { border-radius: 6px; padding: .18rem .5rem; background: #edf1f5; }
.task-status.is-entered { background: #d9f1e5; color: #174d36; }
@media (max-width: 480px) {
    .feedback-choices > div { grid-template-columns: 1fr; }
    .student-tasks a { grid-template-columns: 1fr auto; }
    .student-tasks a strong { grid-column: 1 / -1; grid-row: 2; }
}
.student-tasks a > strong:only-child { grid-column: 1 / -1; grid-row: 1; }

.report-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; margin: 1rem 0 1.35rem; }
.report-summary > div { padding: .65rem .9rem; border: 1px solid #cddde1; border-left: 4px solid #215c61; border-radius: 7px; }
.report-summary dt { color: #46616d; }
.report-summary dd { margin: 0; font-size: 1.6rem; line-height: 1.2; font-weight: 750; font-variant-numeric: tabular-nums; }
.median-help, .report-empty { color: #46616d; }
.report-empty { margin: 0; }
#statistik th:not(:first-child), #statistik td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
#statistik td:first-child { min-width: 11rem; }
#statistik tbody tr:nth-child(even) { background: #f5f8f9; }
@media print {
    .report-summary { gap: 4mm; margin: 3mm 0; break-inside: avoid; }
    .report-summary > div { padding: 2mm 3mm; border-left-width: .8mm; }
    .report-summary dd { font-size: 15pt; }
    #statistik td:first-child { min-width: 0; width: 24%; }
    #statistik th:first-child { width: 24%; }
    .median-help, .report-empty { color: #333; }
}

:root {
    --action: #17645d;
    --action-hover: #124f49;
    --action-tint: #eaf5f1;
    --action-border: #739e99;
    --danger: #8e3438;
}
button { background: var(--action); min-height: 2.65rem; }
button:hover { background: var(--action-hover); }
button.button-secondary { color: #174f4b; background: white; border: 1px solid var(--action-border); }
button.button-secondary:hover { background: var(--action-tint); }
button.button-danger { color: var(--danger); background: #fff7f6; border: 1px solid #c88f90; }
button.button-danger:hover { background: #f9e4e3; }
.report-toolbar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .65rem 1rem; padding: .75rem; margin: .75rem 0; background: #edf4f5; border-radius: 9px; }
.report-filter { display: flex; flex-wrap: wrap; align-items: end; gap: .55rem; }
.report-filter label { margin: 0; }
.report-filter select { margin-top: .2rem; }
.report-context { color: #46616d; margin-bottom: 0; }
.report-summary > div { background: #f5faf8; border-left-color: var(--action); }
.report-distribution { background: #fbfdfd; }
.report-distribution h3 { color: #183144; }
.chart strong { color: #174f4b; }
.chart-track rect { fill: var(--action); }
@media screen and (min-width: 880px) {
    .report-distributions { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
    .report-reasons { grid-column: 1 / -1; }
    .report-distribution:not(.report-reasons) .chart { grid-template-columns: minmax(0, 1.25fr) minmax(2rem, 1fr) minmax(2ch, auto); }
}
@media screen and (max-width: 500px) {
    .report-filter, .report-filter label, .report-toolbar > button { width: 100%; }
    .report-filter button { width: 100%; }
}
@media print {
    .report-distribution, .report-summary > div { background: white; }
    .report-summary > div { border-left-color: #555; }
    .chart-track rect { fill: #283b43; }
    .chart strong { color: black; }
}
