/* Hausfarben SHIPTEC: Blau Pantone 287 (0|78|152), Rot Pantone Red 032 (227|0|11) */
:root {
  --brand: #004e98;
  --brand-dark: #003a72;
  --brand-red: #e3000b;
  --on-brand: #ffffff;
  --on-brand-muted: rgba(255, 255, 255, .78);

  --bg: #f3f6fa;
  --surface: #ffffff;
  --text: #14212f;
  --muted: #5a6878;
  --border: #d7dfe8;
  --accent: #004e98;
  --accent-text: #ffffff;
  --warn: #e3000b;
  --input-bg: #ffffff;
  --input-border: #c3cedb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1724;
    --surface: #15212f;
    --text: #e6ebf1;
    --muted: #98a6b6;
    --border: #273446;
    --accent: #6fa6e0;
    --accent-text: #08121e;
    --warn: #ff6b70;
    --input-bg: #1f2d3e;
    --input-border: #3b4d64;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); }

/* Kopfzeile in Hausblau, Logo negativ */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 2rem;
  padding: .5rem 1.5rem;
  background: var(--brand);
  color: var(--on-brand);
  border-bottom: 3px solid var(--brand-red);
}
/* Kopfzeile bleibt beim Scrollen stehen (nicht bei sehr niedrigen Fenstern); --topbar-h setzt base.html */
@media (min-height: 500px) {
  .topbar { position: sticky; top: 0; z-index: 30; }
  html { scroll-padding-top: calc(var(--topbar-h, 0px) + .75rem); }
}
/* Schriftzug und © Shiptec AG auf derselben Grundlinie; das Schild mittig */
.brand { display: flex; align-items: baseline; gap: .6rem; line-height: 0; text-decoration: none; }
.brand img { height: 40px; width: auto; align-self: center; }
/* Schriftzug so hoch wie das sichtbare Schild */
.brand .wordmark {
  color: var(--on-brand);
  font: 800 2.6rem/40px "Segoe UI", system-ui, sans-serif;
  letter-spacing: -.02em;
}
.brand .powered-by { margin-left: .3rem; color: var(--on-brand-muted);
  font-size: .78rem; line-height: 1.2; white-space: nowrap; }
@media (max-width: 640px) { .brand .powered-by { display: none; } }
.topbar nav { display: flex; gap: 1.25rem; flex: 1; }
.topbar nav a { color: var(--on-brand-muted); text-decoration: none; font-weight: 500; }
.topbar nav a:hover, .topbar nav a[aria-current="page"] { color: var(--on-brand); }
.who { display: flex; align-items: center; gap: .75rem; color: var(--on-brand-muted); }
.topbar .btn {
  background: transparent;
  color: var(--on-brand);
  border: 1px solid rgba(255, 255, 255, .55);
}
.topbar .btn:hover { background: rgba(255, 255, 255, .12); }

main { max-width: 960px; margin: 0 auto; padding: 1.5rem; }
h1 { margin: 0 0 .25rem; font-size: 1.6rem; color: var(--brand); }
@media (prefers-color-scheme: dark) { h1 { color: var(--text); } }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.warn { color: var(--warn); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--brand);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-top: 1.25rem;
}
.card h2 { margin: 0 0 .5rem; font-size: 1.1rem; }
.notice { border-top-color: var(--brand-red); }
.btn {
  display: inline-block;
  padding: .35rem .8rem;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
}
.tags { list-style: none; display: flex; gap: .5rem; padding: 0; margin: 0; }
.tags li {
  padding: .15rem .6rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
}
.claims { width: 100%; border-collapse: collapse; margin-top: 1rem; background: var(--surface); }
.claims th, .claims td {
  text-align: left;
  vertical-align: top;
  padding: .4rem .6rem;
  border-bottom: 1px solid var(--border);
  word-break: break-all;
}
.claims th { width: 30%; color: var(--muted); font-weight: 500; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.project { margin: 1rem 0 .25rem; font-size: .95rem; color: var(--muted); font-weight: 600; }
.repo-list { list-style: none; padding: 0; margin: 0; }
.repo-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .45rem 0;
  border-bottom: 1px solid var(--border);
}
.repo-list li:last-child { border-bottom: 0; }

/* Startseite vor dem Login: Hafen-Illustration, hell oder blau nach Systemfarbe */
.page-login {
  --login-fg: var(--brand);
  --login-muted: #2b4767;
  --login-panel: rgba(220, 229, 243, .72);
  --login-panel-solid: #dce5f3;
  background: #dce5f3 url("bg/hafen-hell-desktop.svg") center bottom / cover no-repeat fixed;
  color: var(--login-fg);
}
@media (max-aspect-ratio: 4/5) {
  .page-login { background-image: url("bg/hafen-hell-mobile.svg"); }
}
@media (prefers-color-scheme: dark) {
  .page-login {
    --login-fg: var(--on-brand);
    --login-muted: var(--on-brand-muted);
    --login-panel: rgba(0, 62, 122, .66);
    --login-panel-solid: var(--brand);
    background-color: var(--brand);
    background-image: url("bg/hafen-blau-desktop.svg");
  }
}
@media (prefers-color-scheme: dark) and (max-aspect-ratio: 4/5) {
  .page-login { background-image: url("bg/hafen-blau-mobile.svg"); }
}
.page-login main {
  max-width: none;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.login {
  box-sizing: border-box;
  width: 100%;
  max-width: 600px;
  padding: 2rem 1.25rem;
  text-align: center;
  /* Fläche hinter Logo und Text, damit Mond und Häuser die Schrift nicht stören */
  background: var(--login-panel);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-radius: 10px;
}
/* Logo als Text nachgebaut: Schild, Schriftzug, powered by */
.login-logo { text-align: center; padding: 0 1.5rem; }
.login-logo h1 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin: 0;
  color: var(--login-fg);
  font: 800 clamp(3.2rem, 14vw, 5.9rem)/1 "Segoe UI", system-ui, sans-serif;
  letter-spacing: -.02em;
}
/* Schild gleich gross wie bisher; Grossbuchstaben von „DocK“ so hoch wie das rote Schild */
.login-logo h1 img { height: .95em; width: auto; }
.login .powered { margin: 1.25rem 0 0; text-align: center; font-weight: 700; font-size: .95rem; color: var(--login-fg); }
.login-text {
  margin: .5rem auto 2rem;
  max-width: 400px;
  color: var(--login-muted);
  font-size: 1.05rem;
}
.btn-ms {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  min-width: 280px;
  padding: .75rem 1.5rem;
  border-radius: 4px;
  background: #ffffff;
  color: #14212f;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}
.btn-ms:hover { background: #eef3f9; }
.btn-ms:focus-visible { outline: 3px solid var(--brand-red); outline-offset: 3px; }
.login-foot {
  margin: 1.25rem 0 0;
  color: var(--login-muted);
  font-size: .85rem;
}
@media (max-width: 480px) {
  .btn-ms { min-width: 0; width: 100%; }
}

/* Steuerdatei */
code { font: .88em/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; }
.rules th { width: auto; }

/* Dokumentliste */
.table-wrap { overflow-x: auto; }
.docs { width: 100%; border-collapse: collapse; }
.docs th, .docs td { text-align: left; vertical-align: middle; padding: .6rem .6rem; border-bottom: 1px solid var(--border); }
.docs tr:last-child td { border-bottom: 0; }
.docs th { color: var(--muted); font-weight: 500; font-size: .85rem; white-space: nowrap; }
.docs th:first-child, .docs td:first-child { padding-left: 0; }
.docs th:last-child, .docs td:last-child { padding-right: 0; text-align: right; }
.nowrap { white-space: nowrap; }
.doc-number { font-weight: 600; white-space: nowrap; }
.doc-type { display: inline-block; margin-left: .4rem; padding: 0 .4rem; border-radius: 3px; font-size: .75rem;
  color: var(--muted); border: 1px solid var(--border); vertical-align: 1px; }
.doc-file { margin-top: .15rem; font: .8rem/1.35 ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--muted);
  overflow-wrap: anywhere; }
.rules td { word-break: normal; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  /* Handy: jedes Dokument als Block untereinander statt Tabelle */
  .docs, .docs tbody, .docs tr, .docs td { display: block; }
  .docs tr:has(th) { display: none; }
  .docs tr { padding: .7rem 0; border-bottom: 1px solid var(--border); }
  .docs tr:last-child { border-bottom: 0; }
  .docs td, .docs td:last-child { border: 0; padding: .15rem 0; text-align: left; }
  .docs td:last-child { padding-top: .5rem; }
  .details-row td { padding: .7rem !important; }
}
.status { white-space: nowrap; }

/* Details pro Dokument */
.details-toggle { margin-top: .3rem; padding: 0; border: 0; background: none; color: var(--accent); font: inherit;
  font-size: .8rem; cursor: pointer; }
.details-toggle::before { content: "▸ "; }
.details-toggle[aria-expanded="true"]::before { content: "▾ "; }
.docs tr.doc-row:has(+ tr.details-row:not([hidden])) td { border-bottom: 0; }
.docs .details-row td { background: var(--bg); padding: .8rem 1rem !important; text-align: left; }
.details-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem 2rem; }
.details-grid h4 { margin: 0 0 .4rem; font-size: .85rem; color: var(--muted); font-weight: 600; }
.details-grid dl { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; margin: 0; font-size: .85rem; }
.details-grid dt { color: var(--muted); }
.details-grid dd { margin: 0; overflow-wrap: anywhere; }
.details-grid p { margin: 0; font-size: .85rem; }
.all-rules { margin-top: 1rem; }
.all-rules summary { cursor: pointer; color: var(--muted); font-weight: 500; }
.all-rules[open] summary { margin-bottom: .5rem; }

/* Freigabestatus */
.status { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .85rem; border: 1px solid var(--border); }
.status-approved { border-color: #2e7d32; color: #2e7d32; }
.status-in_progress, .status-checked { border-color: var(--accent); color: var(--accent); }
.status-revoked { border-color: var(--warn); color: var(--warn); }
.status-not_requested { color: var(--muted); }
@media (prefers-color-scheme: dark) {
  .status-approved { border-color: #81c784; color: #81c784; }
}

/* Sprachumschalter */
.lang { display: flex; gap: .15rem; font-size: .8rem; font-weight: 600; letter-spacing: .03em; }
.lang a {
  padding: .2rem .4rem;
  border-radius: 3px;
  color: var(--on-brand-muted);
  text-decoration: none;
}
.lang a:hover { color: var(--on-brand); background: rgba(255, 255, 255, .12); }
.lang a[aria-current] { color: var(--brand); background: var(--on-brand); }
.topbar .who { margin-left: auto; }
.login-lang { position: absolute; top: 1rem; right: 1rem; z-index: 1; }
.login-lang .lang a { color: var(--login-muted); }
.login-lang .lang a:hover { color: var(--login-fg); background: var(--login-panel); }
.login-lang .lang a[aria-current] { color: var(--login-panel-solid); background: var(--login-fg); }

/* Meldungen, Formulare, Knöpfe */
.flash { padding: .6rem .9rem; border-radius: 4px; border: 1px solid var(--border); background: var(--surface); }
.flash-ok { border-color: #2e7d32; }
.flash-error { border-color: var(--warn); color: var(--warn); }
.btn-disabled { opacity: .45; cursor: not-allowed; }
.form fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
.form legend { font-weight: 600; margin-bottom: .4rem; }
.choice { display: flex; gap: .6rem; align-items: flex-start; padding: .4rem 0; }
.choice.disabled { opacity: .5; }
.software-source .source-detail { margin: 0 0 .5rem 1.6rem; }
.software-source textarea { width: 100%; box-sizing: border-box; }
.field { display: flex; flex-direction: column; gap: .3rem; margin: 0 0 1rem; font-weight: 600; }
.field input, .field textarea { font: inherit; font-weight: normal; padding: .4rem .5rem; border: 1px solid var(--border);
  border-radius: 4px; background: var(--surface); color: var(--text); max-width: 32rem; }

/* Review: Vorschau links, Kommentare rechts */
main:has(.review) { max-width: 1400px; }
.review { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); gap: 1.25rem; align-items: start; }
.review .card { margin-top: 0; }
.review-preview iframe { width: 100%; height: 75vh; border: 1px solid var(--border); border-radius: 4px; background: #fff; }
.comment-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.comment-list li { padding: .55rem 0; border-bottom: 1px solid var(--border); }
.comment-list li.reply { padding-left: 1rem; }
.comment-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.btn-secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn + .btn { margin-left: .35rem; }
.field input.short { max-width: 6rem; }
@media (max-width: 900px) {
  .review { grid-template-columns: 1fr; }
  .review-preview iframe { height: 60vh; }
}
button.btn { border: 1px solid transparent; font: inherit; font-size: .9rem; font-weight: 500; line-height: 1.5; cursor: pointer; }
button.btn:hover, a.btn:hover { filter: brightness(1.1); }
/* Abbrechen: gleiche Grösse wie die Aktionen, aber neutral grau, damit die Aktion hervorsticht */
.btn.btn-cancel { background: #e4e8ee; color: #2b3440; border-color: #c9d0da; }
.btn.btn-cancel:hover { filter: none; background: #d6dce5; }
@media (prefers-color-scheme: dark) {
  .btn.btn-cancel { background: #2c3644; color: #d5dbe3; border-color: #3d4958; }
  .btn.btn-cancel:hover { background: #364253; }
}

/* Hauptansicht: Baum links, Inhalt rechts */
main:has(.browse) { max-width: 1400px; }
.browse { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.tree { position: sticky; top: calc(var(--topbar-h, 0px) + 1rem); max-height: calc(100vh - var(--topbar-h, 0px) - 2rem); overflow-y: auto; background: var(--surface);
  border: 1px solid var(--border); border-top: 3px solid var(--brand); border-radius: 6px; padding: .75rem .5rem; }
.tree-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 .4rem .5rem;
  border-bottom: 1px solid var(--border); margin-bottom: .4rem; }
.tree-home { font-weight: 600; color: var(--text); text-decoration: none; padding: .1rem .4rem; margin-left: -.4rem; border-radius: 4px; }
.tree a { text-decoration: none; color: var(--text); }
.tree summary { display: flex; align-items: center; gap: .4rem; padding: .25rem .4rem; border-radius: 4px; cursor: pointer;
  list-style: none; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary::before { content: "▸"; color: var(--muted); font-size: .75rem; width: .8rem; flex: none; }
.tree details[open] > summary::before { content: "▾"; }
.tree summary a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-project > summary { font-weight: 600; }
.tree-repo { margin-left: .9rem; }
.tree-leaf { display: flex; align-items: center; gap: .4rem; margin-left: .9rem; padding: .25rem .4rem; border-radius: 4px; font-size: .95rem; }
.tree-leaf svg { width: .8rem; flex: none; color: var(--muted); }
.tree-leaf-text { flex: 1; min-width: 0; }
.tree-leaf:hover { background: var(--bg); }
.tree-leaf.active svg, .tree-leaf.active .count { color: var(--accent-text); }
.tree-repo > summary { font-size: .95rem; }
.tree-unit { margin-left: .9rem; }
.tree-unit > summary { font-size: .92rem; }
.tree ul { list-style: none; margin: 0 0 .3rem 1.7rem; padding: 0; }
.tree li a { display: block; padding: .2rem .4rem; border-radius: 4px; line-height: 1.25; }
.tree-doc-number { display: block; font-size: .88rem; }
.tree-doc-file { display: block; font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree summary:hover, .tree li a:hover { background: var(--bg); }
.tree .active, .tree summary.active, .tree li a.active { background: var(--accent); color: var(--accent-text); }
.tree summary.active a, .tree li a.active .tree-doc-file { color: var(--accent-text); }
.tree .count { font-size: .75rem; color: var(--muted); font-weight: normal; }
.tree summary.active .count { color: var(--accent-text); }
.pane > h1:first-child, .pane > .small:first-child { margin-top: 0; }
.pane .card:first-of-type { margin-top: 1rem; }

/* Willkommen, Projekt, Dokument */
.stats { display: flex; flex-wrap: wrap; gap: .5rem 2rem; margin: .75rem 0; }
.stats strong { font-size: 1.4rem; color: var(--brand); margin-right: .25rem; }
@media (prefers-color-scheme: dark) { .stats strong { color: var(--text); } }
.steps { margin: 0 0 .5rem; padding-left: 1.3rem; }
.steps li { margin: .3rem 0; }
.pre-line { white-space: pre-line; }
pre.code { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: .75rem 1rem; overflow-x: auto; }
.doc-summary-grid { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; align-items: flex-start; }
.doc-summary-grid > div > .muted.small:first-child { margin-bottom: .25rem; }
.doc-summary .big { font-size: 1.4rem; font-weight: 600; line-height: 1.2; }
.doc-actions { margin-left: auto; align-self: center; display: flex; flex-wrap: wrap; gap: .4rem; }
.doc-actions .btn + .btn { margin-left: 0; }
h1 .doc-type { font-size: .8rem; font-weight: normal; vertical-align: middle; }
a.doc-number { color: var(--accent); }

@media (max-width: 900px) {
  .browse { grid-template-columns: 1fr; }
  .tree { position: static; max-height: none; }
}

/* Projekt: Version und Status pro Eintrag; Historie */
.entry-docs { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; }
.entry-doc { display: flex; align-items: center; gap: .6rem; white-space: nowrap; }
.entry-version { font-weight: 600; min-width: 3.5rem; text-align: right; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { position: relative; padding: 0 0 1rem 1.2rem; border-left: 2px solid var(--border); margin-left: .3rem; }
.timeline > li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline > li::before { content: ""; position: absolute; left: -6px; top: .35rem; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); }
.timeline-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.timeline-stages { list-style: none; margin: .35rem 0 0; padding: 0; }
.timeline-stages li { padding: .15rem 0; }
.timeline-stages .stage { display: inline-block; min-width: 5.5rem; font-weight: 500; }

/* Testbetrieb: anderes Freigabe-Repo als dock-releases */
.test-banner { padding: .5rem 1.5rem; background: #fff3cd; color: #5c4400; border-bottom: 1px solid #e0c56e; font-size: .9rem; }
@media (prefers-color-scheme: dark) { .test-banner { background: #4a3b00; color: #ffe08a; border-color: #7a6200; } }

/* Benutzermenü in der Kopfzeile: Profil, Sprache, Abmelden */
.user-menu { position: relative; }
.user-menu summary { display: flex; align-items: center; gap: .55rem; cursor: pointer; list-style: none; padding: .25rem .5rem;
  border-radius: 999px; color: var(--on-brand); }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary::after { content: "▾"; font-size: .75rem; color: var(--on-brand-muted); }
.user-menu summary:hover, .user-menu[open] summary { background: rgba(255, 255, 255, .12); }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--on-brand); color: var(--brand); font-weight: 700; font-size: .8rem; text-transform: uppercase; }
.user-menu-panel { position: absolute; right: 0; top: calc(100% + .4rem); z-index: 20; min-width: 240px; padding: .4rem 0;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.user-menu-who { display: flex; flex-direction: column; padding: .5rem 1rem .6rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
.user-menu-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .45rem 1rem;
  color: var(--text); text-decoration: none; }
a.user-menu-item:hover { background: var(--bg); }
.user-menu-lang .lang a { color: var(--muted); }
.user-menu-lang .lang a:hover { color: var(--text); background: var(--bg); }
.user-menu-lang .lang a[aria-current] { color: var(--accent-text); background: var(--accent); }
@media (max-width: 640px) { .user-name { display: none; } }
.card .claims { margin-top: .5rem; background: transparent; }

/* Knöpfe für Dokumente immer gleich gross, unabhängig von Text und Sprache */
.doc-actions .btn, .docs td:last-child .btn, .review-preview .btn, .form button.btn, .form a.btn, .confirm-buttons .btn {
  box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;
  min-width: 10.5rem; height: 2.25rem; padding: 0 .9rem; white-space: nowrap; border: 1px solid transparent;
}
.doc-actions .btn-secondary, .docs td:last-child .btn-secondary, .review-preview .btn-secondary { border-color: var(--accent); }

/* Umschalter Freigabe-Repo in den Einstellungen (nur DocK-Admins) */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .8rem; font-weight: 600;
  padding: .2rem .55rem; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { background: var(--bg); color: var(--text); }
.seg button[aria-current] { background: var(--accent); color: var(--accent-text); }
.user-menu-repo { margin: 0; }

/* Anzeige Produktiv/Test in der Kopfzeile, links vom Benutzermenü */
.env-badge { margin-left: auto; padding: .2rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 700;
  letter-spacing: .02em; white-space: nowrap; color: #fff; }
.env-productive { background: #2e7d32; }
.env-test { background: var(--brand-red); }
/* gleich hoch wie die Kreise; Abstand zum Benutzerkreis wie zwischen Zurück und Home (.5rem):
   Lücke .9rem + Innenabstand des Benutzermenüs .5rem − .9rem */
.topbar .env-badge { height: 2rem; box-sizing: border-box; display: inline-flex; align-items: center; padding: 0 .8rem; }
.field select { font: inherit; font-weight: normal; padding: .4rem .5rem; border: 1px solid var(--border); border-radius: 4px;
  background: var(--surface); color: var(--text); max-width: 32rem; }
.field input.medium { max-width: 16rem; }
.tree-group { font-style: italic; color: var(--muted); }
.repo-list + .repo-list { border-top: 1px solid var(--border); }
.number-check { font-weight: 500; min-height: 1.2em; }
.number-check.ok { color: #2e7d32; }
.number-check.taken { color: var(--warn); }
@media (prefers-color-scheme: dark) { .number-check.ok { color: #81c784; } }
.flash-hint { border-color: #c9a227; }
.meta-found { margin-top: -.5rem; }
button.btn:disabled { opacity: .45; cursor: not-allowed; }
.field input[readonly] { background: var(--bg); color: var(--muted); }

/* Eigene Dateiauswahl: Text in der Sprache von DocK statt des Browsers */
.file-picker { display: flex; align-items: center; gap: .75rem; font-weight: normal; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-picker .btn { cursor: pointer; }
.file-input:focus-visible + .file-name, .file-picker .btn:focus-within { outline: 2px solid var(--accent); }

/* Eingabefelder: eigene Farben, im dunklen Modus heller als die Karte */
.field input, .field textarea, .field select, .review .field input, .review .field textarea {
  background: var(--input-bg); border-color: var(--input-border); color: var(--text); }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field input[readonly] { background: var(--bg); color: var(--muted); }

/* Einträge: Nummer, Version und Status in festen Spalten, damit alle Zeilen gleich eingerückt sind */
.entry-doc { display: grid; grid-template-columns: 9.5rem 8rem 12.5rem; align-items: center; gap: .6rem; }
.entry-doc > :first-child { text-align: left; }
.entry-doc .entry-version { text-align: right; min-width: 0; }
.entry-doc .status, .entry-doc > :last-child { justify-self: start; }
@media (max-width: 640px) { .entry-doc { grid-template-columns: auto auto auto; } }
.review-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.review-buttons .btn + .btn { margin-left: 0; }
.btn-danger { background: var(--warn); color: #fff; }
.review-decision { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--border); }
.review-decision .review-buttons { margin: .4rem 0 0; }
.form button.btn.btn-secondary { border-color: var(--accent); }
/* Status nach Stufe der laufenden Freigabe */
.status-review { border-color: var(--accent); color: var(--accent); }
.status-approval { border-color: #b26a00; color: #b26a00; }
.status-rejected { border-color: var(--warn); color: var(--warn); }
@media (prefers-color-scheme: dark) { .status-approval { border-color: #ffb74d; color: #ffb74d; } }
.withdraw summary { cursor: pointer; color: var(--warn); font-weight: 500; }
.withdraw[open] summary { margin-bottom: .5rem; }
.status-withdrawn { color: var(--muted); }
.number-check .number-link { display: block; margin-top: .2rem; font-weight: normal; color: var(--accent); }
.withdraw-hint { margin: 1rem 0 0; }
.draft-head { font-size: .9rem; color: var(--muted); margin: .25rem 0 .25rem; }
.draft-old { margin: .25rem 0; }
.draft-old summary { cursor: pointer; color: var(--muted); font-size: .9rem; padding: .3rem 0; }
.draft-old .comment-list { opacity: .85; }

/* Review: Vorschau so gross wie möglich, Kommentare in fester Breite rechts */
main:has(.review) { max-width: none; }
.review { grid-template-columns: minmax(0, 1fr) 400px; }
.review-preview iframe { height: calc(100vh - 340px); min-height: 480px; }
@media (max-width: 900px) {
  .review { grid-template-columns: 1fr; }
  .review-preview iframe { height: 75vh; min-height: 0; }
}

/* Status-Etiketten gefüllt, Farbe je Status (hell und dunkel lesbar) */
.status { border: 0; padding: .1rem .6rem; font-weight: 600; font-size: .8rem; }
.status-not_requested { background: #e3e8ee; color: #4a5866; }
.status-review { background: #f6d34a; color: #3d2f00; }
.status-approval { background: #f39c34; color: #2e1700; }
.status-rejected { background: #d93a3f; color: #fff; }
.status-approved { background: #2e7d32; color: #fff; }
.status-checked, .status-in_progress { background: #1f6fc4; color: #fff; }
.status-revoked { background: #7a1f24; color: #fff; }
.status-withdrawn { background: #9aa5b1; color: #1d2630; }
@media (prefers-color-scheme: dark) {
  .status-not_requested { background: #2b394a; color: #b7c3d0; }
  .status-review { background: #e8c53a; color: #2a2000; }
  .status-approval { background: #f0953a; color: #241200; }
  .status-rejected { background: #e0565b; color: #fff; }
  .status-approved { background: #43a047; color: #fff; }
  .status-checked, .status-in_progress { background: #3d8ce0; color: #fff; }
  .status-revoked { background: #a3343a; color: #fff; }
  .status-withdrawn { background: #59667a; color: #e6ebf1; }
}
.inline-form { display: inline; margin: 0; }
.orphan-actions details summary { cursor: pointer; color: var(--accent); font-size: .85rem; white-space: nowrap; }
.orphan-actions form { min-width: 240px; margin-top: .4rem; }
.orphan-actions textarea { width: 100%; font: inherit; background: var(--input-bg); color: var(--text); border: 1px solid var(--input-border); border-radius: 4px; padding: .3rem; }
.orphan-actions .btn { margin-top: .3rem; }
.moves { list-style: none; margin: 0 0 1rem; padding: .6rem .8rem; background: var(--bg); border-radius: 4px; }
.moves li + li { margin-top: .5rem; }
.moves .stage { display: inline-block; min-width: 5.5rem; font-weight: 500; }

/* Tags */
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; margin: 0 .3rem .3rem 0; border-radius: 999px;
        background: var(--bg); border: 1px solid var(--border, #ccd); font-size: .85rem; line-height: 1.5; }
.chip-fixed { background: color-mix(in srgb, var(--accent, #0b5394) 14%, transparent); border-color: color-mix(in srgb, var(--accent, #0b5394) 40%, transparent); }
.chip-x { border: 0; background: none; cursor: pointer; padding: 0; font-size: 1rem; line-height: 1; color: inherit; opacity: .6; }
.chip-x:hover { opacity: 1; }
.chip-suggest { cursor: pointer; font: inherit; font-size: .85rem; color: inherit; }
.chip-check { display: inline-flex; align-items: center; margin: 0 .3rem .3rem 0; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span { padding: .1rem .6rem; border-radius: 999px; border: 1px solid var(--border, #ccd); font-size: .85rem; }
.chip-check input:checked + span { background: var(--accent, #0b5394); border-color: var(--accent, #0b5394); color: #fff; }
.chip-check input:focus-visible + span { outline: 2px solid var(--accent, #0b5394); outline-offset: 2px; }
.tags-field .tag-fixed { margin: .3rem 0; }
.tag-free { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem; padding: .3rem .4rem; max-width: 34rem;
            border: 1px solid var(--input-border); border-radius: 4px; background: var(--input-bg); }
.tag-free .chip { margin: 0; }
.tag-input { flex: 1; min-width: 10rem; border: 0 !important; outline: none; background: transparent !important; padding: .2rem !important; }
.tag-suggest { margin: .3rem 0; }
.doc-tags { padding-top: .7rem; padding-bottom: .5rem; }
.doc-tags-row { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .1rem; }
.doc-tags-row > .muted:first-child { min-width: 4rem; }
.tags-edit summary { cursor: pointer; font-size: .9rem; margin-top: .3rem; }
.admin-tags { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 800px) { .admin-tags { grid-template-columns: 1fr; } }
.tags-field .tag-group { margin-bottom: .6rem; }
.tag-fields { display: grid; gap: .8rem; margin-bottom: .6rem; }
.tag-field-def { margin: 0; }
.tag-field-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .4rem 1.2rem; }
.tag-field-head .field { margin-bottom: 0; }
.tag-field-head .check { display: inline-flex; align-items: center; gap: .35rem; padding-bottom: .5rem; }
.link-button { border: 0; background: none; padding: 0 0 .5rem; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; font-size: .9rem; }
.doc-tags-row > .muted:first-child { min-width: 7rem; }
.doc-tags-row + .doc-tags-row { margin-top: .2rem; }
.tag-msg { margin-top: .25rem; }
.chip-dup { animation: chip-dup 1.2s ease-out; }
@keyframes chip-dup { 0%, 30% { background: #f6c343; border-color: #d39e00; color: #000; } 100% { } }
details.tag-field-def > summary, details.tag-free-def > summary { cursor: pointer; display: flex; align-items: baseline; gap: .7rem; list-style: none; }
details.tag-field-def > summary::-webkit-details-marker, details.tag-free-def > summary::-webkit-details-marker { display: none; }
details.tag-field-def > summary::before, details.tag-free-def > summary::before { content: "▸"; color: var(--accent); width: 1rem; transition: transform .15s; }
details.tag-field-def[open] > summary::before, details.tag-free-def[open] > summary::before { transform: rotate(90deg); }
details.tag-field-def[open] > summary, details.tag-free-def[open] > summary { margin-bottom: .6rem; }
.suggestion-dup { display: block; margin-top: .25rem; }
[hidden] { display: none !important; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-head h1 { margin-bottom: .3rem; }
.suggestion-table { width: 100%; }
.tag-table { width: 100%; border-collapse: collapse; margin-top: .3rem; }
.tag-table th { text-align: left; font-weight: 500; font-size: .8rem; color: var(--muted, #6b7785); padding: .2rem .4rem; border-bottom: 1px solid var(--border); }
.tag-table td { padding: .15rem .4rem; border-bottom: 1px solid var(--border); }
.tag-table .num { width: 5.5rem; text-align: right; font-variant-numeric: tabular-nums; font-size: .9rem; }
.tag-table td.zero { opacity: .5; }
.tag-table td:last-child { width: 2rem; text-align: center; }
.field .tag-table input { width: 100%; max-width: none; box-sizing: border-box; padding: .25rem .4rem; }
.tag-table tbody input { border-color: transparent; background: transparent; }
.tag-table tbody input:hover { border-color: var(--input-border); }
.tag-table input.dup { border-color: #d39e00 !important; background: color-mix(in srgb, #f6c343 25%, transparent) !important; }
.tag-table tfoot td { border-bottom: 0; padding-top: .4rem; }
.row-remove, .row-add { border: 0; background: none; cursor: pointer; font-size: 1.1rem; line-height: 1; color: var(--muted, #6b7785); padding: .2rem .35rem; border-radius: 4px; }
.row-remove:hover { color: #c0392b; background: color-mix(in srgb, #c0392b 10%, transparent); }
.row-add { color: var(--accent); font-weight: 600; }
.row-add:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.suggestion-table .unlisted { margin-top: .5rem; }
.page-head .btn-secondary { border-color: var(--accent); }
.tag-field-head .field-max input { width: 7rem; }
.tag-free { position: relative; max-width: none; }
.tags-field .tag-free { max-width: 40rem; }
.tag-options { position: absolute; left: -1px; right: -1px; top: 100%; z-index: 20; margin: 2px 0 0; padding: .2rem 0; list-style: none;
               background: var(--surface); border: 1px solid var(--input-border); border-radius: 4px; box-shadow: 0 4px 14px rgba(0,0,0,.15);
               max-height: 14rem; overflow-y: auto; }
.tag-options li { padding: .3rem .7rem; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag-options li.active, .tag-options li:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tag-options li mark { background: none; color: inherit; font-weight: 600; }
.tag-options li .new { color: var(--muted, #6b7785); font-size: .85rem; }
.page-actions { display: flex; gap: .6rem; align-items: center; }
.page-actions form { margin: 0; }

/* Tags: überall gleiche Höhe und gleiches Aussehen */
.chip { box-sizing: border-box; height: 1.6rem; margin: 0; padding: 0 .55rem; line-height: 1; font-size: .85rem; vertical-align: middle; }
button.chip { font-family: inherit; }
.tag-chips { display: contents; }
.tag-free { gap: .3rem; min-height: 2.5rem; box-sizing: border-box; }
.tag-input { height: 1.6rem; }
.tag-file, .unlisted, .doc-tags-row { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.unlisted .muted, .tag-file .muted { margin-right: .2rem; }
.doc-tags-row { min-height: 1.6rem; }
.doc-tags-row + .doc-tags-row { margin-top: .35rem; }
.doc-tags-row > .muted:first-child { line-height: 1.6rem; }
/* Baum: offene Aktionen */
.action-badge { flex: none; min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; box-sizing: border-box; border-radius: 999px;
                background: #d93a3f; color: #fff; font-size: .7rem; font-weight: 700; line-height: 1.15rem; text-align: center; }
.tree-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; vertical-align: middle;
            box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); }
.tree-dot.mine { width: .65rem; height: .65rem; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px #d93a3f; }
.tree li a.needs-action .tree-doc-number { font-weight: 600; }
.tree li a.active .tree-dot.mine { box-shadow: 0 0 0 2px var(--accent), 0 0 0 3.5px #fff; }
.tree summary .tree-group { flex: 1; min-width: 0; }
.tree a.tree-group { color: var(--muted); }
.tree summary.active a.tree-group { color: var(--accent-text); }
.tree-slot { flex: none; width: 1.4rem; display: inline-flex; justify-content: center; align-items: center; }
.tree .count { flex: none; width: 1.3rem; text-align: right; }
.tree summary .warn { flex: none; }
.tree li a { display: flex; align-items: center; gap: .4rem; }
.tree-doc-text { flex: 1; min-width: 0; }
.entry-doc .entry-version { white-space: normal; overflow-wrap: anywhere; }

/* Kopfzeile: Logo links, Suche in der Mitte, rechts Umgebung, Benutzer und Home */
.topbar:has(.topnav) { display: grid; grid-template-columns: minmax(max-content, 1fr) minmax(12rem, 34rem) minmax(max-content, 1fr); gap: .75rem 1.5rem; }
.user-name { white-space: nowrap; }
/* Alle Teile rechts im Kopf mit gleichem sichtbarem Abstand */
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; }
.topbar-right > .user-menu:not(.settings-menu) > summary { margin: 0 -.35rem; padding: .25rem .35rem; }
.topnav { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.topnav a { color: var(--on-brand); text-decoration: none; font-weight: 500; white-space: nowrap; }
.topnav a:hover { text-decoration: underline; }
.topnav-advanced { font-size: .85rem; color: var(--on-brand-muted) !important; }
.topnav-home { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; flex: none; border-radius: 50%;
               background: var(--on-brand); color: var(--brand); }
.topnav-home:hover { box-shadow: 0 0 0 3px rgba(255, 255, 255, .3); }
.topnav-back { border: 0; padding: 0; cursor: pointer; }
/* Leseansicht rechts vom Benutzermenü: runder Knopf mit Brille; aktiv (in der Leseansicht) invertiert */
.topnav-reader[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); box-shadow: 0 0 0 2px var(--on-brand); }
.topnav-reader[aria-pressed="true"]:hover { box-shadow: 0 0 0 2px var(--on-brand), 0 0 0 5px rgba(255, 255, 255, .3); }

/* Einstellungen (nur DocK-Admins): Zahnrad neben Home, Menü wie das Benutzermenü */
.settings-menu summary.topnav-home { padding: 0; gap: 0; border-radius: 50%; color: var(--brand); }
.settings-menu summary.topnav-home::after { content: none; }
.settings-menu summary.topnav-home:hover, .settings-menu[open] summary.topnav-home { background: var(--on-brand); box-shadow: 0 0 0 3px rgba(255, 255, 255, .3); }
.settings-menu .user-menu-panel { min-width: 290px; }
.settings-menu .user-menu-item > span:first-of-type { white-space: nowrap; }
.user-menu-sep { border-top: 1px solid var(--border); margin-top: .3rem; padding-top: .6rem; }
.topsearch { display: flex; flex: 1; min-width: 8rem; }
.topsearch input { flex: 1; min-width: 0; padding: .4rem .6rem; border: 1px solid rgba(255, 255, 255, .45); border-right: 0; border-radius: 4px 0 0 4px;
                   background: rgba(255, 255, 255, .12); color: var(--on-brand); font: inherit; }
.topsearch input::placeholder { color: var(--on-brand-muted); }
.topsearch input:focus { outline: none; background: #fff; color: #1d2630; }
.topsearch input:focus::placeholder { color: #6b7785; }
.topsearch button { padding: 0 .7rem; border: 1px solid rgba(255, 255, 255, .45); border-radius: 0 4px 4px 0; background: rgba(255, 255, 255, .18);
                    color: var(--on-brand); cursor: pointer; display: inline-flex; align-items: center; }
.topsearch button:hover { background: rgba(255, 255, 255, .3); }
@media (max-width: 900px) {
  .topbar:has(.topnav) { grid-template-columns: 1fr auto; }
  .topnav { grid-column: 1 / -1; grid-row: 2; }
  .topnav-advanced { display: none; }
}
/* Suche */
.search-filters .facet { border: 0; padding: 0; margin: 0 0 .9rem; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.search-filters legend { font-weight: 500; margin-bottom: .35rem; padding: 0; width: 100%; }
.facet-chip { display: inline-flex; cursor: pointer; }
.facet-chip input { position: absolute; opacity: 0; pointer-events: none; }
.facet-chip > span { box-sizing: border-box; height: 1.6rem; display: inline-flex; align-items: center; gap: .35rem; padding: 0 .6rem;
                     border: 1px solid var(--border); border-radius: 999px; font-size: .85rem; background: var(--surface); }
.facet-chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.facet-chip input:checked + span .muted { color: var(--accent-text); opacity: .8; }
.facet-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.status-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; padding: 0 !important; }
.search-selects { display: flex; flex-wrap: wrap; gap: 0 1.5rem; }
.search-actions { display: flex; align-items: center; gap: 1rem; }
.search-results td { vertical-align: top; }
.search-results .num { text-align: right; }
/* Suchseite breiter; Tabelle mit festen Spaltenanteilen, lange Namen brechen um statt die Karte zu sprengen */
main:has(.search-results), main:has(.search-filters) { max-width: 1400px; }
.search-results { width: 100%; table-layout: fixed; }
.search-results td { overflow-wrap: anywhere; }
/* Texte einzeilig, zu lange mit „…“ (voller Text im Tooltip) */
.search-results .ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.search-results th:nth-child(1) { width: 9.5rem; }
.search-results th:nth-child(3) { width: 11rem; }
.search-results th:nth-child(4) { width: 8rem; }
.search-results th:nth-child(5) { width: 10rem; }
.search-results th:nth-child(6) { width: 15rem; }
.search-results .search-place-inline { display: none; }
@media (max-width: 1150px) {
  .search-results th:nth-child(3), .search-results td:nth-child(3) { display: none; }
  .search-results th:nth-child(6) { width: 12rem; }
  .search-place-inline.ellipsis { display: block; }
}
.search-results th:last-child, .search-results td:last-child { text-align: left; }
.search-results td:first-child { overflow-wrap: normal; white-space: nowrap; }
.search-tags { display: flex; flex-wrap: nowrap; gap: .25rem; overflow: hidden; }
.search-tags.expanded { flex-wrap: wrap; }
.search-tags .chip { flex: none; }
.search-tags:not(.expanded) .chip:first-child { flex: 0 1 auto; min-width: 2.5rem; overflow: hidden; }
.search-tags:not(.expanded) .chip:first-child { display: block; line-height: 1.6rem; white-space: nowrap; text-overflow: ellipsis; }
.search-tags.fitting .chip:first-child { flex: none; }
.chip-more { cursor: pointer; font: inherit; font-size: .85rem; color: var(--accent); border-style: dashed; background: transparent; }
.chip-match { background: color-mix(in srgb, #f6c343 35%, var(--surface)); border-color: #d39e00; }
.search-place .doc-type { margin-left: 0; }

/* Dokumententabelle in Projekt- und Repo-Ansicht: zwei Zeilen pro Dokument, sortierbare Überschriften */
.doc-table { table-layout: fixed; }
.doc-table th:nth-child(2) { width: 10rem; }
.doc-table th:nth-child(3) { width: 9rem; }
.doc-table th:nth-child(4) { width: 11rem; }
.doc-table td { vertical-align: top; }
.doc-table td:last-child, .doc-table th:last-child { text-align: left; }
.doc-table .ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.doc-table .num { text-align: right; }
table[data-sortable] th button { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: .3rem; }
table[data-sortable] th button::after { content: "↕"; opacity: .35; font-size: .8em; }
table[data-sortable] th button[data-dir="asc"]::after { content: "▲"; opacity: .8; }
table[data-sortable] th button[data-dir="desc"]::after { content: "▼"; opacity: .8; }
table[data-sortable] th button:hover { color: var(--text); }

/* Login: Überraschung beim Mond (nur dunkler Modus, siehe login.html) */
.moon-target { position: fixed; z-index: 0; border-radius: 50%; display: none; }
.moon-egg { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; }
.moon-egg .moon-shadow { transform-box: view-box; }
.all-rules.all-rules-first { margin-top: 0; }

/* Willkommensseite: Wegweiser mit Beispielen der Markierungen */
.guide { margin: 0; padding-left: 1.2rem; display: grid; gap: .55rem; }
.guide-marks .tree-dot { margin: 0 .1rem; }
.guide-marks .action-badge { display: inline-block; margin: 0 .2rem; vertical-align: middle; }
.steps .status { margin-left: .3rem; vertical-align: middle; }
/* Software-Versionen eines Code-Eintrags: Commit-Nachricht linksbündig (in .docs ist die letzte Spalte für Knöpfe) */
.docs.software-versions td:last-child, .docs.software-versions th:last-child { text-align: left; }

/* Neue Baseline: Auswahl der Dokumente, scrollbar, Gruppen nach Projekt */
.doc-picker { max-height: 26rem; overflow-y: auto; border: 1px solid var(--border); border-radius: 4px; margin-top: .4rem; }
.doc-picker td:first-child { width: 2rem; }
.doc-picker .docs th, .doc-picker .docs td { padding-left: .75rem; padding-right: .75rem; }
.doc-picker label { cursor: pointer; }
.doc-picker .doc-group th { background: var(--bg); text-align: left; font-size: .8rem; position: sticky; top: 0; }
#doc-filter { margin-top: .4rem; }
.docs-toggle { background: none; border: 0; padding: 0; font: inherit; color: var(--text); cursor: pointer; white-space: nowrap; }
.docs-toggle::before { content: "▸"; display: inline-block; width: 1rem; color: var(--muted); }
.docs-toggle[aria-expanded="true"]::before { content: "▾"; }
.docs-toggle:hover { text-decoration: underline; }
/* Ausklappbare Detailzeile unter einer Tabellenzeile (Dokumente einer Baseline, Work Items einer Version) */
.docs tr.has-details:has(+ .row-details:not([hidden])) > td { border-bottom: 0; }
.docs .row-details > td { padding: 0 0 .8rem; text-align: left; }
.details-table { width: 100%; border-collapse: collapse; background: var(--bg); border-radius: 4px; font-size: .88rem; }
.docs .details-table td { padding: .45rem .75rem; border-bottom: 1px solid var(--border); text-align: left; }
.docs .details-table td:last-child { text-align: right; }
.docs .details-table tr:last-child td { border-bottom: 0; }
.docs .details-table td.nowrap:not(:last-child) { width: 1%; }

/* Baselines, die auf den Benutzer warten: roter Rand links wie im Baum */
.baseline-list tr.needs-action > td:first-child { box-shadow: inset 3px 0 0 #d93a3f; padding-left: .7rem; }
.your-turn { color: #d93a3f; font-weight: 600; }
@media (prefers-color-scheme: dark) { .your-turn { color: #ff7b7f; } }

.code-running { margin-top: .4rem; }
.doc-table td a.small[href*="/baseline/"] { display: block; }

/* Detail einer Baseline */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.2rem; margin: 0 0 .6rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.ok-text { color: #2e7d32; }
@media (prefers-color-scheme: dark) { .ok-text { color: #66bb6a; } }
.baseline-stages { list-style: none; padding: 0; margin: 0; }
.baseline-stages li { padding: .5rem 0; border-top: 1px solid var(--border); }
.baseline-stages li:first-child { border-top: 0; }
.baseline-stages .stage { margin-right: .6rem; }
.decision-buttons, .form-buttons { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.notice-box { border-left: 3px solid var(--warn); padding: .4rem .9rem; margin-bottom: 1rem; background: var(--bg); }

/* Bestätigung vor Aktionen (eigenes Fenster statt confirm() des Browsers) */
.confirm-dialog { width: min(28rem, calc(100vw - 2rem)); padding: 1.4rem 1.5rem 1.1rem; border: 1px solid var(--border);
  border-top: 3px solid var(--brand); border-radius: 6px; background: var(--surface); color: var(--text);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
.confirm-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.confirm-message { margin: 0 0 1.2rem; line-height: 1.45; }
.confirm-buttons { display: flex; justify-content: flex-end; gap: .6rem; margin: 0; }

/* Eingeflossene Work Items pro Software-Version: Typ farbig (Change Request violett, Bug rot, Issue blau) */
.wi-type { display: inline-block; padding: .1rem .5rem; margin: .1rem .3rem .1rem 0; border-radius: 999px; font-size: .75rem;
  font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.wi-type b { margin-left: .2rem; }
.wi-cr { background: #ede4fa; color: #5b2a9e; border-color: #c9b2ec; }
.wi-bug { background: #fbe4e4; color: #a12626; border-color: #f0b8b8; }
.wi-issue { background: #e2edfb; color: #1f4f91; border-color: #b6cdee; }
.wi-other { background: var(--bg); color: var(--muted); border-color: var(--border); }
@media (prefers-color-scheme: dark) {
  .wi-cr { background: #3a2a55; color: #d6c2ff; border-color: #5b4485; }
  .wi-bug { background: #4a2626; color: #ffb3b3; border-color: #7a3a3a; }
  .wi-issue { background: #22344f; color: #b5d1ff; border-color: #3a5680; }
}
.docs-toggle .wi-type { cursor: pointer; }
.docs-toggle:has(.wi-type):hover { text-decoration: none; }
/* Version aufklappen: Zusammenfassung und Commit-Zeile im selben Knopf, linksbündig */
.version-toggle { text-align: left; white-space: normal; display: block; }
.version-toggle .toggle-sub { display: block; margin: .15rem 0 0 1rem; }
.version-toggle:hover { text-decoration: none; }
.version-toggle:hover .toggle-sub { text-decoration: underline; }
.details-table + .details-table { margin-top: .5rem; }
.ref-unknown { margin: .5rem .75rem 0; }
.details-title { margin: .7rem .2rem .3rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.row-details td > .details-title:first-child { margin-top: .2rem; }
.wi-unlinked { background: #fff4d6; color: #7a5a00; border-color: #e8cf8a; }
.details-unlinked { opacity: .9; border-left: 3px solid #e0b84a; }
@media (prefers-color-scheme: dark) { .wi-unlinked { background: #4a3b00; color: #ffe08a; border-color: #7a6200; } }
.docs .details-commits td:last-child { text-align: right; }
.docs-toggle:hover .wi-type { filter: brightness(.95); }

/* Ablauf auf der Willkommensseite: Nummer, Text, Status in eigener rechtsbündiger Spalte */
.steps-flow { list-style: none; padding: 0; counter-reset: step; }
.steps-flow li { display: grid; grid-template-columns: 1.7rem 1fr auto; column-gap: .9rem; row-gap: .4rem; align-items: start;
  margin: 0; padding: .7rem 0; border-top: 1px solid var(--border); }
.steps-flow li:first-child { border-top: 0; padding-top: .2rem; }
.steps-flow li::before { counter-increment: step; content: counter(step); grid-column: 1; grid-row: 1;
  display: flex; align-items: center; justify-content: center; width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: var(--brand); color: var(--on-brand); font-size: .85rem; font-weight: 700; }
.steps-flow .step-text { grid-column: 2; align-self: center; }
.steps-flow .status { grid-column: 3; margin: 0; justify-self: end; align-self: center; min-width: 9.5rem; text-align: center; box-sizing: border-box; }
@media (max-width: 640px) {
  .steps-flow li { grid-template-columns: 1.7rem 1fr; }
  .steps-flow .status { grid-column: 2; justify-self: start; min-width: 0; }
}

/* Leseansicht */
main:has(.reader-table), main:has(.reader-filters) { max-width: 1400px; }
.reader-as { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.reader-as label { display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; }
.reader-filters input[type=search] { box-sizing: border-box; width: 100%; max-width: 34rem; margin-bottom: .8rem; padding: .45rem .6rem; font: inherit;
  background: var(--input-bg); color: var(--text); border: 1px solid var(--input-border); border-radius: 4px; }
.reader-filters input[type=search]:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.reader-table { table-layout: fixed; }
.reader-table th:nth-child(1) { width: 9.5rem; }
.reader-table th:nth-child(3) { width: 9rem; }
.reader-table th:nth-child(4) { width: 7rem; }
.reader-table th:nth-child(5) { width: 15rem; }
.reader-table th:nth-child(6) { width: 22rem; }
.reader-table td { vertical-align: middle; }
.reader-table .ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.reader-table .num { text-align: right; }
.reader-table td:last-child, .reader-table th:last-child { text-align: right; }
.reader-actions { display: flex; gap: .4rem; justify-content: flex-end; }
.reader-tags { flex-wrap: wrap; overflow: visible; }
.reader-tag-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0 1rem; }
.reader-group .group-id { width: 22rem; font-family: ui-monospace, monospace; font-size: .85rem; }
