* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.4 system-ui, sans-serif; color: #1c2430; background: #f4f5f7; }
header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 8px 16px; background: #fff; border-bottom: 1px solid #d5d9e0; }
h1 { font-size: 18px; margin: 0 8px 0 0; }
h1 a.marke { color: inherit; text-decoration: none; }
#pfad a { color: inherit; }
h2 { font-size: 15px; margin: 0 0 8px; }
h3 { font-size: 14px; margin: 16px 0 6px; }
.platz { flex: 1; }
button, select, input, textarea { font: inherit; padding: 4px 8px; border: 1px solid #b6bcc8; border-radius: 4px; background: #fff; }
button { cursor: pointer; }
a.knopf { padding: 4px 8px; border: 1px solid #b6bcc8; border-radius: 4px; background: #fff; color: inherit; text-decoration: none; }
button.haupt { background: #1f5fbf; border-color: #1f5fbf; color: #fff; }
button.gefahr { color: #b3261e; }
#meldung { margin: 8px 16px; padding: 8px 12px; border-radius: 4px; background: #e7f3e8; border: 1px solid #9ccba0; }
#meldung.fehler { background: #fde8e6; border-color: #e3a19b; }
main { display: flex; gap: 12px; padding: 12px 16px; align-items: flex-start; }
#diagramm { flex: 1; min-width: 0; overflow: auto; background: #fff; border: 1px solid #d5d9e0; border-radius: 6px; min-height: 240px; max-height: 75vh; }
#diagramm p { padding: 16px; color: #5b6472; }
#seite { width: 440px; flex: none; background: #fff; border: 1px solid #d5d9e0; border-radius: 6px; padding: 12px; }
#seite { position: sticky; top: 8px; max-height: calc(100vh - 16px); overflow: auto; }
#seite .zu { position: sticky; top: 0; float: right; z-index: 2; margin: -6px -6px 0 8px; padding: 0 8px; border: 0; background: #fff; font-size: 20px; line-height: 1.4; color: #5b6472; }
#seite .zu:hover { color: #1c2430; background: #f0f2f5; }
#seite.breit { width: min(780px, 56vw); }
#seite .spalten { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
#seite .rechts { display: flex; flex-direction: column; }
/* Höhe 0 + flex: die Liste wird so hoch wie die linke Spalte und rollt in sich */
#seite .rechts .vorg { flex: 1 1 0; height: 0; min-height: 220px; max-height: none; margin-bottom: 0; }
#seite details { margin-top: 12px; }
#seite summary { cursor: pointer; font-weight: 600; margin-bottom: 6px; }
#seite .material { margin-bottom: 12px; padding: 8px; border: 1px dashed #5b6472; border-radius: 4px; background: #fafafa; }
#seite .material h3 { margin-top: 0; }
#seite label { display: block; margin-bottom: 8px; }
#seite label > input, #seite label > select, #seite label > textarea { display: block; width: 100%; margin-top: 2px; }
#seite .zeile { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
#seite .paar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#seite .vorg { max-height: max(180px, 40vh); overflow: auto; border: 1px solid #d5d9e0; border-radius: 4px; padding: 4px 8px; margin-bottom: 8px; }
#seite .vorg label { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#seite .vorg input { display: inline; width: auto; margin-right: 6px; }
#seite ul { margin: 0; padding-left: 18px; }
.klein { color: #5b6472; font-size: 12px; }
body > section { margin: 0 16px 16px; }
#legende { display: flex; flex-wrap: wrap; gap: 6px 16px; }
#legende span { display: inline-flex; align-items: center; gap: 6px; }
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #d5d9e0; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #e6e9ee; vertical-align: top; }
th { background: #f0f2f5; font-weight: 600; }
tr.offen td { background: #fff8e1; }
td .zeile { display: flex; gap: 6px; }
#diagramm .listenkopf { display: flex; gap: 12px; align-items: center; padding: 8px; position: sticky; left: 0; }
#diagramm table.liste { border: 0; white-space: nowrap; }
#diagramm table.liste th { position: sticky; top: 0; }
#diagramm table.liste td.zahl { text-align: right; }
#diagramm table.liste td:last-child { white-space: normal; min-width: 200px; }
#diagramm table.liste tr.klick { cursor: pointer; }
#diagramm table.liste tr.klick:hover td { background: #f0f4fb; }
#diagramm table.liste tr.gewaehlt td { background: #e3ecfa; }
#diagramm svg.farbe { vertical-align: -2px; margin-right: 6px; }
svg text { font: 12px system-ui, sans-serif; fill: #1c2430; }
svg text.klein { fill: #5b6472; font-size: 11px; }
svg text.marke { font-size: 11px; font-weight: 700; }
svg text.gruppe { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
svg .knoten.beendet { opacity: .45; }
#diagramm table.liste tr.beendet td { color: #8a919c; }
#seite .zustand { margin-bottom: 12px; padding: 8px; border: 1px solid #d5d9e0; border-radius: 4px; background: #f7f8fa; }
#seite .zustand .klein { margin: 0; }
#seite table.konten { margin-bottom: 8px; font-size: 13px; }
#seite table.konten td:nth-child(2) { overflow-wrap: anywhere; }
#seite .einladen, #seite .gewerk { margin-top: 12px; padding: 8px; border: 1px solid #d5d9e0; border-radius: 4px; background: #f7f8fa; }
#seite .einladen h3 { margin-top: 0; }
#seite .warn { margin: 0 0 8px; color: #c62828; font-weight: 600; }
svg text.titel { font-weight: 600; font-size: 13px; }
svg .knoten { cursor: pointer; }
svg .knoten:hover rect.rahmen { stroke-width: 2.5; }
svg .knoten.gewaehlt rect.rahmen { stroke: #1c2430; stroke-width: 3; }
@media (max-width: 800px) { main { flex-direction: column; } #seite, #seite.breit { width: 100%; position: static; max-height: none; } }
@media (max-width: 1100px) { #seite .spalten { grid-template-columns: 1fr; } #seite .rechts .vorg { height: auto; flex: none; max-height: 40vh; } }
@media print { header button, header a.knopf, header label, #seite, #abmelden { display: none; } #diagramm { max-height: none; overflow: visible; } }
/* Portal: Startseite, Mandanten, Super-Admin */
.portal { max-width: 1100px; margin: 16px auto; padding: 0 16px; }
.portal h2 { font-size: 18px; margin: 8px 0 12px; }
.portal .karte { background: #fff; border: 1px solid #d5d9e0; border-radius: 6px; padding: 12px 16px; margin: 12px 0; }
.portal .karte h3 { margin-top: 0; }
.portal label { display: block; margin-bottom: 8px; }
.portal label > input { display: block; width: 100%; margin-top: 2px; }
.portal label.inline { display: inline-flex; gap: 6px; align-items: center; }
.portal label.inline > input { display: inline; width: auto; }
.portal .paar { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.portal .zeile { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.portal ul.projekte li { margin: 4px 0; }
.portal .klein-knopf { margin-left: 8px; font-size: 12px; padding: 1px 6px; }
.portal .warn { color: #c62828; font-weight: 600; }
.portal .breit-tabelle { overflow-x: auto; }
.portal td.zahl { text-align: right; }
.portal tr.beendet td { color: #8a919c; }
.portal details { margin: 16px 0; }
.portal summary { cursor: pointer; font-weight: 600; }
@media (max-width: 700px) { .portal .paar { grid-template-columns: 1fr; } }
