:root {
  --ink: #1A1917; --soft: #4A4740; --mute: #8A857B;
  --paper: #F2F1EE; --line: #E2DED5; --accent: #6E7B55; --accent-dark: #56613F;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.5 "IBM Plex Sans", system-ui, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }
.soft { color: var(--soft); }

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--ink); padding: 22px 0; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 20px 26px; }
.brand .mark { width: 32px; height: 32px; border-radius: 4px; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-weight: 600; }
.brand strong { display: block; color: var(--paper); font-size: 14px; }
.brand small { display: block; color: var(--mute); font-size: 9px;
  letter-spacing: .08em; text-transform: uppercase; font-family: "IBM Plex Mono", monospace; }
.navitem { display: block; padding: 11px 20px; color: #A8A29A; font-size: 14px;
  border-left: 3px solid transparent; }
.navitem:hover { background: rgba(255,255,255,.07); color: #fff; }
.navitem.on { background: rgba(255,255,255,.09); color: #fff; border-left-color: var(--accent); }
.sidebar .foot { margin-top: auto; padding: 20px; border-top: 1px solid #2E2C28; }
.sidebar .who { color: #C9C4BA; font-size: 13px; font-weight: 500; }
.sidebar .mail { color: #7A756B; font-size: 10.5px; margin: 3px 0 12px;
  font-family: "IBM Plex Mono", monospace; }
.sidebar .foot a { color: #9A948A; font-size: 12.5px; border-bottom: 1px solid #3A3833; }

.main { padding: 32px clamp(20px, 3vw, 40px); min-width: 0; }
.head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end;
  justify-content: space-between; margin-bottom: 26px; }
.head h1 { font-size: 25px; margin: 0 0 6px; }
.head p { margin: 0; color: var(--soft); font-size: 14px; }
.actions { display: flex; gap: 10px; }
.sub { font-size: 18px; margin: 34px 0 14px; }

.btn { display: inline-block; background: var(--accent); color: #fff; padding: 10px 16px;
  border-radius: 4px; font-size: 13.5px; font-weight: 600; border: 0; cursor: pointer; }
.btn:hover { opacity: .88; color: #fff; }
.btn.ghost { background: #fff; color: var(--soft); border: 1px solid #D6D0C4; font-weight: 500; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.filters input, .filters select { padding: 10px 13px; border: 1px solid #D6D0C4;
  border-radius: 4px; background: #fff; font: inherit; }
.filters input { flex: 1 1 220px; }

.table { width: 100%; border-collapse: collapse; background: #fff;
  border: 1px solid var(--line); border-radius: 5px; overflow: hidden; font-size: 14px; }
.table th { text-align: left; padding: 12px 20px; background: #FAF9F7;
  border-bottom: 1px solid var(--line); font: 500 10.5px/1 "IBM Plex Mono", monospace;
  letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.table td { padding: 15px 20px; border-bottom: 1px solid #EFEDE7; vertical-align: middle; }
.table tbody tr:hover { background: #FAF9F7; cursor: pointer; }
.table .strong { font-weight: 600; }
.table .empty { text-align: center; color: var(--mute); padding: 40px 20px; cursor: default; }

.badge { font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 3px;
  white-space: nowrap; background: #EDEBE7; color: var(--soft); }
.badge.live { background: #E4EFE6; color: #2C5A38; }
.badge.draft { background: #F4EBDA; color: #7A5A1E; }
.badge.cancelled { background: #F6E4E4; color: #8A2C2C; }

.log { list-style: none; margin: 0; padding: 0; background: #fff;
  border: 1px solid var(--line); border-radius: 5px; }
.log li { padding: 12px 20px; border-bottom: 1px solid #EFEDE7; font-size: 13.5px; }
.log .mono { color: var(--mute); font-size: 11.5px; margin-right: 8px; }

.login-page { background: var(--ink); display: grid; place-items: center; min-height: 100vh;
  padding: 40px 24px; }
.login { width: 100%; max-width: 380px; }
.brand.dark { padding: 0 0 34px; }
.login .card { background: #fff; border-radius: 5px; padding: 30px; }
.login h1 { font-size: 19px; margin: 0 0 22px; }
.login label { display: block; font-size: 12.5px; font-weight: 600; color: var(--soft);
  margin: 0 0 7px; }
.login input { width: 100%; padding: 11px 13px; border: 1px solid #D6D0C4;
  border-radius: 4px; margin-bottom: 18px; font: inherit; }
.login button { width: 100%; background: var(--accent); color: #fff; border: 0;
  padding: 13px; border-radius: 4px; font: 600 14.5px inherit; cursor: pointer; }
.login .error { background: #F6E4E4; color: #8A2C2C; padding: 10px 12px;
  border-radius: 4px; font-size: 13.5px; margin: 0 0 18px; }
.login .hint { color: #6A655C; font-size: 12px; text-align: center;
  font-family: "IBM Plex Mono", monospace; margin-top: 20px; }
.stub { background: #fff; border: 1px solid var(--line); border-radius: 5px;
  padding: 40px; color: var(--soft); max-width: 60ch; }

@media (max-width: 860px) { .shell { grid-template-columns: 1fr; } .sidebar { display: none; } }

/* ---------- Formular ---------- */
.back { display: inline-block; font-size: 13px; margin-bottom: 16px; }
.note { border-radius: 4px; padding: 14px 18px; margin-bottom: 20px; font-size: 14px; }
.note.ok { background: #E4EFE6; color: #2C5A38; }
.note.bad { background: #F6E4E4; color: #8A2C2C; }
.note ul { margin: 8px 0 6px; padding-left: 20px; }

.split { display: grid; grid-template-columns: 1.25fr 1fr; gap: 22px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 5px; padding: 24px; }
.card.wide { margin-top: 22px; }
.card h2 { font: 500 10.5px/1 "IBM Plex Mono", monospace; letter-spacing: .1em;
  text-transform: uppercase; color: var(--mute); margin: 0 0 18px; }
.card h2.mt { margin-top: 24px; }
.card label { display: block; font-size: 12.5px; font-weight: 600; color: var(--soft);
  margin: 0 0 7px; }
.card input[type=text], .card input:not([type]), .card input[type=email], .card input[type=file],
.card textarea, .card select {
  width: 100%; padding: 11px 13px; border: 1px solid #D6D0C4; border-radius: 4px;
  font: inherit; background: #fff; margin-bottom: 18px; }
.card textarea { line-height: 1.55; resize: vertical; }
.card .hint { font-size: 12px; color: var(--mute); margin: 8px 0 18px; line-height: 1.5; }
/* Nur direkt unter einem Feld naeher heranziehen, dessen Abstand von 18px ausgleichen.
   Nach Formularen und Button-Zeilen bleibt der positive Abstand stehen. */
.card input + .hint, .card textarea + .hint, .card select + .hint,
.card h2 + .hint, .card .pair + .hint, .card .map + .hint,
.card .chip.wide + .hint { margin-top: -10px; }
.card form + .hint, .card .upload + .hint, .card .bar + .hint { margin-top: 12px; }
.card .hint:last-child { margin-bottom: 0; }
.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 18px; }

.map { height: 220px; border: 1px solid var(--line); border-radius: 4px; margin-bottom: 18px;
  z-index: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #D6D0C4;
  background: #fff; border-radius: 3px; padding: 7px 12px; font-size: 13px; cursor: pointer;
  margin: 0; }
.chip input { accent-color: var(--accent); margin: 0; }
.chip:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #fff; }

.bar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; }

.upload { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.upload select, .upload input, .upload button { margin-bottom: 0 !important; width: auto; }
.upload input[name=alt_text] { flex: 1 1 240px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px; margin-top: 18px; }
.gallery figure { margin: 0; border: 1px solid var(--line); border-radius: 4px; overflow: hidden;
  background: #FAF9F7; }
.gallery img { width: 100%; height: 130px; object-fit: cover; display: block; }
.gallery figcaption { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px;
  font-size: 12px; }
.gallery .alt { display: flex; gap: 6px; }
.gallery .alt input { width: 100%; padding: 6px 8px; border: 1px solid #D6D0C4;
  border-radius: 3px; font: inherit; font-size: 12px; margin: 0; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer;
  font: inherit; font-size: 12px; text-align: left; }
.link.danger { color: #8A2C2C; }

@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }

.chip.wide { width: 100%; justify-content: flex-start; margin-bottom: 18px; }
.chip.wide:has(input:checked) { background: var(--accent); border-color: var(--accent); }
.danger-zone { margin-top: 22px; }
.venue { display: block; }

.table tr.static:hover { background: #fff; cursor: default; }.table tr.off { opacity: .55; }
.table .warn { color: #8A2C2C; }
.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline select, .inline input { padding: 6px 8px; border: 1px solid #D6D0C4; border-radius: 3px;
  font: inherit; font-size: 12.5px; margin: 0; }
.rowactions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.bar.mt { margin-top: 18px; }
.card .head { margin-bottom: 14px; }
.card .head h2 { margin-bottom: 6px; }

/* ---------- Einreichungen ---------- */
.navitem .count { display: inline-block; min-width: 19px; margin-left: 7px; padding: 1px 6px;
  border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px;
  font-weight: 600; text-align: center; }

.diff { border: 1px solid var(--line); border-radius: 4px; padding: 16px 18px; margin-bottom: 14px;
  background: #FCFBF9; }
.diff:last-child { margin-bottom: 0; }
.diff-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 13px; }
.diff-body { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 14px; }
.diff .side { min-width: 0; }
.diff .tag { display: inline-block; font: 500 10px/1 "IBM Plex Mono", monospace;
  letter-spacing: .09em; text-transform: uppercase; color: var(--mute); margin-bottom: 7px; }
.diff .tag.new { color: var(--accent-dark); }
.diff p.old { margin: 0; padding: 11px 13px; border: 1px solid #EFEDE7; border-radius: 4px;
  background: #F4F2EE; color: var(--soft); white-space: pre-line; }
.diff input, .diff textarea, .diff select { width: 100%; padding: 11px 13px;
  border: 1px solid #D6D0C4; border-radius: 4px; font: inherit; background: #fff; margin: 0; }
.diff.row { display: flex; align-items: center; gap: 14px; }
.diff.row input[type=text], .diff.row input:not([type]) { flex: 1 1 220px; }
.table.inner { margin-top: 14px; font-size: 13px; }
.table.inner tr:last-child td { border-bottom: 0; }
.table.inner td { padding: 10px 14px; }
.table.inner td.old { color: var(--mute); text-decoration: line-through; }
.gallery figure.off img { opacity: .45; }
.gallery figcaption .chip { margin-top: 2px; }

@media (max-width: 760px) { .diff-body { grid-template-columns: 1fr; } }

/* ---------- Profilpflege durch die Schule ---------- */
body.public { background: var(--paper); }
.public-top { background: var(--ink); padding: 18px 24px; }
.public-top .brand { padding: 0; }
.public-main { max-width: 760px; margin: 0 auto; padding: 34px 24px 20px; }
.public-main .card { margin-bottom: 20px; }
.public-foot { max-width: 760px; margin: 0 auto; padding: 6px 24px 48px;
  color: var(--mute); font-size: 12.5px; }
.intro h1 { font-size: 26px; margin: 0 0 8px; }
.intro p { margin: 0 0 26px; color: var(--soft); max-width: 62ch; text-wrap: pretty; }
.evrow { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 18px; }
.evrow:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.public .card input[type=file] { margin-bottom: 10px; }

/* ---------- Grundregel (PROJECT_RULES §5) ---------- */
[hidden] { display: none !important; }

/* ---------- Zuschneiden (Header-Bild 16:7) ---------- */
.crop { margin: -8px 0 18px; }
.crop-stage { background: #E9E5DC; border-radius: 4px; overflow: hidden; }
.crop-stage canvas { display: block; width: 100%; cursor: grab; touch-action: none; }
.crop-stage canvas:active { cursor: grabbing; }
.crop-note { font-size: 12px; color: var(--mute); margin: 8px 0 0; line-height: 1.5; }
.crop-note.warn { color: #8A2C2C; }
.crop-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 8px; font-size: 12px; }
.crop-tools input[type=range] { width: 160px; margin: 0; padding: 0; border: 0; accent-color: var(--accent); }
.crop-label { color: var(--mute); }
.format-hint { display: flex; gap: 14px; align-items: center; background: #FAF9F7;
  border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; margin: 0 0 18px; font-size: 12.5px; }
.format-hint .frame { flex: 0 0 96px; aspect-ratio: 16 / 7; background: #D6D0C4; border-radius: 2px; position: relative; }
.format-hint .frame::after { content: ""; position: absolute; inset: 0 25%; border: 1px dashed #fff; }
.format-hint p { margin: 0; color: var(--soft); line-height: 1.5; }

/* ---------- KI, Zähler, Status ---------- */
.ki-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: -8px 0 18px; font-size: 12px; }
.ki-msg { color: var(--mute); }
.ki-msg.bad { color: #8A2C2C; }
.ki-hinweis { margin: 0 0 10px; }
.ki-hinweis.bad { color: #8A2C2C; }
.ki-progress { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin: 0 0 14px; border: 1px dashed var(--accent); border-radius: 6px; background: #F7F8F4; font-size: 14px; line-height: 1.5; }
.spinner { flex: none; width: 18px; height: 18px; margin-top: 2px; border: 3px solid #D6D0C4; border-top-color: var(--accent); border-radius: 50%; animation: ki-spin 0.9s linear infinite; }
@keyframes ki-spin { to { transform: rotate(360deg); } }
.proposals { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 12px; }
.proposals.plain { margin-top: 4px; }
.proposal { border: 1px solid var(--line); border-radius: 6px; padding: 12px 16px 14px; background: #FFFDFA; }
.proposal.picked { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.proposal-head { margin: 0 0 8px; font: 600 11px/1 "IBM Plex Mono", monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); display: flex; justify-content: space-between; align-items: baseline; }
.proposal-head .count { display: inline; margin: 0; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--mute); }
.proposal label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; margin: 0; font-weight: 400; }
.proposal label input { margin-top: 5px; accent-color: var(--accent); flex: none; }
.proposal-text { margin: 0; font-size: 15.5px; line-height: 1.55; font-style: italic; }
.proposals.plain .proposal-text { font-style: normal; }
.proposal-basis { margin: 10px 0 0; padding-top: 8px; border-top: 1px dotted var(--line); font-size: 12.5px; color: var(--mute); line-height: 1.45; }
.proposal-basis .src { font: 600 10.5px/1 "IBM Plex Mono", monospace; letter-spacing: .06em; text-transform: uppercase; color: #6B6457; margin-right: 4px; }
.proposal .btn.small { margin-top: 10px; padding: 6px 12px; font-size: 12px; }
.proposal [data-own-wrap] { margin-top: 10px; }
.compact-wrap .proposals { gap: 8px; }
.compact-wrap .proposal { padding: 8px 12px 10px; background: #FAF9F7; }
.compact-wrap .proposal-text { font-size: 13px; }
.compact-wrap .proposal-basis { font-size: 11.5px; margin-top: 6px; padding-top: 5px; }
.count { display: block; text-align: right; font: 11px "IBM Plex Mono", monospace; color: var(--mute); margin: -14px 0 12px; }
.count.over { color: #8A2C2C; font-weight: 600; }
.raw-text { white-space: pre-line; background: #FAF9F7; border: 1px solid var(--line); border-radius: 4px;
  padding: 12px 14px; font-size: 13.5px; line-height: 1.55; max-height: 320px; overflow: auto; margin: 0; }
.status-badge { display: inline-block; font: 500 10.5px/1 "IBM Plex Mono", monospace; letter-spacing: .06em;
  text-transform: uppercase; padding: 4px 7px; border-radius: 3px; margin-left: 8px; vertical-align: middle; }
.status-badge.geprueft { background: #E4EFE6; color: #2C5A38; }
.status-badge.automatisch { background: #FBEFD9; color: #7A4B00; }
.status-badge.pruefen { background: #F6E4E4; color: #8A2C2C; }
.trash td form { display: inline; }
