/* ---------- v16: Modulleiste im Rosentritt-Blau, Finanzierungen und Versicherungen ---------- */
/* Farben aus R_Farben-2025: Rosentritt Blau #0091a7, Rosentritt Grün #76b728 */
:root {
  --blue: #0091a7; --blue-dark: #00788a; --blue-soft: #e6f4f6;
  --ci-blue: #0091a7; --ci-green: #76b728;
  --rail-w: 74px;
  --c-wohn: #0091a7; --c-gew: #76b728; --c-best: #8a6fa8; --c-sonst: #9aa1a6; --c-dep: #b9874f;
  --c-bank: #0091a7; --c-crowd: #76b728; --c-ek: #b8c2c6;
  --grid: #f0f2f2;
}
.layout { grid-template-columns: var(--rail-w) var(--side-w) minmax(0, 1fr) auto; }
.nav-item:hover { background: rgba(0,145,167,.08); }
.nav-item .ico { color: var(--blue); }

/* Modulleiste */
.rail { background: var(--ci-blue); display: flex; flex-direction: column; align-items: stretch; padding: 14px 6px 10px; gap: 4px; min-height: 0; z-index: 35; }
.rail .mark { display: grid; place-items: center; height: 34px; margin-bottom: 12px; }
.rail .mark img { width: 30px; filter: brightness(0) invert(1); }
.rbtn { border: 0; background: none; color: rgba(255,255,255,.82); border-radius: 8px; padding: 9px 2px 7px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10.5px; position: relative; }
.rbtn svg { width: 20px; height: 20px; }
.rbtn:hover { background: rgba(255,255,255,.12); color: #fff; }
.rbtn.on { background: rgba(255,255,255,.22); color: #fff; font-weight: 600; }
.rbtn .lock { position: absolute; top: 5px; right: 9px; font-size: 9px; }
.rbtn .badge { position: absolute; top: 4px; right: 10px; background: var(--panel); color: var(--red); font-size: 9.5px; font-weight: 700; border-radius: 8px; padding: 0 5px; line-height: 15px; }
.rail .grow { flex: 1; }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .layout > .main { grid-row: 2; }
  .rail { flex-direction: row; padding: 6px max(10px, env(safe-area-inset-right, 0px)) 6px max(10px, env(safe-area-inset-left, 0px)); overflow-x: auto; gap: 2px; }
  .rail .mark, .rail .grow { display: none; }
  .rbtn { flex: 1; min-width: 58px; padding: 6px 2px 5px; }
  .layout > .sidebar { position: fixed; inset: 0 auto 0 0; width: min(290px, 86vw); z-index: 40; }
  .layout > .detail { position: fixed; inset: 0; width: auto; z-index: 45; }
}

/* Inhalt der Module */
.fv { font-variant-numeric: tabular-nums; }
.fv .num { font-variant-numeric: tabular-nums; }
.fv .muted { color: var(--muted); }
.fv .assum { font-style: italic; color: var(--orange); }
.fv .note { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); background: var(--soft); border-radius: 8px; padding: 8px 12px; color: var(--muted); font-size: 11.5px; margin: 0 0 14px; max-width: 1100px; }
.fv .note b { color: var(--text); font-weight: 600; }

/* Filter oben: Bauträgerobjekte / Bestand / geplante */
.fbar { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin: 2px 0 14px; font-size: 12px; }
.fbar .lab { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.fbar label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.fbar input { accent-color: var(--ci-blue); width: 14px; height: 14px; margin: 0; }
.fbar .sw { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.fbar .cnt { color: var(--muted); font-size: 11px; }
.fbar select { border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; background: var(--panel); font-size: 12px; }
.sw { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex: none; }

/* Kacheln */
.fv .tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 2px 0 16px; }
.fv .tile { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--panel); min-width: 0; }
.fv .tile .k { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.fv .tile .v { font-size: 17px; font-weight: 650; margin-top: 2px; white-space: nowrap; }
.fv .tile .v.red { color: var(--red); }
.fv .tile .t { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.fv .yrs { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; column-gap: 16px; margin-top: 3px; }
.fv .yrs span { font-size: 10.5px; color: var(--muted); }
.fv .yrs b { font-size: 14px; font-weight: 650; }

/* Tabellen: Spaltenbreite ziehen (Rand der Überschrift), Spalten per Drag & Drop verschieben */
.fv .tw { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); margin-bottom: 8px; }
.fv table.rt { border-collapse: collapse; table-layout: fixed; min-width: 100%; }
.fv table.rt th, .fv table.rt td { overflow: hidden; text-overflow: ellipsis; }
.fv table { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.fv th { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; text-align: right; padding: 8px 10px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel); position: relative; }
.fv th[draggable="true"] { cursor: grab; }
.fv th.drop-l { box-shadow: inset 2px 0 0 var(--ci-blue); }
.fv th.drop-r { box-shadow: inset -2px 0 0 var(--ci-blue); }
.fv th.dragging { opacity: .4; }
.fv th .cr { position: absolute; top: 0; right: 0; width: 7px; height: 100%; cursor: col-resize; touch-action: none; }
.fv th .cr::after { content: ""; position: absolute; top: 20%; bottom: 20%; right: 2px; width: 1px; background: var(--line); }
.fv th .cr:hover::after, body.resizing .fv th .cr.act::after { background: var(--ci-blue); width: 2px; top: 0; bottom: 0; }
.fv th.l, .fv td.l { text-align: left; }
.fv th.c, .fv td.c { text-align: center; }
.fv td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; vertical-align: middle; font-size: 12px; }
.fv tr:last-child td { border-bottom: 0; }
.fv tr.r { cursor: pointer; }
.fv tr.r:hover td { background: var(--soft); }
.fv tr.g td { background: var(--soft); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding-top: 7px; padding-bottom: 5px; }
.fv tr.g td b { color: var(--text); }
.fv tr.s td { font-weight: 650; border-top: 1px solid #cfd6d8; }
.fv tr.s.first td { border-top: 2px solid var(--text); }
.fv .pn { font-weight: 600; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.fv .ps { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.fv .ft { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; border-radius: 9px; padding: 0 7px; line-height: 17px; background: var(--soft); color: var(--muted); white-space: nowrap; font-weight: 500; }
.fv .ft.red { background: var(--red-soft); color: var(--red); font-weight: 600; }
.fv .ft.or { background: var(--orange-soft); color: var(--orange); font-weight: 600; }
.fv .ft.ok { background: light-dark(#eef3e8, var(--soft)); color: var(--green-dark); }
.fv .ft.blue { background: var(--blue-soft); color: var(--blue-dark); }
.fv .warnmark { color: var(--orange); font-weight: 700; margin-left: 4px; cursor: help; }
.fv .spark { display: inline-flex; align-items: flex-end; gap: 1px; height: 20px; vertical-align: middle; }
.fv .spark i { width: 4px; background: var(--c-wohn); border-radius: 1px 1px 0 0; opacity: .45; }
.fv .spark i.now { opacity: 1; }
.fv .spark i.err { background: var(--orange); }
.fv .tblfoot { display: flex; gap: 14px; justify-content: space-between; font-size: 11px; color: var(--muted); margin: 0 0 18px; flex-wrap: wrap; }
.fv .linkbtn { border: 0; background: none; padding: 0; color: var(--blue-dark); font-size: 11px; text-decoration: underline; text-underline-offset: 2px; }

/* Bankenübersicht: Zeitplan */
.fv td.q { padding: 6px 6px; font-size: 11.5px; }
.fv td.q.fin { background: light-dark(#f1f5f6, var(--soft)); }
.fv td.q.bau { background: #d5edf1; color: #004f5b; font-weight: 600; box-shadow: inset 0 -3px 0 var(--ci-blue); }
.fv td.q.now { outline: 1px dashed #9fb5ba; outline-offset: -1px; }
.fv th.q.now { color: var(--text); }
.fv tr.r:hover td.q.bau { background: #c6e6eb; }
.fv .bleg { display: inline-flex; align-items: center; gap: 6px; }
.fv .bleg i { width: 18px; height: 10px; border-radius: 2px; display: inline-block; }
.fv .bleg i.bau { background: #d5edf1; box-shadow: inset 0 -3px 0 var(--ci-blue); }
.fv .bleg i.fin { background: light-dark(#f1f5f6, var(--soft)); border: 1px solid #e3e9ea; }
.fv .printhead { display: none; }

/* Karten und Diagramme */
.fv .grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; margin-bottom: 14px; }
.fv .fc { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 12px 14px; min-width: 0; position: relative; }
.fv .fc h3 { margin: 0; font-size: 12.5px; font-weight: 650; }
.fv .fc .cs { color: var(--muted); font-size: 11px; margin: 1px 0 8px; }
.fv .fc.wide { grid-column: 1 / -1; }
.fv .legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11px; color: var(--muted); margin: 4px 0 6px; }
.fv .legend span { display: inline-flex; align-items: center; gap: 5px; }
.fv .legend .ln { width: 16px; height: 0; border-top: 2px solid; display: inline-block; }
.fv .legend .ln.d { border-top-style: dashed; }
.fv svg.ch { width: 100%; height: auto; display: block; overflow: visible; }
.fv svg.ch text { fill: var(--muted); font-size: 10px; font-family: inherit; }
.fv svg.ch .lbl { fill: var(--text); font-weight: 600; }
.fv svg.ch .gl { stroke: var(--grid); stroke-width: 1; }
.fv svg.ch .ax { stroke: var(--line); stroke-width: 1; }
.fv .tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 4px 16px rgba(0,0,0,.12); border-radius: 7px; padding: 6px 9px; font-size: 11px; white-space: nowrap; z-index: 20; }
.fv .facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; margin-bottom: 14px; }
.fv .fact { border-left: 2px solid var(--ci-blue); padding: 2px 0 2px 10px; }
.fv .fact b { display: block; font-size: 15px; font-weight: 650; }
.fv .fact span { color: var(--muted); font-size: 11.5px; }
.fv .chk { margin: 0; padding: 0 0 0 16px; }
.fv .chk li { margin: 3px 0; }
.fv .chk li span { color: var(--muted); }

/* Projektfenster in der Mitte */
.fv .pgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-bottom: 14px; max-width: 1200px; }
.fv .dbig { background: var(--soft); border-radius: 8px; padding: 8px 12px; margin: 0 0 10px; }
.fv .dbig .k { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.fv .dbig .v { font-size: 18px; font-weight: 650; }
.fv .kv { display: grid; grid-template-columns: minmax(120px, 42%) minmax(0, 1fr); gap: 0 10px; }
.fv .kv > div { padding: 5px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.fv .kv > div:nth-child(odd) { color: var(--muted); }
.fv .kv > div:nth-child(even) { text-align: right; }
.fv .kv input, .fv .kv select { width: 130px; text-align: right; padding: 3px 6px; border: 1px solid var(--ci-blue); border-radius: 4px; background: var(--panel); font: inherit; }
.fv .kv input.wide { width: 100%; text-align: left; }
.fv .kv select { width: auto; text-align: left; }
.fv .dsec { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; margin: 14px 0 4px; }
.fv .srcx { font-size: 11px; color: var(--muted); line-height: 1.45; }
.fv .log { font-size: 11.5px; }
.fv .log div { padding: 4px 0; border-bottom: 1px solid var(--line); }
.fv .log span { color: var(--muted); }
.fv .qbars { display: flex; align-items: flex-end; gap: 2px; height: 60px; margin-top: 4px; }
.fv .qbars i { flex: 1; background: var(--c-wohn); opacity: .55; border-radius: 2px 2px 0 0; min-height: 0; }
.fv .qbars i.now { opacity: 1; }
.fv .qbars i.bau { opacity: .9; box-shadow: inset 0 -3px 0 #004f5b; }
.fv .qlab { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--muted); margin-top: 2px; }
.fv .qgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 8px; }
.fv .qgrid label { display: block; font-size: 10.5px; color: var(--muted); }
.fv .qgrid input { width: 100%; padding: 3px 6px; border: 1px solid var(--line); border-radius: 4px; text-align: right; font: inherit; }
.fv .qgrid input.bau { background: light-dark(#eef7f9, var(--soft)); }
.fv .qyear { display: grid; grid-template-columns: 44px repeat(4, minmax(0, 1fr)); gap: 4px 8px; align-items: center; }
.fv .qyear b { font-size: 11px; color: var(--muted); font-weight: 600; }
.fv .pfoot { display: flex; gap: 8px; align-items: center; padding: 10px 0 20px; }
.fv .pol { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.fv .pol .tx { flex: 1; min-width: 0; }
.fv .pol .tx div { color: var(--muted); font-size: 11px; white-space: normal; }
.fv .fsteps { display: flex; gap: 3px; margin: 2px 0 12px; max-width: 520px; }
.fv .fsteps div { flex: 1; text-align: center; font-size: 10px; color: var(--muted); padding-top: 6px; border-top: 3px solid var(--line); }
.fv .fsteps div.done { border-top-color: var(--ci-blue); }
.fv .fsteps div.cur { border-top-color: var(--ci-blue); color: var(--text); font-weight: 650; }
.fv .locked { max-width: 420px; margin: 60px auto; text-align: center; color: var(--muted); }
.fv .locked b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* Versicherungen */
.fv .cov { display: inline-flex; align-items: center; justify-content: center; min-width: 70px; font-size: 11px; border-radius: 9px; line-height: 19px; padding: 0 7px; }
.fv .cov.ok { color: var(--green-dark); background: light-dark(#eef3e8, var(--soft)); }
.fv .cov.miss { color: var(--red); background: var(--red-soft); font-weight: 650; }
.fv .cov.extra, .fv .cov.chk, .fv .cov.open { color: var(--orange); background: var(--orange-soft); }
.fv .cov.glob { color: var(--blue-dark); background: var(--blue-soft); }
.fv .cov.gu { color: var(--muted); background: var(--soft); }
.fv .cov.na { color: var(--muted); }
.fv .phase { display: inline-flex; gap: 2px; vertical-align: middle; }
.fv .phase i { width: 12px; height: 5px; border-radius: 3px; background: var(--line); }
.fv .phase i.on { background: var(--ci-blue); }
.fv .ftodo { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); margin-bottom: 18px; }
.fv .ftodo .hd { padding: 9px 14px 7px; font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.fv .ftodo .it { display: flex; gap: 10px; align-items: center; padding: 7px 14px; border-bottom: 1px solid var(--line); }
.fv .ftodo .it.r { cursor: pointer; }
.fv .ftodo .it.r:hover { background: var(--soft); }
.fv .ftodo .it:last-child { border-bottom: 0; }
.fv .ftodo .it .tx { flex: 1; min-width: 0; }
.fv .ftodo .it .tx b { font-weight: 600; }
.fv .ftodo .it .tx div { color: var(--muted); font-size: 11.5px; }
.fv .lvl { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.fv .lvl.r { background: var(--red); } .fv .lvl.o { background: var(--orange); } .fv .lvl.b { background: var(--ci-blue); }
.fv .rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 18px; }
.fv .rule { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: var(--panel); }
.fv .rule .k { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.fv .rule .v { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px; }

/* Seitenleiste der Module */
.nav-item .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.nav-item .r { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nav-item .r.red { color: var(--red); font-weight: 600; }

/* Dialoge der Module */
.modal .diff { width: 100%; border-collapse: collapse; margin: 6px 0 4px; font-size: 13px; }
.modal .diff td, .modal .diff th { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.modal .diff th { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.modal .diff .l { text-align: left; }
.modal .diff .old { color: var(--muted); text-decoration: line-through; }
.modal .diff .new { font-weight: 650; }
.modal .qa { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.modal .qa .t { font-weight: 650; margin-bottom: 2px; }
.modal .qa .s { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.modal .qa .a { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.modal .qa .btn.sel { background: var(--text); color: #fff; border-color: var(--text); }
.modal .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal .ok-line { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.modal .ok-line:last-child { border-bottom: 0; }

/* Einstellungen: Rechte als Auswahl */
.perm-sel { border: 1px solid var(--line); border-radius: 6px; padding: 3px 4px; font-size: 12px; background: var(--panel); }
.perm-sel.none { color: var(--muted); }
.perm-sel.edit { border-color: var(--ci-blue); color: var(--blue-dark); font-weight: 600; }
.co-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.co-list span { background: var(--soft, #f6f8f8); border: 1px solid var(--line); border-radius: 12px; padding: 2px 10px; font-size: 12px; }

/* Druck / PDF der Bankenübersicht */
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body, html { height: auto; background: var(--panel); }
  .rail, .sidebar, .main-head .actions, .menu-btn, .fbar, .tblfoot .linkbtn, .toast, .noprint { display: none !important; }
  .layout { display: block; height: auto; }
  .main, .main-body { overflow: visible !important; height: auto; padding: 0 !important; }
  .main-head { padding: 0 0 6px !important; }
  .fv .tw { overflow: visible; border: 0; }
  .fv table.rt { min-width: 0; width: 100% !important; }
  .fv th .cr { display: none; }
  .fv td, .fv th { font-size: 8.5px; padding: 3px 4px; }
  .fv .printhead { display: block; font-size: 10px; color: #555; margin-bottom: 6px; }
  .fv .fc { break-inside: avoid; border: 0; padding: 0; }
  .fv td.q.bau, .fv td.q.fin, .fv tr.g td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.modal:has(.row2), .modal:has(.qa) { max-width: 540px; }
.modal .qa .a .small-select { margin-left: 6px; }

/* ---------- v3: Versicherungen luftiger, Privat ---------- */
.fv .tw.roomy td { padding-top: 12px; padding-bottom: 12px; }
.fv .tw.roomy th { padding-top: 11px; padding-bottom: 9px; }
.fv .tw.roomy tr.g td { padding-top: 14px; padding-bottom: 8px; }
.fv .pv-list { display: flex; flex-direction: column; gap: 18px; }
.fv .pv-card { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden; }
.fv .pv-card .tw { border: 0; border-radius: 0; margin: 0; }
.fv .pv-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.fv .pv-h b { font-size: 13.5px; }
.fv .pv-h .grow { flex: 1; }
.fv .pv-sum { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fv table.pv-t { width: 100%; min-width: 980px; table-layout: fixed; }
.fv table.pv-t th { text-align: left; padding: 9px 12px 7px; overflow: hidden; text-overflow: ellipsis; }
.fv table.pv-t td { text-align: left; padding: 10px 12px; white-space: normal; vertical-align: top; overflow-wrap: anywhere; }
.fv table.pv-t td.r, .fv table.pv-t th.r { text-align: right; white-space: nowrap; }
.fv table.pv-t td.mono { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.fv table.pv-t td .muted, .fv table.pv-t td.muted { color: var(--muted); font-size: 11.5px; }
.fv table.pv-t tr.off td { color: var(--faint); }
.fv table.pv-t tr.off td b { font-weight: 500; color: var(--faint); }
.fv .pv-p { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.fv .pv-p span { font-size: 10px; border-radius: 8px; padding: 0 6px; line-height: 16px; background: var(--blue-soft); color: var(--blue-dark); }
.fv .locked { border: 1px dashed var(--line2); border-radius: 12px; padding: 28px; text-align: center; color: var(--muted); max-width: 560px; margin: 30px auto; }
.fv .locked b { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }
