:root {
  color-scheme: light;
  --bg: #f7f8f5;
  --surface: #ffffff;
  --text: #1a1c18;
  --muted: #5e6258;
  --primary: #315b2c;
  --danger: #ba1a1a;
  --line: #dfe4d9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

nav {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 8px;
}

nav a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--primary);
  text-decoration: none;
}

nav a:hover {
  background: #e5f0df;
}

.nav-badge {
  min-width: 22px;
  min-height: 22px;
  display: inline-grid;
  place-items: center;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.secondary-button {
  border: 1px solid var(--primary);
  background: var(--surface);
  color: var(--primary);
}

.icon-button {
  width: 40px;
  padding: 0;
  border-radius: 50%;
}

.login-shell {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(100%, 420px);
  display: grid;
  gap: 14px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

h1 {
  margin: 0 0 6px;
  font-size: 1.75rem;
  line-height: 1.2;
}

label {
  color: var(--muted);
  font-size: 0.94rem;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid #bfc7b8;
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
}

input[type="file"] {
  padding: 10px 12px;
}

select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #bfc7b8;
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
  font: inherit;
}

textarea {
  width: 100%;
  min-height: 120px;
  border: 1px solid #bfc7b8;
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  resize: vertical;
}

.error {
  margin: 0;
  color: var(--danger);
}

.content {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 24px;
}

.content p {
  color: var(--muted);
}

.practice-shell {
  display: grid;
  gap: 18px;
}

.practice-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.practice-head p,
.eyebrow {
  margin: 0;
  color: var(--muted);
}

.direction-form {
  display: grid;
  gap: 6px;
  min-width: 150px;
}

.practice-card,
.resolution,
.empty-state,
.upload-panel {
  display: grid;
  gap: 16px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.upload-shell {
  display: grid;
  gap: 18px;
}

.data-admin,
.delete-confirmation {
  display: grid;
  gap: 18px;
}

.data-list,
.delete-form {
  display: grid;
  gap: 14px;
}

.data-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.data-row h2 {
  margin: 0;
  font-size: 1.1rem;
}

.data-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.danger-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--danger);
  border-radius: 8px;
  color: var(--danger);
  text-decoration: none;
}

.review-shell {
  display: grid;
  gap: 18px;
}

.review-counter {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
}

.review-card {
  min-height: calc(100vh - 190px);
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1fr);
  gap: 18px;
  align-items: start;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.review-facts dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

.review-facts dl div {
  display: grid;
  gap: 4px;
}

.review-facts dt {
  color: var(--muted);
  font-size: 0.9rem;
}

.review-facts dd {
  margin: 0;
}

.review-facts pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
  font: inherit;
}

.review-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.correction-form {
  display: grid;
  grid-template-columns: minmax(140px, 190px) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.correction-form label {
  display: grid;
  gap: 6px;
}

.confirmation-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(280px, 1.1fr);
  gap: 18px;
  align-items: stretch;
}

.field-crop {
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #ffffff;
  border: 1px dashed #8a9482;
  border-radius: 8px;
  color: var(--text);
  font-size: 1.2rem;
}

@media (max-width: 720px) {
  .confirmation-layout,
  .review-card,
  .review-actions,
  .correction-form {
    grid-template-columns: 1fr;
  }
}

.practice-card h2 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.15;
}

.answer-form {
  display: grid;
  gap: 14px;
}

.help-panel {
  display: grid;
  justify-items: start;
  gap: 10px;
  padding-top: 2px;
}

.help-step {
  display: grid;
  gap: 6px;
  max-width: 68ch;
}

.help-step p,
.feedback-text {
  margin: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 6px;
}

fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

legend {
  color: var(--muted);
  font-size: 0.94rem;
}

fieldset input {
  width: auto;
  min-height: 0;
}

.resolution h2,
.empty-state h2 {
  margin: 0;
  font-size: 1.25rem;
}

.resolution dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.resolution dl div {
  display: grid;
  grid-template-columns: minmax(110px, 160px) 1fr;
  gap: 10px;
}

.resolution dt {
  color: var(--muted);
}

.resolution dd {
  margin: 0;
}

.analysis-list {
  margin: 0;
  padding-left: 20px;
}

.worksheet-shell {
  display: grid;
  gap: 24px;
}

.new-worksheet-form {
  display: grid;
  grid-template-columns: minmax(180px, 280px) auto;
  align-items: end;
  gap: 8px;
}

.new-worksheet-form label {
  grid-column: 1 / -1;
}

.worksheet-section {
  display: grid;
  gap: 12px;
}

.worksheet-section h2 {
  margin: 0;
  font-size: 1.2rem;
}

.worksheet-table,
.job-list {
  display: grid;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.worksheet-row,
.job-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) minmax(80px, 0.6fr) minmax(160px, 1fr) minmax(120px, 0.8fr);
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}

.worksheet-row:first-child,
.job-row:first-child {
  border-top: 0;
}

.worksheet-row-head {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.worksheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.worksheet-actions a {
  color: var(--primary);
  font-weight: 700;
}

.job-row {
  grid-template-columns: 1fr auto;
}

@media (max-width: 640px) {
  .practice-head,
  .resolution dl div,
  .form-grid,
  .new-worksheet-form,
  .worksheet-row {
    display: grid;
    grid-template-columns: 1fr;
  }
}

.profile-shell {
  display: grid;
  gap: 22px;
}

.profile-child,
.subject-section,
.next-steps {
  display: grid;
  gap: 16px;
}

.profile-child {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.profile-head {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 360px);
  gap: 18px;
  align-items: start;
}

.profile-head h2,
.subject-section h3,
.next-steps h3 {
  margin: 0;
}

.vocab-tile {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
}

.vocab-tile dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.vocab-tile dl div {
  display: grid;
  gap: 4px;
}

.vocab-tile dt {
  color: var(--muted);
  font-size: 0.85rem;
}

.vocab-tile dd {
  margin: 0;
  font-weight: 700;
}

.profile-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.profile-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: var(--surface);
}

.profile-table th,
.profile-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.profile-table th {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.profile-table td a {
  color: var(--primary);
  font-weight: 700;
}

.profile-table small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.evidence-row td {
  background: #f4f7ef;
}

.evidence-row h4 {
  margin: 0 0 8px;
}

.evidence-row ul,
.next-steps ol {
  margin: 0;
  padding-left: 20px;
}

@media (max-width: 720px) {
  .profile-head,
  .vocab-tile dl {
    grid-template-columns: 1fr;
  }
}

/* Uebungs-Hub */
.practice-hub { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; }
.hub-card {
  display: flex; flex-direction: column; gap: .3rem;
  padding: 1.1rem 1.3rem; min-width: 12rem; border-radius: 12px;
  border: 1px solid var(--md-outline, #cfd8dc); text-decoration: none;
  background: var(--md-surface, #fff); color: inherit;
}
.hub-card:hover { border-color: var(--md-primary, #1565c0); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.hub-title { font-weight: 600; font-size: 1.15rem; }
.hub-sub { font-size: .85rem; opacity: .75; }

/* Vorschlags-Review: eine Zeile pro Vorschlag (docs/vorschlaege-review-oberflaeche.md) */
table.suggestions { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
table.suggestions th, table.suggestions td { text-align: left; vertical-align: top; padding: 0.5rem 0.6rem; }
table.suggestions thead th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 2px solid var(--line, #d8d8d8); }
table.suggestions tbody tr { border-bottom: 1px solid var(--line, #ececec); }
table.suggestions tbody tr:hover { background: rgba(0, 0, 0, 0.025); }
.doc-row th { background: rgba(0, 0, 0, 0.045); font-weight: 600; padding-top: 0.9rem; }
.doc-meta { font-weight: 400; opacity: 0.7; margin-left: 0.5rem; font-size: 0.85rem; }
.cell-connection { width: 26%; }
.cell-connection .edge-type { display: inline-block; font-size: 0.78rem; opacity: 0.65; margin-right: 0.3rem; }
.cell-connection .target-kind { display: block; font-size: 0.78rem; opacity: 0.6; }
.supersede-flag { display: inline-block; margin-top: 0.2rem; font-size: 0.78rem; color: #8a1f11; }
/* Fundstelle: begrenzte Hoehe, damit eine Zeile eine Zeile bleibt. */
/* Die Fundstelle wird NICHT beschnitten: eine per CSS versteckte Zeile sieht aus
   wie ein fehlender Beleg. Der Treffer ist markiert, damit man ihn im
   OCR-Rauschen nicht suchen muss. */
.cell-evidence { width: 40%; }
.cell-evidence q { display: block; opacity: 0.85; font-style: italic; overflow-wrap: anywhere; }
.cell-evidence mark { background: #fff2a8; font-style: normal; font-weight: 600; padding: 0 0.1em; }
.evidence-warn { display: block; margin-top: 0.2rem; font-size: 0.78rem; color: #8a1f11; }
.evidence-empty { opacity: 0.6; }
.cell-rating { width: 20%; }
.rating { font-weight: 600; display: block; }
.rating-hoch { color: #1b5e20; }
.rating-mittel { color: #8a6100; }
.rating-niedrig { color: #8a1f11; }
.rating-reason { font-size: 0.82rem; opacity: 0.75; }
.cell-decision { width: 16%; white-space: nowrap; }
.decision-set { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.decision-set label { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.88rem; }
.review-decision .resolution, .review-decision .danger-link { font-size: 0.85rem; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 900px) {
  /* Schmal: die Tabelle bricht in Kaertchen um, eine Karte je Vorschlag. */
  table.suggestions thead { display: none; }
  table.suggestions tr { display: block; }
  table.suggestions td { display: block; width: auto; padding: 0.2rem 0; }
  table.suggestions tbody tr { padding: 0.6rem 0; }
}
