/* Marhold-Design-System: ein Blau (nur Flächen), schwarze Schrift auf Weiß, eckige Formen */
:root {
  --blau: #2AABDC; --blau-hell: #DFF2FA; --blau-tief: #0E6F96; --tinte: #14181B; --leise: #5B6770; --linie: #C9D0D5; --grau: #EEF1F3; --papier: #fff;
  --rot: #B3261E; --gelb: #F2A900; --gruen: #2E7D32; --chat-h: 64px;
}
* { box-sizing: border-box; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; src: url(/static/fonts/IBMPlexSans-Bold.ttf) format("truetype"); font-display: swap; }
html { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: 300; font-size: 14px; color: var(--tinte); background: var(--papier); }
body { margin: 0; padding-bottom: calc(var(--chat-h) + env(safe-area-inset-bottom)); }
b, strong, th, h2, h3, h4, .knopf, legend, summary { font-weight: 700; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 16px 0 8px; }
code { font-family: Menlo, Consolas, monospace; font-size: 12px; background: var(--grau); padding: 1px 4px; }
p { margin: 0 0 10px; }
a { color: var(--blau-tief); }
[hidden] { display: none !important; }

.kopf { display: flex; align-items: center; gap: 16px; background: var(--blau); padding: 10px 20px; flex-wrap: wrap; padding-top: calc(10px + env(safe-area-inset-top)); }
.logo { height: 36px; display: block; }
.kopf-titel { font-family: "IBM Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 22px; font-weight: 700; color: var(--papier); letter-spacing: .01em; }
.kopf-projektname { color: var(--papier); font-weight: 700; opacity: .9; }
.zahnrad { background: none; border: 0; color: var(--papier); cursor: pointer; padding: 4px; display: inline-flex; }
.zahnrad:hover { opacity: .8; }
.abstand { flex: 1; }
.netz { background: var(--tinte); color: var(--papier); padding: 4px 10px; font-weight: 700; }

main { padding: 16px 20px 30px; max-width: 1100px; }
select, input, textarea { font: inherit; font-weight: 400; color: var(--tinte); background: var(--papier); border: 1px solid var(--tinte); border-radius: 0; padding: 6px 8px; max-width: 100%; min-height: 36px; }
input[type="checkbox"] { min-height: 0; width: 20px; height: 20px; margin: 0; accent-color: var(--tinte); }
select { appearance: none; -webkit-appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2314181B' stroke-width='1.8'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
textarea { width: 100%; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--leise); opacity: 1; }
select:focus-visible, input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--tinte); outline-offset: 1px; }

.knopf { font: inherit; font-weight: 700; color: var(--tinte); background: var(--papier); border: 1px solid var(--tinte); border-radius: 0; padding: 7px 14px; cursor: pointer; text-decoration: none; display: inline-block; white-space: nowrap; min-height: 36px; }
.knopf:hover { background: var(--grau); }
.knopf.voll { background: var(--blau); }
.knopf.voll:hover { background: var(--blau-hell); }
.knopf.rot { color: var(--rot); border-color: var(--rot); }
.knopf.klein { padding: 3px 8px; font-size: 12px; min-height: 28px; }
.knopf:disabled { opacity: .45; cursor: default; }
/* Symbolknöpfe: weiße Strichsymbole auf Blau (wie die App-Icons) */
.knopf.ikon { background: var(--blau); border-color: var(--blau); color: var(--papier); display: inline-flex; align-items: center; gap: 8px; }
.knopf.ikon:hover { background: var(--blau-tief); border-color: var(--blau-tief); }
.knopf.ikon svg, .chat-knopf svg, .chip svg { width: 20px; height: 20px; display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.knopf svg { width: 18px; height: 18px; display: inline-block; vertical-align: -4px; margin-right: 6px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.knopf.ikon svg { margin-right: 0; }
.chip svg { width: 13px; height: 13px; display: inline-block; vertical-align: -2px; margin-right: 3px; stroke-width: 2.2; }
label.knopf input[type="file"] { display: none; }

.karten { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 16px; }
.karte { border: 1px solid var(--linie); padding: 10px 12px; cursor: pointer; background: var(--papier); text-align: left; font: inherit; color: inherit; }
.karte:hover { background: var(--grau); }
.karte.aktiv { border-color: var(--tinte); border-width: 2px; }
.karte.gesamt { background: var(--blau-hell); border-color: var(--blau-hell); }
.karte.rot .haupt { color: var(--rot); }
.karte h4 { margin: 0 0 4px; font-size: 12px; font-weight: 400; color: var(--leise); }
.karte .haupt { font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; }

.reiter { display: flex; gap: 0; border-bottom: 2px solid var(--tinte); margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.reiter button[role="tab"] { font: inherit; font-weight: 700; background: none; border: 0; border-radius: 0; padding: 9px 14px; cursor: pointer; color: var(--tinte); }
.reiter button[aria-selected="true"] { background: var(--tinte); color: var(--papier); }
.reiter .knopf { margin-bottom: 4px; }
.zahl { display: inline-block; min-width: 18px; padding: 0 5px; background: var(--rot); color: var(--papier); font-size: 11px; line-height: 18px; text-align: center; margin-left: 4px; }
.zahl.leise-zahl { background: var(--leise); }
.zahl:empty { display: none; }
.ansicht-wahl { display: none; margin-bottom: 10px; }

.leiste { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.leiste input[type="search"], .leiste input:not([type]) { flex: 1 1 200px; max-width: 420px; }
.haken { display: flex; align-items: center; gap: 6px; }
.leise { color: var(--leise); }
.hinweis { color: var(--leise); margin: 0 0 12px; max-width: 90ch; }
.meldung { padding: 8px 12px; margin: 0 0 10px; border-left: 6px solid var(--leise); background: var(--grau); }
.meldung.fehler { border-color: var(--rot); }
.meldung.warnung { border-color: var(--gelb); }
.meldung.ok { border-color: var(--gruen); }
.version-hinweis { position: fixed; left: 12px; right: 12px; top: 12px; z-index: 60; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.tabelle-rahmen { overflow-x: auto; border: 1px solid var(--linie); }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 7px 9px; border-bottom: 1px solid var(--linie); text-align: left; vertical-align: middle; }
th { background: var(--blau); white-space: nowrap; }
td.z, th.z { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
table input { min-height: 32px; padding: 4px 6px; }

/* Aufgabenliste */
.gruppe-kopf { display: flex; align-items: baseline; gap: 10px; margin: 18px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--linie); }
.gruppe-kopf h3 { margin: 0; }
.gruppe-kopf.rot h3 { color: var(--rot); }
.gruppe-kopf .leise { font-size: 12px; }
.aufg { display: grid; grid-template-columns: 30px 1fr auto; gap: 4px 10px; align-items: start; padding: 9px 6px; border-bottom: 1px solid var(--linie); cursor: pointer; }
.aufg:hover { background: var(--grau); }
.aufg.erledigt .titel { text-decoration: line-through; color: var(--leise); }
.aufg .hak { margin-top: 2px; }
.aufg .titel { font-weight: 700; line-height: 1.35; }
.aufg .titel .teilvon { font-weight: 300; color: var(--leise); }
.aufg .meta { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--leise); line-height: 18px; }
.aufg .meta .chip { border: 1px solid var(--linie); padding: 0 6px; }
.aufg .meta .faellig.spaet { color: var(--rot); font-weight: 700; }
.aufg .meta .faellig.heute { color: var(--blau-tief); font-weight: 700; }
.aufg .meta .wartet { color: var(--gelb); font-weight: 700; }
.aufg .meta .chip.ki { background: var(--blau); border-color: var(--blau); color: var(--papier); font-weight: 700; }
.aufg .meta a.chip.ziel { background: var(--tinte); border-color: var(--tinte); color: var(--papier); font-weight: 700; text-decoration: none; }
.aufg .meta a.chip.ziel:hover { background: var(--blau-tief); }
.ki-hinweis { color: var(--leise); font-size: 12px; margin: 0 0 8px; }
.aufg .prio { grid-column: 3; grid-row: 1 / 3; font-weight: 700; color: var(--rot); font-size: 16px; align-self: center; white-space: nowrap; }
.aufg .prio.p1 { color: var(--gelb); }
.aufg .teile-balken { display: inline-block; width: 60px; height: 6px; background: var(--grau); vertical-align: middle; margin-left: 4px; }
.aufg .teile-balken i { display: block; height: 100%; background: var(--blau); }
.aufg .beschr { grid-column: 2; font-size: 12px; color: var(--leise); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 80ch; }
.aufg.hervor { outline: 3px solid var(--blau); }
.leer { padding: 20px 6px; color: var(--leise); }

/* Zeitplan */
.plan-woche { margin-bottom: 18px; }
.plan-woche h3 { background: var(--grau); padding: 6px 10px; margin: 0 0 4px; display: flex; justify-content: space-between; }
.plan-woche h3 .leise { font-weight: 300; font-size: 12px; }
.plan-tag { display: grid; grid-template-columns: 120px 1fr; border-bottom: 1px solid var(--linie); }
.plan-tag.heute > .tag { color: var(--blau-tief); }
.plan-tag.spaet > .tag { color: var(--rot); }
.plan-tag.we > .tag { color: var(--leise); }
.plan-tag > .tag { padding: 9px 10px; font-weight: 700; white-space: nowrap; }
.plan-tag .aufg { border-bottom: 0; }
.plan-tag .aufg + .aufg { border-top: 1px solid var(--linie); }

/* Chat-Leiste */
.chat { position: fixed; left: 0; right: 0; bottom: 0; background: var(--papier); border-top: 2px solid var(--tinte); z-index: 30; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); box-shadow: 0 -2px 10px rgba(0,0,0,.08); }
.chat-zeile { display: flex; gap: 6px; align-items: flex-end; max-width: 1100px; }
.chat-zeile textarea { flex: 1; min-height: 44px; max-height: 160px; padding: 10px 10px; font-size: 16px; resize: none; line-height: 22px; }
.chat-knopf { font: inherit; width: 44px; height: 44px; border: 1px solid var(--blau); background: var(--blau); color: var(--papier); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; flex: none; padding: 0; }
.chat-knopf:hover { background: var(--blau-tief); border-color: var(--blau-tief); }
.chat-knopf#chat-auf { background: var(--papier); color: var(--tinte); border-color: var(--tinte); }
.chat-knopf#chat-auf:hover { background: var(--grau); }
.chat-knopf svg { width: 22px; height: 22px; }
.chat-knopf.aktiv { background: var(--rot); color: var(--papier); animation: puls 1s infinite alternate; }
@keyframes puls { from { opacity: 1; } to { opacity: .6; } }
.chat-log { max-height: 42vh; overflow: auto; margin-bottom: 8px; border: 1px solid var(--linie); padding: 8px 10px; max-width: 1100px; }
.chat-eintrag { margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--linie); }
.chat-eintrag:last-child { border-bottom: 0; margin-bottom: 0; }
.chat-eintrag .frage { color: var(--leise); font-size: 12px; }
.chat-eintrag .frage b { color: var(--tinte); font-weight: 400; }
.chat-eintrag .antwort { margin: 2px 0 4px; }
.chat-eintrag .antwort.warte { color: var(--leise); font-style: italic; }
.chat-eintrag .antwort.fehler { color: var(--rot); }
.erg { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 3px 0; font-size: 13px; }
.erg .art { border: 1px solid var(--linie); padding: 0 6px; font-size: 12px; background: var(--grau); }
.erg .art.anlegen { background: var(--blau-hell); border-color: var(--blau-hell); }
.erg .art.erledigen { background: #E4F2E5; border-color: #E4F2E5; }
.erg .art.loeschen { color: var(--rot); }
.erg button { font: inherit; font-size: 12px; border: 0; background: none; color: var(--blau-tief); cursor: pointer; padding: 0 4px; text-decoration: underline; }
.erg .rueck { color: var(--leise); }

/* Dialoge */
dialog { border: 2px solid var(--tinte); border-radius: 0; padding: 18px 20px; max-width: min(96vw, 720px); width: 100%; max-height: 92vh; overflow: auto; overscroll-behavior: contain; }
dialog::backdrop { background: rgba(20, 24, 27, .45); }
dialog.gross { max-width: min(98vw, 860px); padding: 0; }
dialog.gross > form > *:not(.dialog-kopf), dialog.gross > .dialog-inhalt > *:not(.dialog-kopf) { margin-left: 16px; margin-right: 16px; }
dialog.gross > form > .raster-form { margin-top: 12px; }
dialog.gross .knoepfe { margin-bottom: 16px; }
.dialog-kopf { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; background: var(--blau); padding: 8px 16px; margin: 0 0 12px; }
.dialog-kopf .kopf-titel { font-size: 18px; color: var(--papier); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dialog-kopf .knopf { min-height: 38px; padding: 6px 12px; }
.gespeichert { color: var(--papier); font-size: 12px; opacity: 0; transition: opacity .3s; }
.gespeichert.an { opacity: 1; }
.knoepfe { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.knoepfe .gruppe { display: flex; gap: 8px; flex-wrap: wrap; }
.raster-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 10px; }
.raster-form label { display: flex; flex-direction: column; gap: 2px; min-width: 0; margin: 0; }
.raster-form label span { font-size: 11px; font-weight: 700; color: var(--leise); line-height: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.raster-form select, .raster-form input { width: 100%; height: 40px; min-height: 40px; padding: 4px 8px; font-size: 15px; }
.raster-form textarea { font-size: 15px; }
.raster-form .wf-breit { grid-column: span 2; }
.raster-form .wf-voll { grid-column: 1 / -1; }
.teil { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--linie); }
.teil.erledigt span { text-decoration: line-through; color: var(--leise); }
.teil button { font: inherit; font-size: 12px; border: 0; background: none; color: var(--blau-tief); cursor: pointer; text-decoration: underline; }
.anhaenge { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.anhaenge img { width: 96px; height: 96px; object-fit: cover; border: 1px solid var(--linie); cursor: pointer; display: block; }
.anhaenge .dok { width: 96px; height: 96px; border: 1px solid var(--linie); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; font-size: 11px; padding: 4px; word-break: break-word; color: inherit; text-decoration: none; }
.anhaenge .dok b { font-size: 22px; }
.verlauf .v { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--linie); font-size: 13px; }
.verlauf .v .zeit { color: var(--leise); font-variant-numeric: tabular-nums; white-space: nowrap; }
.verlauf .v.notiz .text { border-left: 3px solid var(--blau); padding-left: 8px; white-space: pre-wrap; }
.verlauf .v .quelle { color: var(--leise); font-size: 11px; }
.verlauf .v button { font: inherit; font-size: 11px; border: 0; background: none; color: var(--leise); cursor: pointer; }
/* Lösungsvorschlag */
.loesung { border: 1px solid var(--tinte); padding: 10px 12px; margin-bottom: 12px; }
.loesung .zusammenfassung { margin-bottom: 8px; }
.loesung ol { margin: 0 0 10px; padding-left: 20px; }
.loesung ol li { margin-bottom: 2px; }
.loesung .fragen { border-left: 6px solid var(--gelb); background: var(--grau); padding: 6px 10px; margin-bottom: 10px; }
.aktion { border: 1px solid var(--linie); padding: 8px 10px; margin-bottom: 8px; }
.aktion .aktion-kopf { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-weight: 700; }
.aktion .aktion-kopf .art { font-size: 11px; border: 1px solid var(--linie); padding: 0 6px; font-weight: 400; color: var(--leise); }
.aktion.aus { opacity: .5; }
.aktion .raster-form { grid-template-columns: 1fr 1fr; }
.aktion textarea { min-height: 160px; font-size: 14px; font-family: inherit; }
.aktion .anh-wahl { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.aktion .anh-wahl label { display: flex; align-items: center; gap: 4px; }
.aktion.hinweis { background: var(--grau); border-color: var(--grau); }
.loesung .ergebnis { border-left: 6px solid var(--gruen); background: var(--grau); padding: 6px 10px; margin-top: 10px; }
.loesung .ergebnis.fehler { border-left-color: var(--rot); }
.loesung .ergebnis div { padding: 2px 0; }
@media (max-width: 720px) { .aktion .raster-form { grid-template-columns: 1fr; } }
.vorschlag { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--linie); }
.vorschlag .raster-form { grid-template-columns: 2fr 1fr 1fr 1fr; gap: 6px; }
.vorschlag .raster-form .wf-voll { grid-column: 1 / -1; }
#dialog-foto img { max-width: 100%; max-height: 75vh; display: block; margin-bottom: 10px; }

@media (max-width: 720px) {
  main { padding: 12px; }
  .reiter { display: none; }
  .ansicht-wahl { display: flex; gap: 8px; }
  .ansicht-wahl select { flex: 1; font-size: 16px; font-weight: 700; min-height: 44px; }
  .ansicht-wahl .knopf { width: 48px; min-height: 44px; font-size: 22px; padding: 0; }
  .kopf { padding: 8px 12px; gap: 10px; }
  .kopf-titel { font-size: 18px; }
  .kopf-projektname { display: none; }
  .knopf { min-height: 42px; }
  .karten { grid-template-columns: repeat(5, 1fr); gap: 4px; margin-bottom: 10px; }
  .karte { padding: 6px 4px; text-align: center; }
  .karte h4 { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .karte .haupt { font-size: 18px; }
  .leiste input[type="search"], .leiste input:not([type]) { flex-basis: 100%; max-width: none; min-height: 44px; }
  .leiste select { flex: 1; min-height: 44px; }
  .aufg { padding: 10px 4px; }
  .aufg .hak { width: 24px; height: 24px; }
  .aufg .beschr { display: none; }
  .plan-tag { grid-template-columns: 70px 1fr; }
  .raster-form { grid-template-columns: 1fr 1fr; gap: 8px; }
  .vorschlag .raster-form { grid-template-columns: 1fr 1fr; }
  dialog.gross { max-width: 100vw; max-height: 100vh; margin: 0; width: 100vw; height: 100vh; }
  dialog.gross > form > *:not(.dialog-kopf), dialog.gross > .dialog-inhalt > *:not(.dialog-kopf) { margin-left: 12px; margin-right: 12px; }
  .dialog-kopf { padding: 8px 12px; gap: 8px; }
  .dialog-kopf .kopf-titel { font-size: 16px; }
  .verlauf .v { grid-template-columns: 1fr auto; }
  .verlauf .v .zeit { grid-column: 1 / -1; font-size: 11px; }
  .chat-zeile textarea { font-size: 16px; }
}
