:root {
  --bg: #f4f5f7; --panel: #fff; --text: #1f2933; --muted: #6b7785; --line: #e3e6ea;
  --accent: #0b4f9c; --accent-soft: #e6eefa; --danger: #b42318;
  --ok-bg: #c9f0c9; --ok-fg: #1d5c1d; --warn-bg: #fdecc0; --warn-fg: #7a5200;
  --off-bg: #6b6f76; --off-fg: #fff; --bad-bg: #f9d0cc; --bad-fg: #8a1c12;
  --radius: 6px; font-family: "Noto Sans", system-ui, sans-serif; font-size: 15px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171c; --panel: #1d2128; --text: #e6e9ee; --muted: #9aa5b1; --line: #2d333c;
    --accent: #6ea8f0; --accent-soft: #1d2a3d; --danger: #f08a80;
    --ok-bg: #214a2a; --ok-fg: #b8ecbf; --warn-bg: #4d3b10; --warn-fg: #f6d78a;
    --off-bg: #4b5058; --bad-bg: #5a2420; --bad-fg: #fbc4be; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius);
  padding: 7px 12px; min-height: 36px; }
button:hover { background: var(--accent-soft); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.danger { color: var(--danger); }
button.ghost { border-color: transparent; background: transparent; }
input, select, textarea { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 7px 9px; min-height: 36px; width: 100%; }
input[type=checkbox] { width: auto; min-height: 0; transform: scale(1.2); }
textarea { min-height: 70px; resize: vertical; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
label.f > :not(span) { font-weight: 400; font-size: 15px; color: var(--text); }
label.check { flex-direction: row; align-items: center; gap: 8px; }

header.top { display: flex; align-items: center; gap: 18px; padding: 10px 20px; background: var(--panel);
  border-bottom: 1px solid var(--line); flex-wrap: wrap; }
header.top h1 { font-size: 20px; margin: 0; }
header.top nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
header.top nav a { padding: 8px 12px; border-radius: var(--radius); color: var(--text); text-decoration: none; }
header.top nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
main { padding: 16px 20px; }

.tabs { display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
  margin-bottom: 12px; }
.tab { padding: 9px 14px; border: none; border-bottom: 3px solid transparent; border-radius: 0; background: none;
  color: var(--muted); }
.tab.active { color: var(--text); font-weight: 700; border-bottom-color: var(--accent); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.toolbar .f { min-width: 150px; }
.toolbar .grow { flex: 1; }

.card { background: var(--panel); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.08); overflow: auto; }
table.grid { border-collapse: collapse; width: 100%; white-space: nowrap; }
table.grid th { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: var(--panel); user-select: none; cursor: pointer; font-weight: 700; }
table.grid td { padding: 9px 10px; border-bottom: 1px solid var(--line); max-width: 280px; overflow: hidden;
  text-overflow: ellipsis; }
table.grid tbody tr { cursor: pointer; }
table.grid tbody tr:hover { background: var(--accent-soft); }
.muted { color: var(--muted); }
.empty { padding: 30px; text-align: center; color: var(--muted); }

.pill { display: inline-block; padding: 2px 11px; border-radius: 12px; font-size: 13px; }
.s-ok { background: var(--ok-bg); color: var(--ok-fg); }
.s-warn { background: var(--warn-bg); color: var(--warn-fg); }
.s-off { background: var(--off-bg); color: var(--off-fg); }
.s-bad { background: var(--bad-bg); color: var(--bad-fg); }
.s-plain { color: var(--muted); }
.rounds { font-size: 11px; color: var(--muted); margin-left: 4px; }
.late { color: var(--danger); font-weight: 600; }

dialog { border: none; border-radius: 10px; padding: 0; width: min(1000px, 96vw); max-height: 94vh;
  background: var(--panel); color: var(--text); box-shadow: 0 10px 40px rgba(0,0,0,.35); }
dialog.narrow { width: min(520px, 96vw); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog form { display: flex; flex-direction: column; max-height: 94vh; }
dialog .head { padding: 14px 20px; border-bottom: 1px solid var(--line); font-size: 18px; font-weight: 700; }
dialog .body { padding: 16px 20px; overflow: auto; flex: 1; }
dialog .foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
dialog .foot .left { margin-right: auto; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 16px; margin-bottom: 8px; }
.grid4 .wide { grid-column: 1 / -1; }
h3.sec { margin: 18px 0 8px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 15px; }
h3.sec:first-child { border: none; margin-top: 0; }
.insp { width: 100%; border-collapse: collapse; }
.insp th { font-size: 12px; color: var(--muted); text-align: left; padding: 4px; }
.insp td { padding: 3px; vertical-align: top; }
.insp input, .insp select { min-width: 110px; }
.insp .nr { width: 62px; min-width: 62px; }
.error { color: var(--danger); font-size: 13px; margin-right: auto; }

.menu { position: relative; display: inline-block; }
.menu .pop { position: absolute; right: 0; top: 100%; z-index: 20; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.2); min-width: 220px; max-height: 60vh; overflow: auto; padding: 4px; }
.menu .pop button { display: block; width: 100%; text-align: left; border: none; background: none; }
.menu .pop .lbl { padding: 6px 12px 2px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
#toasts { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #222; color: #fff; padding: 10px 14px; border-radius: var(--radius); max-width: 380px; }
.toast.err { background: var(--danger); }
.login { max-width: 360px; margin: 12vh auto; background: var(--panel); padding: 28px; border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12); display: flex; flex-direction: column; gap: 14px; }
.login h1 { margin: 0; font-size: 22px; }
.report td { padding: 2px 8px; }

@media (max-width: 800px) {
  main { padding: 10px; } header.top { padding: 8px 10px; gap: 8px; }
  button, input, select { min-height: 44px; }  /* Touch */
}
.insp td:nth-child(3) select { min-width: 230px; }

dialog.settings { width: min(1150px, 96vw); height: 90vh; display: flex; flex-direction: column; }
dialog.settings[open] { display: flex; }
.settings-body { display: flex; flex: 1; min-height: 0; }
.settings-nav { display: flex; flex-direction: column; width: 190px; padding: 10px; gap: 2px; border-right: 1px solid var(--line); flex-shrink: 0; }
.settings-nav .tab { text-align: left; border: none; border-left: 3px solid transparent; border-radius: 0; }
.settings-nav .tab.active { border-left-color: var(--accent); background: var(--accent-soft); }
.settings-content { flex: 1; padding: 16px 20px; overflow: auto; }
.login .sso { display: flex; flex-direction: column; gap: 8px; }
.login .sso a { text-align: center; text-decoration: none; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); font-weight: 600; min-height: 40px; }
.login .sso a:hover { background: var(--accent-soft); }
.login hr { border: none; border-top: 1px solid var(--line); width: 100%; margin: 0; }
@media (max-width: 800px) { .settings-body { flex-direction: column; } .settings-nav { flex-direction: row; width: auto; overflow: auto; border-right: none; border-bottom: 1px solid var(--line); } }
table.grid tr.group td { background: var(--accent-soft); font-weight: 700; max-width: none; }

/* ---- kompakte Kopfzeile: Titel | Projekt-Tabs | Benutzermenü */
header.top { flex-wrap: nowrap; gap: 12px; padding: 4px 12px; min-height: 46px; }
header.top h1 { font-size: 16px; white-space: nowrap; }
header.top .tabs { flex: 1; margin: 0; border-bottom: none; overflow-x: auto; flex-wrap: nowrap; align-items: stretch; scrollbar-width: thin; }
header.top .tab { padding: 12px 12px; white-space: nowrap; }
header.top .tabs .menu { display: flex; }
header.top .tabs .menu .pop { max-height: 70vh; }
.user-btn { border-radius: 50%; width: 36px; height: 36px; min-height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.icon { display: inline-flex; vertical-align: middle; }
main { padding: 8px 12px; }

/* ---- Werkzeugleiste über der Liste */
.toolbar { gap: 6px; margin-bottom: 8px; align-items: center; }
.tb-group { display: contents; }
.tb-btn { display: inline-flex; align-items: center; gap: 6px; }
.toolbar .tb-group > select, .toolbar .tb-group > input[type=search] { width: auto; min-height: 32px; padding: 4px 8px; }
.toolbar .tb-group > input[type=search] { min-width: 180px; max-width: 280px; flex: 0 1 240px; }
.toolbar button, .toolbar .menu > button { min-height: 32px; padding: 4px 10px; }
.toolbar label.check { flex-direction: row; align-items: center; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-soft); color: var(--accent); border-radius: 14px;
  padding: 2px 4px 2px 10px; font-size: 13px; }
.chip button { border: none; background: none; min-height: 0; padding: 0 6px; font-size: 16px; line-height: 1; color: inherit; border-radius: 50%; }
.menu .pop.left { left: 0; right: auto; }
.pop-head { padding: 8px 12px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.pop hr { border: none; border-top: 1px solid var(--line); margin: 4px 0; }
.small { font-size: 12px; }
.panel-row { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-bottom: 1px solid var(--line); }
.panel-row:last-child { border-bottom: none; }
.panel-ctl { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.panel-ctl select, .panel-ctl input[type=search] { width: 100%; max-width: none; }
.menu .pop .panel-ctl button { display: inline-block; width: auto; text-align: center; }
.menu .pop .flat-menu button { display: block; width: 100%; text-align: left; }
.flat-menu { display: flex; flex-direction: column; }
button.pin { border: none; background: none; min-height: 28px; width: 30px; padding: 0; color: var(--muted); opacity: .6; }
button.pin.on { color: var(--accent); opacity: 1; background: var(--accent-soft); }
.menu .pop button.pin { display: inline-flex; align-items: center; justify-content: center; width: 30px; flex: none; }
.panel-ctl > select, .panel-ctl > input[type=search] { flex: none; width: 100%; min-width: 0; max-width: none; min-height: 34px; }
.panel-ctl > label.check { padding: 4px 0; }

/* ---- Spaltenmenü (Filtern / Gruppieren) */
table.grid th { position: sticky; }
.col-btn { border: none; background: none; min-height: 0; padding: 0 4px; margin-left: 4px; font-size: 12px; color: var(--muted);
  opacity: 0; border-radius: 4px; vertical-align: middle; }
table.grid th:hover .col-btn, .col-btn.on, .col-btn:focus-visible { opacity: 1; }
.col-btn.on { color: var(--accent); background: var(--accent-soft); }
@media (hover: none) { .col-btn { opacity: .7; } }  /* Touch: kein Hover -> dauerhaft sichtbar */
.colmenu { position: fixed; z-index: 60; width: 270px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0,0,0,.3); padding: 4px; display: flex; flex-direction: column; }
.colmenu > button { text-align: left; border: none; background: none; }
.colmenu > button:hover { background: var(--accent-soft); }
.colmenu-pane { padding: 4px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 2px 0; }
.colmenu-pane input[type=search] { min-height: 32px; margin-bottom: 4px; }
.colmenu-values { max-height: min(40vh, 320px); overflow: auto; }
.colmenu-value { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 4px; cursor: pointer; font-size: 14px; }
.colmenu-value:hover { background: var(--accent-soft); }
.colmenu-value span:nth-child(2) { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.chip.group { background: var(--warn-bg); color: var(--warn-fg); }
.colmenu-values > button { display: block; width: 100%; text-align: left; border: none; background: none; min-height: 32px; padding: 4px 8px; }
.colmenu-values > button:hover { background: var(--accent-soft); }

/* ---- Prüfbericht-Fenster */
dialog.report-win { width: 98vw; max-width: 98vw; height: 95vh; display: none; flex-direction: column; }
dialog.report-win[open] { display: flex; }
dialog.report-win > .head { padding: 8px 14px; }
.rtabs { padding: 0 12px; margin: 0; border-bottom: 1px solid var(--line); }
.report-body { flex: 1; overflow: auto; padding: 12px 16px; }
.report-summary { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 8px 16px; border-top: 1px solid var(--line); background: var(--bg); }
.insp-scroll { overflow-x: auto; }
.insp-grid { --tools: 0px; min-width: 760px; }
.insp-grid.editing { --tools: 40px; min-width: 860px; }
.irow { display: grid; grid-template-columns: 56px minmax(220px, 1.5fr) 160px minmax(180px, 1.2fr) 84px var(--tools); gap: 6px;
  padding: 4px 0; border-bottom: 1px solid var(--line); align-items: start; }
.irow.ihead { position: sticky; top: 0; z-index: 2; background: var(--accent); color: #fff; font-weight: 700; padding: 6px; border-radius: 4px; align-items: center; }
.irow.chap { background: var(--bg); align-items: center; padding: 6px 0; }
.irow .no { font-weight: 700; padding: 6px 4px; }
.irow textarea, .irow input, .irow select { min-height: 30px; padding: 4px 6px; font-size: 14px; }
.irow textarea.auto { resize: none; overflow: hidden; }
.chap-titles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; grid-column: span 2; }
.chap-titles input:first-child { font-weight: 700; }
.chap-titles input:last-child { font-style: italic; }
.chap-actions, .item-actions { display: flex; gap: 2px; }
.chap-actions button, .item-actions button { padding: 2px 8px; min-height: 28px; }
.irow.chap > .chap-actions { grid-column: 6; }
.chap-state { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.ro { white-space: pre-wrap; padding: 6px 4px; }
.ro.check, .ro.t-de { color: var(--muted); }
.ro.crit { font-size: 15px; }
.ro.t-en { font-weight: 700; } .ro.t-de { font-style: italic; }
.ro-titles { cursor: pointer; align-items: center; }
.irow.item { border-bottom-color: transparent; } .irow.item:nth-of-type(even) { background: rgba(128, 128, 128, .06); }
button.chev { padding: 0 6px; min-height: 24px; margin-right: 2px; }
.add-row { padding: 2px 56px; opacity: .75; }
.add-row button { border-style: dashed; }
select.rating.r-blank { background: #ffff99; color: #222; }
select.rating.r-open { background: #ff9999; color: #222; }
select.rating.r-done { background: #ffff00; color: #222; }
select.rating.r-ok { background: #92d050; color: #222; }
select.rating.r-na { background: var(--bg); }
textarea.need, input.need { background: #ffffbb; color: #222; }
.act-cell { display: flex; align-items: center; gap: 4px; padding-top: 2px; }
button.act-add.need { background: #ffc107; border-color: #d39e00; color: #222; font-weight: 700; animation: act-pulse 1.6s ease-in-out infinite; }
@keyframes act-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, .7); } 50% { box-shadow: 0 0 0 6px rgba(255, 193, 7, 0); } }
button.act-count { padding: 0 4px; min-height: 22px; font-size: 14px; }
button.act-add { display: inline-flex; align-items: center; padding: 4px 8px; min-height: 30px; }
.missing-actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 6px 0; padding: 6px 8px; border-left: 4px solid #ffc107; background: var(--bg); }
.plan-scroll { overflow-x: auto; }
table.plan td { vertical-align: top; }
table.plan td.wide-cell { min-width: 280px; white-space: normal; }
table.plan textarea, table.plan input { width: 100%; min-width: 110px; }
button.jump { padding: 2px 8px; min-height: 26px; }
.flash { animation: row-flash 2.2s ease-out; }
@keyframes row-flash { 0%, 40% { background: rgba(255, 193, 7, .55); } 100% { background: transparent; } }
input.need[type=date]:last-of-type { background: #ffffbb; }
input.fin { background: #c9efa8; color: #222; }
fieldset.sign { border: 1px solid var(--line); border-radius: var(--radius); margin: 8px 0; padding: 8px 12px; }
fieldset.sign legend { font-weight: 700; padding: 0 6px; }
.sampling { display: flex; gap: 18px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.row-editor .insp input { min-width: 160px; }
/* Vorlagen-Editor */
.tpl-chapter { border: 1px solid var(--line); border-radius: var(--radius); margin: 8px 0; padding: 8px; }
.tpl-chap-head { display: grid; grid-template-columns: 28px 1fr 1fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.tpl-q { display: grid; grid-template-columns: 52px 1fr 1fr auto; gap: 6px; align-items: start; margin-bottom: 4px; }
.tpl-q .no { padding: 6px 2px; font-weight: 600; }
.tpl-q textarea { min-height: 30px; resize: none; overflow: hidden; padding: 4px 6px; }

/* ---- Offline-Betrieb */
.conn-ind { font-size: 12px; min-height: 28px; padding: 2px 10px; border-radius: 14px; background: var(--warn-bg); color: var(--warn-fg); border-color: transparent; white-space: nowrap; }
.conn-ind.off { background: var(--bad-bg); color: var(--bad-fg); }
.banners { padding: 0 16px; }
.banner { margin: 6px 0; padding: 7px 12px; border-radius: var(--radius); font-size: 13px; }
.banner.warn { background: var(--warn-bg); color: var(--warn-fg); }
.banner.bad { background: var(--bad-bg); color: var(--bad-fg); }
dialog.report-win .head button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.offline-home { max-width: 640px; margin: 8vh auto; text-align: center; }

/* ---- Smartphone: Platz für die Projekt-Tabs schaffen */
@media (max-width: 600px) {
  header.top h1 { display: none; }
  header.top { gap: 6px; padding: 2px 8px; }
  .toolbar .tb-group > input[type=search] { min-width: 140px; }
}

/* ---- Layout: Kopfzeile und Werkzeugleiste bleiben stehen, nur die Liste scrollt (Spaltenköpfe bleiben dadurch oben) */
html, body { height: 100%; }
body { overflow: hidden; }
#app { height: 100%; height: 100dvh; display: flex; flex-direction: column; overflow: auto; }
header.top { flex: none; }
main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
main > .toolbar { flex: none; }
main > .card { flex: 0 1 auto; min-height: 0; overflow: auto; }
/* Popup außerhalb scrollender Container (Weitere Projekte) */
.pop.fixed { position: fixed; z-index: 70; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0,0,0,.25); min-width: 220px; max-height: 70vh; overflow: auto; padding: 4px; }
.pop.fixed button { display: block; width: 100%; text-align: left; border: none; background: none; }
.pop.fixed .lbl { padding: 6px 12px 2px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }

/* ---- Ladeansicht (Listen) */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
/* sticky + Höhe 0: bleibt mittig im sichtbaren Teil der scrollenden Liste und verschiebt nichts */
.loading-badge { position: sticky; top: 35%; left: 0; height: 0; z-index: 6; display: flex; justify-content: center; pointer-events: none;
  animation: fadein .2s ease .15s both; }  /* erst nach 150 ms sichtbar: schnelle Ladevorgänge flackern nicht */
.loading-chip { display: flex; align-items: center; gap: 10px; padding: 10px 18px; background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 24px; box-shadow: 0 4px 16px rgba(0,0,0,.25); font-weight: 600; transform: translateY(-50%); height: fit-content; }
.card.is-loading > table, .card.is-loading > .empty { opacity: .45; transition: opacity .2s; pointer-events: none; }
.skeleton { padding: 4px 8px 12px; }
.sk-row { display: flex; gap: 18px; padding: 15px 8px; border-bottom: 1px solid var(--line); }
.sk-row:first-child { padding-top: 18px; }
.sk { height: 14px; flex: 1 1 0; max-width: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--line) 25%, var(--accent-soft) 50%, var(--line) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.load-error { padding: 28px; }
@media (prefers-reduced-motion: reduce) { .spinner, .sk { animation-duration: 3s; } }

/* ---- Bericht als eigene Seite (neues Fenster) */
.report-host { height: 100%; }
.report-page { display: flex; flex-direction: column; height: 100%; background: var(--panel); }
.report-page > .head { padding: 8px 16px; border-bottom: 1px solid var(--line); font-size: 16px; }
.report-page > .head button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.report-page .report-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
.report-host { flex: 1 1 auto; min-height: 0; }
/* Popup im Dialog: gleiche Darstellung wie im Dokument */
dialog .pop.fixed { z-index: 70; }

.insp td:nth-child(2) select { min-width: 230px; }
.insp .rev { font-size: 12px; margin-left: 4px; background: var(--accent-soft); color: var(--accent); }

/* Hinweise (Toasts): auch in modalen Dialogen sichtbar; Fehlertexte sind auswählbar und per Klick schließbar */
.toasts { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 300; max-width: min(520px, calc(100vw - 32px)); }
.toast { cursor: pointer; user-select: text; word-break: break-word; box-shadow: 0 4px 16px rgba(0,0,0,.35); }

/* Passwortregeln mit Live-Anzeige */
.pw-rules { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; }
.pw-rules li { color: var(--muted); }
.pw-rules li.ok { color: var(--ok-fg); font-weight: 600; }

/* Fragebogen: Felder ohne Rahmen, Rahmen/Werkzeuge nur bei Hover und Fokus (Touch: Werkzeuge immer sichtbar) */
.insp-grid .irow textarea.auto, .insp-grid .chap-titles input { border-color: transparent; background: transparent; box-shadow: none; }
.insp-grid .irow textarea.auto:hover, .insp-grid .chap-titles input:hover,
.insp-grid .irow textarea.auto:focus, .insp-grid .chap-titles input:focus { border-color: var(--line); background: var(--panel); }
.insp-grid .irow textarea.auto:disabled, .insp-grid .chap-titles input:disabled { opacity: 1; color: inherit; }
.insp-grid .item-actions, .insp-grid .chap-actions { opacity: 0; transition: opacity .12s; }
.insp-grid .irow:hover .item-actions, .insp-grid .irow:hover .chap-actions,
.insp-grid .irow:focus-within .item-actions, .insp-grid .irow:focus-within .chap-actions { opacity: 1; }
@media (hover: none) { .insp-grid .item-actions, .insp-grid .chap-actions { opacity: 1; } }
.insp-grid .add-row { opacity: 0; transition: opacity .12s; }
.insp-grid .add-row:hover, .insp-grid .add-row:focus-within { opacity: .9; }
@media (hover: none) { .insp-grid .add-row { opacity: .75; } }

button.row-menu { padding: 2px 10px; min-height: 28px; font-size: 18px; line-height: 1; font-weight: 700; }
.insp-grid .item-actions, .insp-grid .chap-actions { justify-content: flex-end; }

.irow.chap .chap-add { display: flex; align-items: center; }
.chap-add button { padding: 2px 8px; min-height: 28px; display: inline-flex; align-items: center; gap: 2px; }

/* Bilder zu Maßnahmen */
.img-box { margin-top: 4px; }
.img-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.img-strip .thumb { position: relative; }
.img-strip img { height: 72px; max-width: 120px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; cursor: zoom-in; display: block; }
.img-strip .thumb .x { position: absolute; top: 2px; right: 2px; padding: 0 5px; min-height: 20px; line-height: 1; background: rgba(0, 0, 0, .55); color: #fff; border: 0; border-radius: 10px; }
.img-tools { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; }
.img-tools button { padding: 2px 8px; min-height: 26px; font-size: 13px; }
tr.plan-row.drop { outline: 2px dashed var(--accent); outline-offset: -2px; background: rgba(79, 129, 189, .12); }

.annot-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.annot-bar .sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.annot-bar button { min-width: 38px; min-height: 36px; font-size: 18px; line-height: 1; }
.annot-bar .tool-btn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.annot-bar .color-btn { min-width: 32px; width: 32px; height: 32px; min-height: 32px; border-radius: 50%; border: 3px solid transparent; padding: 0; }
.annot-bar .color-btn.on { border-color: var(--text); }
dialog.wide { width: min(96vw, 1100px); max-width: 96vw; }

.splash { display: grid; place-items: center; min-height: 60vh; color: var(--muted); font-size: 18px; }

/* Maßnahmenplan im Stil des Fragebogens */
.plan-grid { --tools: 40px; min-width: 900px; }
.irow.prow { grid-template-columns: 34px 60px 140px minmax(260px, 1fr) 124px 124px 124px var(--tools); }
.irow.prow .no { padding: 6px 2px; }
.irow.prow .mode { padding: 6px 4px; }
.irow.prow.drop { outline: 2px dashed var(--accent); outline-offset: -2px; background: rgba(79, 129, 189, .12); }
.plan-grid .irow textarea.auto, .plan-grid .irow input:not([type=file]) { border-color: transparent; background: transparent; box-shadow: none; }
.plan-grid .irow textarea.auto:hover, .plan-grid .irow input:not([type=file]):hover,
.plan-grid .irow textarea.auto:focus, .plan-grid .irow input:not([type=file]):focus { border-color: var(--line); background: var(--panel); }
.plan-grid button.jump { padding: 2px 4px; min-height: 26px; font-size: 13px; white-space: nowrap; }
button.sort-btn { background: transparent; border: 0; color: inherit; font: inherit; font-weight: 700; padding: 0; min-height: 0; cursor: pointer; text-align: left; white-space: nowrap; }
button.sort-btn:hover { text-decoration: underline; }

/* Vorlagen-Editor */
.tpl-split { flex: 1 1 auto; min-height: 0; display: flex; }
.tpl-side { width: 300px; flex: none; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tpl-side-tools { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
.tpl-list { overflow: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
button.tpl-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; background: transparent; border: 1px solid transparent; padding: 8px 10px; white-space: normal; }
button.tpl-item:hover { background: var(--bg); }
button.tpl-item.on { background: var(--accent-soft); border-color: var(--accent); }
button.tpl-item.off b { color: var(--muted); }
.tpl-editor { padding: 12px 16px; }
.tpl-head { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; max-width: 900px; margin-bottom: 8px; }
.tpl-head .wide { grid-column: 1 / -1; }
.tpl-grid { min-width: 720px; }
.tpl-grid .irow { grid-template-columns: 78px minmax(220px, 1fr) minmax(220px, 1fr) var(--tools); }
.tpl-grid .irow.chap input { font-weight: 700; width: 100%; }
.tpl-grid .irow.chap input.de { font-weight: 400; font-style: italic; }
.tpl-grid .irow input, .tpl-grid .irow textarea.auto { border-color: transparent; background: transparent; box-shadow: none; }
.tpl-grid .irow input:hover, .tpl-grid .irow textarea.auto:hover, .tpl-grid .irow input:focus, .tpl-grid .irow textarea.auto:focus { border-color: var(--line); background: var(--panel); }
.tpl-grid .no { display: flex; align-items: center; gap: 2px; white-space: nowrap; }
.drag-handle { cursor: grab; color: var(--muted); padding: 0 2px; user-select: none; }
.tpl-grid .irow.dragover { outline: 2px dashed var(--accent); outline-offset: -2px; background: rgba(79, 129, 189, .12); }
.tpl-grid button.add-q { padding: 0 6px; min-height: 22px; opacity: 0; }
.tpl-grid .irow.chap:hover button.add-q { opacity: 1; }
@media (hover: none) { .tpl-grid button.add-q { opacity: 1; } }
@media (max-width: 900px) { .tpl-split { flex-direction: column; } .tpl-side { width: auto; max-height: 38vh; border-right: 0; border-bottom: 1px solid var(--line); } }

/* zweisprachige Fragen im Vorlagen-Editor */
.tpl-grid { min-width: 1150px; }
.tpl-grid .irow { grid-template-columns: 78px repeat(4, minmax(170px, 1fr)) var(--tools); }
.tpl-grid .missing { box-shadow: inset 3px 0 0 #ffc107; background: rgba(255, 193, 7, .08); border-radius: 3px; }
.warn-text { color: #d39e00; font-weight: 600; }

/* Planungsliste: eine Bubble je Einzelabnahme (Farbe = Status) */
.bubbles { display: flex; flex-wrap: wrap; gap: 4px; }
.bubble { display: inline-block; padding: 1px 9px; border-radius: 11px; font-size: 12.5px; line-height: 1.6; white-space: nowrap; border: 1px solid transparent; }
.bubble .bd { opacity: .85; }
.bubble.late { color: inherit; font-weight: 700; }  /* überfällig: Statusfarbe bleibt, fett + „!“ */
.c-gray { background: rgba(128, 128, 128, .18); border-color: rgba(128, 128, 128, .35); }
.c-yellow { background: rgba(245, 190, 20, .25); border-color: rgba(245, 190, 20, .6); }
.c-blue { background: rgba(59, 130, 246, .22); border-color: rgba(59, 130, 246, .55); }
.c-green { background: rgba(34, 170, 90, .26); border-color: rgba(34, 170, 90, .6); }
.c-lime { background: rgba(150, 200, 40, .28); border-color: rgba(150, 200, 40, .65); }
.c-orange { background: rgba(245, 130, 30, .27); border-color: rgba(245, 130, 30, .65); }
.c-red { background: rgba(229, 72, 77, .26); border-color: rgba(229, 72, 77, .65); }
.c-purple { background: rgba(150, 90, 220, .25); border-color: rgba(150, 90, 220, .6); }
.c-teal { background: rgba(20, 170, 170, .25); border-color: rgba(20, 170, 170, .6); }
.c-pink { background: rgba(224, 85, 155, .24); border-color: rgba(224, 85, 155, .6); }
.c-brown { background: rgba(160, 104, 60, .26); border-color: rgba(160, 104, 60, .65); }
.c-indigo { background: rgba(91, 95, 214, .24); border-color: rgba(91, 95, 214, .6); }
.pill[class*="c-"] { border: 1px solid transparent; color: inherit; }
.pill.c-gray { border-color: rgba(128, 128, 128, .35); } .pill.c-yellow { border-color: rgba(245, 190, 20, .6); } .pill.c-blue { border-color: rgba(59, 130, 246, .55); }
.pill.c-green { border-color: rgba(34, 170, 90, .6); } .pill.c-lime { border-color: rgba(150, 200, 40, .65); } .pill.c-orange { border-color: rgba(245, 130, 30, .65); }
.pill.c-red { border-color: rgba(229, 72, 77, .65); } .pill.c-purple { border-color: rgba(150, 90, 220, .6); } .pill.c-teal { border-color: rgba(20, 170, 170, .6); }
.pill.c-pink { border-color: rgba(224, 85, 155, .6); } .pill.c-brown { border-color: rgba(160, 104, 60, .65); } .pill.c-indigo { border-color: rgba(91, 95, 214, .6); }

/* noch nicht stattgefundene Einzelabnahmen (z. B. erforderlich, geplant): nur die Umrandung ist farbig */
.bubble.outline { background: transparent; border-width: 1.5px; padding: 0 8px; }
.bubble.outline.c-gray { border-color: rgba(128, 128, 128, .8); } .bubble.outline.c-yellow { border-color: rgba(245, 190, 20, .95); }
.bubble.outline.c-blue { border-color: rgba(59, 130, 246, .95); } .bubble.outline.c-green { border-color: rgba(34, 170, 90, .95); }
.bubble.outline.c-lime { border-color: rgba(150, 200, 40, .95); } .bubble.outline.c-orange { border-color: rgba(245, 130, 30, .95); }
.bubble.outline.c-red { border-color: rgba(229, 72, 77, .95); } .bubble.outline.c-purple { border-color: rgba(150, 90, 220, .95); }
.bubble.outline.c-teal { border-color: rgba(20, 170, 170, .95); }
.bubble.outline.c-pink { border-color: rgba(224, 85, 155, .95); } .bubble.outline.c-brown { border-color: rgba(160, 104, 60, .95); }
.bubble.outline.c-indigo { border-color: rgba(91, 95, 214, .95); }

/* Bubble zweizeilig: Typ · Termin, darunter der Status */
.bubble { border-radius: 12px; padding: 2px 10px; line-height: 1.25; vertical-align: top; }
.bubble .bl, .bubble .bs { display: block; }
.bubble .bs { font-size: 11px; opacity: .85; font-weight: 400; }
.bubble.outline { padding: 1px 9px; }
.bubble .bd { display: block; font-size: 12px; opacity: 1; }
.bubble { text-align: center; min-width: 74px; }

/* Planungsliste: einheitliche Zeilenhöhe (mit und ohne Bubbles), Bubbles kompakt */
table.plan-list tbody tr:not(.group) td { height: 42px; padding-top: 1px; padding-bottom: 1px; }
table.plan-list .bubbles { gap: 3px; align-content: center; }
.bubble { line-height: 1.12; padding: 1px 9px; min-width: 70px; }
.bubble.outline { padding: 0 8px; }
.bubble .bl { font-size: 12.5px; } .bubble .bd { font-size: 11.5px; }
/* Bubbles ohne Termin: einzeilig, aber gleich hoch und vertikal zentriert wie die zweizeiligen */
.bubble { display: inline-flex; flex-direction: column; justify-content: center; min-height: 34px; box-sizing: border-box; }
.bubble.outline { min-height: 34px; }

/* Projektmenü: dreispaltig (Kürzel, Projektname, Pin) ohne Überschriften */
.pop .proj-row { display: grid; grid-template-columns: 110px minmax(200px, 1fr) 30px; align-items: center; gap: 4px; }
.pop .proj-row button.pc { font-weight: 600; text-align: left; white-space: nowrap; }
.pop .proj-row button.pn { color: var(--muted); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop .proj-row button.pin { width: 30px; }
.pop .proj-row button { padding: 6px 8px; }
.pop .proj-row button.pin { display: inline-flex; align-items: center; justify-content: center; width: 30px; min-height: 28px; padding: 0; flex: none; }

/* Teilnehmerliste im Deckblatt: gleiche Optik wie Fragebogen und Maßnahmenplan */
.part-grid { min-width: 560px; }
.part-grid .irow { grid-template-columns: minmax(180px, 1.3fr) minmax(160px, 1fr) minmax(180px, 1fr) var(--tools); }
.part-grid .irow input { width: 100%; min-width: 0; border-color: transparent; background: transparent; box-shadow: none; }
.part-grid .irow input:hover, .part-grid .irow input:focus { border-color: var(--line); background: var(--panel); }
.part-grid .irow input:disabled { opacity: 1; color: inherit; }
.part-grid.ident-grid .irow { grid-template-columns: minmax(90px, 16fr) minmax(110px, 20fr) minmax(70px, 14fr) minmax(200px, 50fr) var(--tools); }
.part-grid.sign-grid .irow { grid-template-columns: minmax(160px, 1.2fr) minmax(140px, 1fr) minmax(150px, 1fr) minmax(180px, 1.2fr) var(--tools); }
.part-grid.sign-grid .irow select { width: 100%; min-width: 0; }

/* Herstellorte (Lieferant) und OpenStreetMap-Suche */
.site-rows { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 6px; }
.site-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(200px, 2fr) auto auto; gap: 6px; align-items: center; }
.place-list { display: flex; flex-direction: column; gap: 4px; max-height: 40vh; overflow: auto; }
.place { display: flex; flex-direction: row; gap: 8px; align-items: flex-start; padding: 6px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; font-weight: 400; color: inherit; }
.place input { width: auto; min-height: 0; margin: 4px 0 0; }

/* Projekt-Dashboard über der Planungsliste: Kachel je Abnahme-Typ (Ring, Abschlussgrad, Anzahlen); einklappbar */
main > .card.dash { flex: none; margin-bottom: 12px; overflow: visible; }  /* nicht von der Liste zusammendrücken lassen */
.dash-head { display: flex; align-items: center; gap: 6px 14px; padding: 6px 10px; flex-wrap: wrap; }
.dash-toggle { font-weight: 700; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 8px; }
.dash-chev { display: inline-block; transition: transform .15s; }
.dash.closed .dash-chev { transform: rotate(-90deg); }
.dash-stand { margin-left: auto; font-size: 12.5px; }
.dash-mini { display: none; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.dash.closed .dash-mini { display: flex; }
.dash-mini b { color: var(--text); font-variant-numeric: tabular-nums; }
.dash-mini i { display: inline-block; width: 46px; height: 6px; border-radius: 3px; background: var(--line); vertical-align: 2px; margin-left: 5px; overflow: hidden; }
.dash-mini u { display: block; height: 100%; background: #22aa5a; }
.dash.closed .dash-body { display: none; }
.dash-body { display: grid; gap: 8px; padding: 2px 12px 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 205px), 1fr)); }
.dash-tile { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: grid; grid-template-columns: 64px 1fr;
  gap: 8px 10px; align-items: center; }
.dash-track { stroke: var(--line); }
.dash-name { font-weight: 700; }
.dash-pct { font-size: 22px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.dash-sub { font-size: 12px; color: var(--muted); }
.dash-counts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; font-variant-numeric: tabular-nums; }
.dash-counts span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 4px; }
@media (prefers-reduced-motion: reduce) { .dash-chev { transition: none; } }

/* Farbauswahl (Status): runde Farbfelder, gewähltes mit Haken; in Tabellen Farbpunkt vor dem Namen */
.swatches { display: grid; grid-template-columns: repeat(6, 34px); gap: 8px; }
.swatch { width: 34px; height: 34px; min-height: 0; padding: 0; border-radius: 50%; border: 2px solid transparent; background: var(--c);
  display: inline-flex; align-items: center; justify-content: center; }
.swatch:hover { background: var(--c); transform: scale(1.08); }
.swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatch.on { border-color: var(--panel); box-shadow: 0 0 0 2px var(--c); }
.swatch.on::after { content: ""; width: 10px; height: 6px; border: solid #fff; border-width: 0 0 2.5px 2.5px; transform: translateY(-1px) rotate(-45deg); }
.swatch:disabled { cursor: default; transform: none; }
.swatch-cell { display: inline-flex; align-items: center; gap: 7px; }
.swatch-cell i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }
@media (prefers-reduced-motion: reduce) { .swatch:hover { transform: none; } }
div.f:has(> .swatches) { display: flex; flex-direction: column; gap: 6px; }
div.f:has(> .swatches) > span { font-size: 12px; font-weight: 600; color: var(--muted); }
