/* Prozessbeobachtung PWA – Farben wie in der Android-App */
:root {
  --bg: #f5f5f5; --card: #ffffff; --primary: #00695c; --primary-dark: #004d40;
  --text: #212121; --muted: #757575; --line: #e0e0e0; --danger: #c62828; --absent: #9e9e9e;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100dvh; display: flex; flex-direction: column; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 4px; background: var(--primary); color: #fff; padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; min-height: 52px; }
.bar h1 { font-size: 19px; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-back { background: none; border: 0; color: #fff; font-size: 24px; padding: 4px 12px 4px 0; cursor: pointer; }

main { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); width: 100%; max-width: 720px; margin: 0 auto; }

.btn { display: block; width: 100%; border: 0; border-radius: 6px; padding: 12px 14px; background: #e3e3e3; color: var(--text); font-size: 16px; cursor: pointer; text-align: center; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.btn:active { filter: brightness(.92); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.big { font-size: 17px; padding: 15px 14px; }
.btn.danger { background: #fff; color: var(--danger); box-shadow: inset 0 0 0 1px #e8b4b4; }
.btn:disabled, .btn.disabled { opacity: .45; pointer-events: none; }
.btn.sticky { position: sticky; bottom: calc(8px + env(safe-area-inset-bottom)); margin-top: 8px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.input { display: block; width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #bdbdbd; border-radius: 6px; background: #fff; color: var(--text); }
.input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.area { resize: vertical; min-height: 120px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; }
.lab { display: block; font-weight: 600; font-size: 14px; margin: 8px 0 2px; }
.check { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; }
.check input { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.sec { font-size: 19px; margin: 18px 0 0; padding-top: 12px; border-top: 1px solid #ccc; }
.sec:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.expl { color: #424242; font-size: 14px; margin: 2px 0 6px; }
.empty { color: var(--muted); text-align: center; padding: 24px; white-space: pre-line; }
.error { color: var(--danger); }
.headline { font-weight: 600; margin: 0 0 4px; }
.status { white-space: pre-line; font-size: 15px; }
.hint { border: 0; border-radius: 6px; background: #fff3e0; color: #8d4b00; padding: 10px 12px; text-align: left; font-size: 14px; cursor: pointer; }

.list { background: var(--card); border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.12); overflow: hidden; }
.grow { flex: 1; align-self: stretch; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; font-size: 17px; }
.row:last-child { border-bottom: 0; }
.row.static { cursor: default; }
.row:not(.static):active { background: #e8f3f1; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.num { width: 2.2em; flex: none; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.chev { color: #9e9e9e; font-size: 20px; }
.count, .avg { color: var(--primary-dark); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.remark { color: var(--muted); font-size: 14px; }
.grade-label { white-space: nowrap; font-weight: 600; color: var(--muted); }
.grade-label.g1, .grade-label.g2, .grade-label.g3, .grade-label.g4, .grade-label.g5, .grade-label.g6 { color: var(--text); font-size: 19px; min-width: 1.5em; text-align: center; }

/* Startbildschirm: kompakter Einstellungsblock mit Überschrift */
.settings { border-top: 1px solid #ddd; padding-top: 4px; margin-top: 4px; }
.settings h3 { font-size: 13px; font-weight: 700; color: #555; margin: 2px 4px 2px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.btn.mini, .mini { background: transparent; box-shadow: none; color: var(--muted); font-size: 14px; padding: 8px 4px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
.switch-label { gap: 8px; cursor: pointer; justify-content: center; }
.switch-text { hyphens: manual; overflow-wrap: normal; text-align: right; line-height: 1.2; }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 38px; height: 22px; border-radius: 11px; background: #bdbdbd; position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch:checked { background: var(--primary); }
.switch:checked::after { left: 18px; }
.footer { border: 0; background: none; color: var(--muted); font-size: 11px; text-align: center; padding: 2px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Notenaufnahme */
body[data-screen="grading"] main { gap: 10px; }
.progress { text-align: center; color: var(--muted); }
.student-num { text-align: center; color: var(--muted); font-size: 18px; }
.student-name { text-align: center; font-size: 30px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; margin-bottom: 6px; }
.grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; flex: 1; min-height: 210px; max-height: 340px; }
.grade { border: 0; border-radius: 8px; color: #fff; font-size: 40px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 3px rgba(0,0,0,.2); }
.grade.dark { color: #212121; }
.grade:active { filter: brightness(.88); }
.grade-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.grade-row .btn { padding: 14px 6px; font-size: 15px; }
.btn.absent { background: var(--absent); color: #fff; }
.btn.skip { background: #fff; }
.btn.remark { background: #fff; padding: 14px; }
.btn.remark.set { background: #e0f2f1; color: var(--primary-dark); font-weight: 600; }

/* Durchschnitt */
.filter { display: flex; flex-direction: column; gap: 8px; }
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.btn.chip { padding: 10px 4px; font-size: 15px; background: #fff; }
.datefield { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 2px; }
.range { border: 0; background: #e0f2f1; border-radius: 6px; padding: 8px 12px; text-align: left; white-space: pre-line; color: var(--primary-dark); cursor: pointer; font-size: 15px; }

/* Import */
.columns { display: flex; flex-direction: column; gap: 2px; }
.col-line { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.col-text { white-space: pre-line; font-size: 15px; }
.rank { width: 72px; flex: none; }
.preview { white-space: pre-wrap; background: #fff; border-radius: 6px; padding: 10px; font: 14px/1.4 ui-monospace, Menlo, Consolas, monospace; max-height: 50vh; overflow: auto; margin: 0; }

.card { background: #fff; border-radius: 6px; padding: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.12); display: flex; flex-direction: column; gap: 8px; }
.card-title { font-weight: 600; }

/* Dialoge */
.modal-back { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 440px; max-height: 90dvh; overflow: auto; padding: 18px 18px 10px; box-shadow: 0 8px 30px rgba(0,0,0,.3); display: flex; flex-direction: column; gap: 8px; }
.modal h2 { font-size: 19px; margin: 0; overflow-wrap: anywhere; }
.modal-text { margin: 0; white-space: pre-line; }
.modal .input { margin: 4px 0; }
.modal-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; margin-top: 6px; }
.modal-buttons.stacked { flex-direction: column; align-items: stretch; }
.btn.flat { width: auto; background: none; box-shadow: none; color: var(--primary); font-weight: 600; padding: 10px 12px; }
.btn.flat.primary { background: var(--primary); color: #fff; }
.btn.flat.danger { color: var(--danger); margin-right: auto; }
.modal-buttons.stacked .btn.flat { width: 100%; }
.choice-list { display: flex; flex-direction: column; }
.choice { border: 0; background: none; text-align: left; padding: 12px 6px; font-size: 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.choice:last-child { border-bottom: 0; }
.choice.selected { color: var(--primary); font-weight: 600; }

/* Sperre */
.lock { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 24px; }
.lock-box { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.lock-icon { width: 72px; height: 72px; border-radius: 16px; margin: 0 auto; }
.lock h2 { margin: 0; }
.lock-status { color: var(--muted); margin: 0; }
.pin { text-align: center; font-size: 22px; letter-spacing: .3em; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: #323232; color: #fff; padding: 10px 16px; border-radius: 6px; width: max-content; max-width: calc(100% - 32px); text-align: center; white-space: pre-line; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 40; font-size: 15px; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.update { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; border: 0; background: #2e7d32; color: #fff; padding: 14px calc(14px + env(safe-area-inset-bottom)); font-size: 15px; cursor: pointer; }

/* Prozessbeobachtung */
.settings-grid.three { grid-template-columns: 1fr 1.3fr 1fr; }
.radio { align-items: center; background: #fff; border-radius: 6px; padding: 10px 12px; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.members { color: #424242; font-size: 14px; white-space: pre-line; }
.center { text-align: center; }
.row-main strong { font-weight: 600; }
.page-title { font-size: 20px; margin: 0; text-align: center; overflow-wrap: anywhere; }
.field { gap: 6px; }
.field .card-title { overflow-wrap: anywhere; }
.field-text { min-height: 64px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 56px 1fr 1fr; gap: 8px; }
.field-row.cat { grid-template-columns: 56px 1fr; }
.note-btn, .absent-btn, .mic-btn { border: 0; border-radius: 6px; padding: 10px 6px; font-size: 16px; font-weight: 600; cursor: pointer; min-height: 44px; }
.mic-btn { background: #e0f2f1; font-size: 20px; }
.mic-btn.rec { background: #c62828; color: #fff; }
.absent-btn { background: var(--bg); color: var(--text); box-shadow: inset 0 0 0 1px #bdbdbd; font-weight: 400; }
.absent-btn.on { background: #616161; color: #fff; box-shadow: none; }
.note-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.grade.small { font-size: 28px; padding: 14px 0; }
.sticky-row { position: sticky; bottom: calc(8px + env(safe-area-inset-bottom)); margin-top: 8px; }
.btn.flat-gray { background: #fff; }
.grow-pre { flex: 1; max-height: none; }
