:root {
  --bg: #f4f5f7; --panel: #fff; --ink: #1c1f24; --muted: #5f6672; --line: #dcdfe4;
  --accent: #2456c7; --accent-ink: #fff; --danger: #b3261e; --ok: #1d7a46;
  --kern: #2456c7; --steuern: #7a3cb8; --unterst: #1d7a46;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.2rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
p.lead { color: var(--muted); margin: 0 0 1rem; }
header.top { background: var(--panel); border-bottom: 1px solid var(--line); padding: .75rem 1.5rem; display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
header.top .brand { font-weight: 700; }
header.top .ver { color: var(--muted); font-size: .75rem; margin-left: -1.15rem; align-self: flex-start; }
header.top .survey { color: var(--muted); }
header.top .save { margin-left: auto; color: var(--muted); font-size: .85rem; }
nav.steps[hidden] { display: none; }
nav.steps { display: flex; gap: .25rem; padding: .5rem 1.5rem; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; }
nav.steps span { padding: .3rem .7rem; border-radius: 999px; color: var(--muted); font-size: .85rem; white-space: nowrap; }
nav.steps span.active { background: var(--accent); color: var(--accent-ink); }
nav.steps span.done { color: var(--ok); }
main { max-width: 1280px; margin: 0 auto; padding: 1.5rem; }
/* Der Admin-Bereich zeigt Datentabellen mit bis zu zwei Dutzend Spalten (Tätigkeiten, Register, Katalog).
   Die feste Lesebreite von 1280px schnitt sie rechts ab, ohne dass man an den Rest herankam – hier gilt
   deshalb die volle Fensterbreite. Für die Teilnehmer-Seite bleibt es bei der schmalen Spalte: Dort wird
   gelesen und ausgefüllt, nicht verglichen. */
body.admin main { max-width: none; }

/* Zweite Hälfte derselben Sache: Auch die volle Fensterbreite reicht für die breitesten Register nicht
   immer aus. Solche Tabellen scrollen dann in sich selbst, statt aus dem Panel zu laufen. Gesetzt wird der
   Rahmen zentral beim Rendern (autoScrollTables in public/admin/core.js), damit keine Ansicht ihn vergessen
   kann. */
.table-scroll { overflow-x: auto; max-width: 100%; }
/* Ein Scroll-Container beschneidet absolut positionierte Kinder – die aufgeklappten "i"-Erklärungen an
   Spaltenüberschriften wären sonst unten abgeschnitten. Solange eine offen ist, bekommt der Container Platz
   dafür. */
.table-scroll:has(details.field-info[open]) { padding-bottom: 15rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.5rem; box-shadow: var(--shadow); }
.narrow { max-width: 620px; margin: 0 auto; }
label { display: block; font-weight: 600; margin: .8rem 0 .25rem; font-size: .9rem; }
label small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=number], select, textarea { width: 100%; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
textarea { min-height: 70px; resize: vertical; }
/* Einzeilig startende Textarea, die per JS mit dem Inhalt mitwächst statt Text abzuschneiden (Ersatz für <input>). */
textarea.autogrow { min-height: unset; height: auto; resize: none; overflow: hidden; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; }
.radios { display: flex; flex-wrap: wrap; gap: .5rem; }
.radios label { display: inline-flex; align-items: center; gap: .4rem; margin: 0; padding: .45rem .8rem; border: 1px solid var(--line); border-radius: 999px; font-weight: 500; cursor: pointer; }
.radios label:has(input:checked) { background: var(--accent); color: #fff; border-color: var(--accent); }
.radios input { margin: 0; }
button, .btn { font: inherit; padding: .55rem 1rem; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; font-weight: 600; }
button.secondary { background: #fff; color: var(--accent); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: .3rem .5rem; font-weight: 500; }
button.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.small { padding: .3rem .6rem; font-size: .85rem; }
.actions { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; flex-wrap: wrap; }
.actions .right { margin-left: auto; display: flex; gap: .5rem; }
.error { color: var(--danger); margin-top: .75rem; }
.info { background: #eef3ff; border: 1px solid #c8d6f8; border-radius: 8px; padding: .75rem 1rem; margin: .75rem 0; }
/* position:relative + das Infofeld absolut positioniert, statt in normalem Fluss: sonst wächst das <details>
   beim Öffnen (Badge + Infotext stehen dann untereinander im selben Inline-Block) und der Browser bricht die
   Zeile an anderer Stelle um – das Badge selbst "springt" dadurch sichtbar an eine andere Stelle. Absolut
   positioniert ändert das Infofeld nie die Größe des <details> in der normalen Textzeile, das Badge bleibt fix. */
details.field-info { position: relative; display: inline-block; vertical-align: middle; }
details.field-info summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; width: 1.15rem; height: 1.15rem; border-radius: 50%; border: 1px solid var(--muted); color: var(--muted); font-size: .75rem; font-weight: 700; }
details.field-info summary::-webkit-details-marker { display: none; }
details.field-info[open] summary { background: var(--accent); border-color: var(--accent); color: #fff; }
/* text-transform/font-weight zurücksetzen: das Badge sitzt u. a. in Tabellenkopfzeilen (th { text-transform:
   uppercase; font-weight:600 }), was sonst auch den aufklappenden Infotext in Großbuchstaben rendern würde. */
/* Feste width statt nur max-width: das <details> (containing block für das absolut positionierte .info) ist
   selbst nur so breit wie das kleine Badge – ohne eigene width würde .info dadurch auf Badge-Breite
   zusammenschrumpfen (shrink-to-fit) statt sich am Text zu orientieren. */
details.field-info .info { position: absolute; z-index: 30; top: calc(100% + .4rem); left: 0; margin: 0; width: 20rem; font-size: .85rem; font-weight: 400; text-transform: none; letter-spacing: normal; max-width: min(20rem, 85vw); box-shadow: var(--shadow); }
details.field-info .info p { margin: .4rem 0 0; }
details.field-info .info p:first-child { margin-top: 0; }
.hint { color: var(--muted); font-size: .85rem; }
.or { text-align: center; color: var(--muted); margin: 1rem 0; }

/* Zwei-Spalten-Layout Auswahl */
.picker { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .picker { grid-template-columns: 1fr; } }
.dropzone { min-height: 220px; border: 2px dashed var(--line); border-radius: var(--radius); padding: .75rem; background: #fafbfc; transition: border-color .15s, background .15s; }
.dropzone.over { border-color: var(--accent); background: #eef3ff; }
.dropzone.empty::before { content: attr(data-empty); color: var(--muted); display: block; text-align: center; padding: 2rem 1rem; }
.cards { display: flex; flex-direction: column; gap: .5rem; }
.card { display: flex; flex-direction: column; gap: .25rem; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--g, var(--accent)); border-radius: 8px; padding: .5rem .6rem; cursor: grab; }
.card.dragging { opacity: .4; }
.card .main { display: flex; align-items: center; gap: .5rem; width: 100%; }
.side .card { flex-direction: row; align-items: center; }
.card .details { padding: .25rem .25rem .4rem 3.7rem; cursor: default; }
.card .details label { margin: .35rem 0 .15rem; font-size: .8rem; }
.card .details input, .card .details select { font-size: .88rem; padding: .35rem .5rem; }
.card .id { font-size: .75rem; color: var(--muted); min-width: 3.2rem; font-variant-numeric: tabular-nums; }
.card .name { flex: 1; min-width: 0; }
.card .name input { border: 1px solid transparent; padding: .25rem .35rem; background: transparent; }
.card .name input:hover { border-color: var(--line); }
.card .name input:focus { background: #fff; }
.card .desc { color: var(--muted); font-size: .8rem; }
.card .desc-row { padding-left: 3.7rem; }
.card .desc-row textarea { display: block; width: 100%; border: 1px solid transparent; padding: .15rem .35rem; background: transparent; color: var(--muted); font-size: .82rem; font-family: inherit; line-height: 1.35; }
.card .desc-row textarea::placeholder { font-style: italic; }
.card .desc-row textarea.empty { border-color: var(--danger); background: #fdf2f1; }
.req { color: var(--danger); font-weight: 700; }
.card .desc-row textarea:hover { border-color: var(--line); }
.card .desc-row textarea:focus { background: #fff; color: var(--ink); }
.card .badge { font-size: .7rem; padding: .1rem .4rem; border-radius: 4px; background: #fff3e0; color: #8a4b00; }
.card .badge.branch { background: #eef3ff; color: var(--accent); }
.card.custom .badge { display: inline-block; }
.card .x { color: var(--muted); border: none; background: none; cursor: pointer; font-size: 1.1rem; padding: 0 .3rem; }
.card .x:hover { color: var(--danger); }
.g-Kern { --g: var(--kern); } .g-Steuern { --g: var(--steuern); } .g-Unterstützen { --g: var(--unterst); } .g-Neu { --g: #888; }
.side { position: sticky; top: 1rem; }
.side .cards .card { cursor: grab; }
.side .cards .card .add { border: 1px solid var(--line); background: #fff; color: var(--accent); border-radius: 5px; padding: .1rem .5rem; cursor: pointer; font-weight: 700; }
details.more { margin-top: .75rem; }
details.more summary { cursor: pointer; color: var(--muted); font-size: .9rem; padding: .3rem 0; }
.newcap { display: flex; gap: .5rem; margin-top: .75rem; }
.newcap input { flex: 1; }
.phase-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.phase-tabs button { background: #fff; color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
.phase-tabs button.active { border-color: var(--g, var(--accent)); border-width: 2px; font-weight: 600; }
.phase-tabs button .n { color: var(--muted); font-size: .8rem; margin-left: .3rem; }
.l1-section { margin-bottom: 1rem; }
.l1-section h4 { margin: .5rem 0 .4rem; display: flex; align-items: center; gap: .5rem; font-size: .95rem; }
.l1-section h4 .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--g, #888); display: inline-block; }
.search { margin: .5rem 0; }

/* Capability Map */
.bcm { display: grid; gap: 1rem; }
.bcm .group { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; background: #fff; border-top: 5px solid var(--g, #888); }
.bcm .group h4 { margin: 0 0 .6rem; }
.bcm .l1s { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; }
.bcm .l1 { background: #f7f8fa; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; }
.bcm .l1 .t { font-weight: 600; margin-bottom: .35rem; font-size: .92rem; }
.bcm .l2 { display: flex; flex-wrap: wrap; gap: .25rem; }
.bcm .l2 span { font-size: .78rem; background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: .1rem .4rem; }
.bcm .l2 span.custom { border-style: dashed; }
/* Konsolidierte Map (Admin) ist anklickbar, die Teilnehmer-BCM (public/app/views/map.js) nur Anzeige – deshalb
   .consolidated statt der geteilten .bcm-Klasse, sonst würde ein Klick-Cursor auf der reinen Anzeige der
   Teilnehmer eine Interaktion vortäuschen, die es dort nicht gibt. */
.bcm.consolidated .l2 span.accepted { font-weight: 600; }
.bcm.consolidated .l2 span.maybe-dupe { text-decoration: underline dotted; }
.bcm.consolidated .l2 span.open { outline: 2px solid var(--accent); outline-offset: 1px; }
.bcm.consolidated .l2 span, .bcm.consolidated .l1 .t { cursor: pointer; }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-left: .3rem; }
.node-edit { display: block; width: 100%; margin-top: .5rem; padding: .6rem .7rem; background: #fff; border: 1px solid var(--line); border-radius: 8px; cursor: default; white-space: normal; }
.node-edit label { display: block; font-size: .75rem; color: var(--muted); margin: .35rem 0 .1rem; }
.node-edit input, .node-edit select, .node-edit textarea { width: 100%; box-sizing: border-box; }
@media print { header.top, nav.steps, .actions, .hint { display: none !important; } main { max-width: none; padding: 0; } .panel { border: none; box-shadow: none; } .node-edit { display: none !important; } }

/* Tätigkeiten */
.activity { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: .75rem; background: #fff; }
.activity .head { display: flex; gap: .75rem; align-items: end; }
.activity .head .n { color: var(--muted); font-weight: 600; padding-bottom: .55rem; }
.activity .head label { flex: 1; margin: 0; }
.activity .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .25rem .75rem; margin-top: .5rem; }
.activity .grid label { margin: .3rem 0 .15rem; font-size: .8rem; }
.activity .grid input { padding: .4rem .5rem; font-size: .9rem; }
.activity .foot { display: flex; justify-content: flex-end; margin-top: .4rem; }

/* Feedback */
.fb-row { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.fb-row .scale { display: flex; gap: .25rem; }
.fb-row .scale label { margin: 0; width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; font-weight: 500; }
.fb-row .scale label:has(input:checked) { background: var(--accent); color: #fff; border-color: var(--accent); }
.fb-row .scale input { display: none; }
/* Beschriftete Skalenenden (2026-09-17). Auf schmalen Schirmen unter die Skala statt daneben, sonst
   quetscht sich die 1-5-Reihe zusammen. */
.scale-wrap { display: flex; align-items: center; gap: .6rem; }
.scale-wrap .pole { color: var(--muted); font-size: .8rem; white-space: nowrap; }
@media (max-width: 640px) {
  .fb-row { grid-template-columns: 1fr; }
  .scale-wrap { flex-wrap: wrap; gap: .3rem .5rem; }
  .scale-wrap .scale { order: -1; flex-basis: 100%; }
}

/* Admin */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr.l2 td:first-child { padding-left: 1.6rem; color: var(--muted); }
/* Kopfzeile einer Befragung: Titel links, Excel-Export rechts (2026-09-17). Der Knopf behält seine Breite,
   der Titelblock nimmt den Rest; auf schmalen Schirmen rutscht der Knopf unter den Titel. */
.survey-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.survey-head > div { flex: 1 1 22rem; min-width: 0; }
/* Hinweisfeld zum Stand der Katalogdatei (2026-09-17). .warn hebt den Konfliktfall ab, in dem eine Übernahme
   Katalogarbeit verwerfen würde. */
.info.warn { background: #fdf3e6; border-color: #e6c9a0; }
.info .umfang { margin: .5rem 0; padding-left: 1.1rem; }
.info .umfang li { margin-bottom: .15rem; }
.info .confirm { display: inline-flex; align-items: center; gap: .35rem; margin: 0 .5rem 0 0; font-size: .9rem; }
.info .newcap { margin-top: .6rem; align-items: center; }

/* Zwei schmale Haken-Spalten in der Capability-Tabelle (2026-09-17): zum Überfliegen gedacht, deshalb
   zentriert, schmal und farblich eindeutig – nicht zum Lesen. */
th.match, td.match { width: 3.2rem; text-align: center; white-space: nowrap; }
td.match { font-weight: 600; }
td.match.ok { color: var(--good, #2e7d51); }
td.match.diff { color: var(--danger, #a5281e); }
td.match.neu { color: var(--muted); font-weight: 400; }

.survey-head > .head-actions { flex: 0 0 auto; margin-top: .4rem; display: flex; gap: .5rem; flex-wrap: wrap; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin: .75rem 0 1.25rem; }
.kpi { background: #f7f8fa; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; }
.kpi .v { font-size: 1.5rem; font-weight: 700; }
.kpi .l { color: var(--muted); font-size: .8rem; }
.bar { display: inline-block; height: 10px; background: var(--accent); border-radius: 3px; vertical-align: middle; margin-right: .4rem; }
.tabs, .subtabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs button, .subtabs button { background: none; border: none; border-bottom: 3px solid transparent; color: var(--muted); border-radius: 0; padding: .5rem .8rem; }
.tabs button.active, .subtabs button.active { color: var(--ink); border-bottom-color: var(--accent); }
code.ref { font-family: ui-monospace, Menlo, monospace; background: #f0f2f5; padding: .1rem .35rem; border-radius: 4px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; } @media (max-width: 900px) { .two { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 1.25rem; }

table.register td { min-width: 90px; }
table.register input, table.register select, table.register textarea { font-size: .85rem; padding: .3rem .4rem; min-width: 90px; }
table.register textarea { min-height: 44px; min-width: 160px; }
.tabs, .subtabs { flex-wrap: wrap; }
.success { display: flex; gap: 1rem; align-items: center; background: #e7f5ec; border: 1px solid #b9e0c6; border-radius: 10px; padding: .9rem 1.1rem; margin-bottom: 1.25rem; }
.success .big { width: 44px; height: 44px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 1.5rem; font-weight: 700; flex: none; }

/* Katalog-Verwaltung */
.cat-group { margin-bottom: 1.5rem; }
.cat-group h3 { margin-top: 0; }
.cat-l1 { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; margin-bottom: .6rem; background: #fff; }
.cat-l1-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.cat-l1-head .id { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 3rem; }
.cat-l1-head .spacer { flex: 1; }
.cat-l1-head .badge { font-size: .7rem; padding: .1rem .4rem; border-radius: 4px; background: #fff3e0; color: #8a4b00; }
.cat-l1-desc { margin: .35rem 0 .1rem 3.7rem; }
.cat-l1-desc input { color: var(--muted); font-size: .9rem; }
table.cat-l2 { width: 100%; margin-top: .5rem; }
table.cat-l2 td { padding: .25rem .4rem; border: none; }
table.cat-l2 td.id { font-size: .75rem; color: var(--muted); width: 3.5rem; }
.chiprow { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }
.chip.small { padding: .15rem .5rem; font-size: .78rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--muted); }
.chip.small.on { background: var(--accent); color: #fff; border-color: var(--accent); }
details > summary { cursor: pointer; color: var(--muted); font-size: .85rem; margin-top: .3rem; }
