/* L&A Immobilien – Digitale Mietverwaltung (Designsystem, Phase 3)
   Alle Gestaltungswerte zentral als Tokens. Bootstrap (lokal) liefert nur Reset, Raster und Formularbasis; Komponenten sind eigene Klassen.
   Kein Inline-Style im Markup (CSP: style-src 'self'), keine externen Schriften/Icons. */

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  --c-primary: #082578;  --c-navy: #061A50;  --c-accent: #EDF1FA;  --c-bg: #F4F6FB;  --c-surface: #FFFFFF;
  --c-text: #182235;     --c-muted: #596478; --c-border: #DCE2EB;
  --c-ok: #17643C;   --c-ok-bg: #E7F4EC;   --c-ok-line: #B7DEC6;
  --c-warn: #855500; --c-warn-bg: #FFF3D6; --c-warn-line: #F0D18A;
  --c-err: #B42318;  --c-err-bg: #FDEBE9;  --c-err-line: #F2B8B2;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --radius-card: 14px; --radius-input: 8px; --radius-btn: 10px;
  --shadow-card: 0 1px 2px rgba(24, 34, 53, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --sidebar-w: 240px; --bar-h: 60px;
  /* Bootstrap-Variablen auf die Marke abbilden */
  --bs-primary: #082578; --bs-primary-rgb: 8, 37, 120; --bs-body-color: #182235; --bs-body-color-rgb: 24, 34, 53;
  --bs-body-bg: #F5F6F8; --bs-body-font-family: var(--font); --bs-body-font-size: 1rem; --bs-body-line-height: 1.5;
  --bs-link-color: #082578; --bs-link-color-rgb: 8, 37, 120; --bs-link-hover-color: #061A50; --bs-link-hover-color-rgb: 6, 26, 80;
  --bs-border-color: #DCE2EB; --bs-secondary-color: #596478; --bs-border-radius: 8px;
  --bs-success: #17643C; --bs-warning: #855500; --bs-danger: #B42318;
}

/* ── Basis ──────────────────────────────────────────────────────────────── */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { font: 16px/1.5 var(--font); color: var(--c-text); background: var(--c-bg); overflow-wrap: anywhere; }
h1, h2, h3, h4 { color: var(--c-text); font-weight: 700; line-height: 1.25; letter-spacing: -.005em; }
h1 { font-size: 1.5rem; margin: 0; }            /* 24 px mobil */
h2 { font-size: 1.125rem; margin: 0; }          /* 18 px */
h3 { font-size: 1.0625rem; margin: 0; }         /* 17 px */
a { color: var(--c-primary); text-underline-offset: 2px; }
a:hover { color: var(--c-navy); }
.muted { color: var(--c-muted); }
.small-text { font-size: .8125rem; color: var(--c-muted); }  /* 13 px */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-lg { width: 24px; height: 24px; }
:focus-visible { outline: 3px solid var(--c-primary); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 2000; background: var(--c-primary); color: #fff; padding: 10px 16px; border-radius: 8px; text-decoration: none; }
.skip-link:focus { top: 8px; outline-color: #fff; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn { --bs-btn-padding-y: .6rem; --bs-btn-padding-x: 1.1rem; --bs-btn-font-size: 1rem; --bs-btn-font-weight: 600; --bs-btn-border-radius: var(--radius-btn);
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; line-height: 1.25; text-decoration: none; }
.btn:focus-visible { outline: 3px solid var(--c-primary); outline-offset: 2px; box-shadow: none; }
.btn-primary { --bs-btn-bg: #082578; --bs-btn-border-color: #082578; --bs-btn-color: #fff; --bs-btn-hover-bg: #061A50; --bs-btn-hover-border-color: #061A50; --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: #061A50; --bs-btn-active-border-color: #061A50; --bs-btn-active-color: #fff; --bs-btn-disabled-bg: #8D98BD; --bs-btn-disabled-border-color: #8D98BD; --bs-btn-disabled-color: #fff; }
.btn-outline-primary { --bs-btn-color: #082578; --bs-btn-border-color: #082578; --bs-btn-bg: #fff; --bs-btn-hover-bg: #EDF1FA; --bs-btn-hover-color: #061A50; --bs-btn-hover-border-color: #061A50;
  --bs-btn-active-bg: #DCE5F7; --bs-btn-active-color: #061A50; --bs-btn-active-border-color: #061A50; --bs-btn-disabled-color: #6C7799; --bs-btn-disabled-border-color: #C4CBE0; }
.btn-danger { --bs-btn-bg: #B42318; --bs-btn-border-color: #B42318; --bs-btn-color: #fff; --bs-btn-hover-bg: #8F1B12; --bs-btn-hover-border-color: #8F1B12; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #8F1B12; --bs-btn-active-border-color: #8F1B12; }
.btn-outline-danger { --bs-btn-color: #B42318; --bs-btn-border-color: #B42318; --bs-btn-bg: #fff; --bs-btn-hover-bg: #FDEBE9; --bs-btn-hover-color: #8F1B12; --bs-btn-hover-border-color: #8F1B12; --bs-btn-active-bg: #FBD9D5; --bs-btn-active-color: #8F1B12; }
.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--c-primary); }
.btn-ghost:hover { background: var(--c-accent); color: var(--c-navy); }
.btn-sm { --bs-btn-padding-y: .35rem; --bs-btn-padding-x: .8rem; --bs-btn-font-size: .9375rem; min-height: 44px; }
.btn-block { width: 100%; }
.btn.is-loading { position: relative; pointer-events: none; opacity: .85; }
.btn.is-loading::after { content: ""; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }

/* ── Formulare ──────────────────────────────────────────────────────────── */
.form-label { font-size: .875rem; font-weight: 600; margin-bottom: 4px; color: var(--c-text); width: 100%; }
.form-control, .form-select { min-height: 44px; font-size: 1rem; border-radius: var(--radius-input); border: 1px solid #B9C2D3; padding: 10px 12px; color: var(--c-text); background-color: #fff; }
textarea.form-control { min-height: 96px; }
.form-control::placeholder { color: #6B7588; }
.form-control:focus, .form-select:focus { border-color: var(--c-primary); box-shadow: none; outline: 3px solid rgba(8, 37, 120, .35); outline-offset: 0; }
.form-text, .hint { font-size: .8125rem; color: var(--c-muted); margin-top: 4px; }
.form-check-input { width: 1.4em; height: 1.4em; margin-top: .1em; border-color: #8793AB; }
.form-check-input:checked { background-color: var(--c-primary); border-color: var(--c-primary); }
.form-check { min-height: 44px; display: flex; align-items: center; gap: 10px; padding-left: 0; }
.form-check .form-check-input { float: none; margin: 0; flex: none; }
.form-check-label { font-weight: 500; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.form-grid { display: grid; gap: var(--sp-4); grid-template-columns: 1fr; }
.form-grid .span-2 { grid-column: auto; }
@media (min-width: 576px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid .span-2 { grid-column: 1 / -1; } }
@media (min-width: 992px) { .form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-5); }

/* ── Meldungen ──────────────────────────────────────────────────────────── */
.alert { border-radius: 12px; padding: 14px 16px; margin: 0 0 var(--sp-4); border-width: 1px; font-size: 1rem; display: flex; gap: 12px; align-items: flex-start; }
.alert .icon { margin-top: 2px; }
.alert > div { min-width: 0; flex: 1; }
.alert ul { margin: 4px 0 0; padding-left: 20px; }
.alert-success { background: var(--c-ok-bg); border-color: var(--c-ok-line); color: #0F4A2B; }
.alert-warning { background: var(--c-warn-bg); border-color: var(--c-warn-line); color: #6B4400; }
.alert-danger { background: var(--c-err-bg); border-color: var(--c-err-line); color: #8F1B12; }
.alert-info, .alert-secondary { background: var(--c-accent); border-color: #C9D5EE; color: var(--c-navy); }
.badge-s { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .8125rem; font-weight: 600; line-height: 20px; white-space: nowrap; }
.badge-s::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-ok { color: var(--c-ok); background: var(--c-ok-bg); } .badge-warn { color: var(--c-warn); background: var(--c-warn-bg); }
.badge-err { color: var(--c-err); background: var(--c-err-bg); } .badge-neutral { color: #3E4960; background: #E9EDF3; }

/* ── App-Shell: Sidebar (≥992), Topbar (<992), Bottom-Navigation (<768) ──── */
.app { min-height: 100vh; }
.sidebar { display: none; }
.topbar { position: sticky; top: 0; z-index: 1030; background: var(--c-surface); border-bottom: 1px solid var(--c-border); padding-top: env(safe-area-inset-top); }
.topbar-in { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--bar-h); padding: 0 var(--sp-4); max-width: 1280px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; min-height: 44px; }
.brand img { display: block; height: auto; width: 150px; }           /* mobil kompakt 140–160 px */
.topnav { display: none; gap: var(--sp-1); margin-left: var(--sp-4); }
.topnav a, .sidenav a, .side-foot a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; border-radius: 10px; color: var(--c-text); text-decoration: none; font-weight: 500; }
.topnav a:hover, .sidenav a:hover, .side-foot a:hover { background: var(--c-bg); }
.topnav a[aria-current="page"], .sidenav a[aria-current="page"], .side-foot a[aria-current="page"] { background: var(--c-accent); color: var(--c-primary); font-weight: 700; }
.iconbtn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #3E4960; text-decoration: none; background: transparent; border: 0; }
.iconbtn:hover, .iconbtn[aria-current="page"] { background: var(--c-accent); color: var(--c-primary); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }
.top-actions .btn-cta { display: none; }
.content { padding: var(--sp-4) var(--sp-4) calc(104px + env(safe-area-inset-bottom)); max-width: 1280px; margin: 0 auto; }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; background: var(--c-surface); border-top: 1px solid var(--c-border);
  display: grid; grid-template-columns: repeat(4, 1fr); align-items: center; gap: var(--sp-1); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
.bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; border-radius: 12px; text-decoration: none; color: #3E4960; font-size: .75rem; font-weight: 600; text-align: center; line-height: 1.15; }
.bottomnav a[aria-current="page"] { color: #082578; font-weight: 700; }
.bottomnav a:not([aria-current]) { color: #6b7280; }
.bottomnav a.cta { background: var(--c-primary); color: #fff; }
.bottomnav a.cta:focus-visible { outline-color: var(--c-primary); }
.bottomnav .icon { width: 24px; height: 24px; }
@media (min-width: 768px) {
  .bottomnav { display: none; }
  .topnav { display: flex; }
  .top-actions .btn-cta { display: inline-flex; }
  .content { padding: var(--sp-5) var(--sp-5) var(--sp-6); }
  .brand img { width: 160px; }
  h1 { font-size: 1.625rem; }
}
@media (min-width: 992px) {
  .app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .topbar { display: none; }
  .sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; background: var(--c-surface); border-right: 1px solid var(--c-border); padding: var(--sp-5) var(--sp-4); overflow-y: auto; }
  .sidebar .brand img { width: 200px; }                            /* Desktop 190–220 px */
  .sidebar .btn-cta { width: 100%; margin: var(--sp-5) 0 var(--sp-4); }
  .sidenav { display: grid; gap: var(--sp-1); }
  .side-foot { margin-top: auto; display: grid; gap: var(--sp-1); padding-top: var(--sp-4); border-top: 1px solid var(--c-border); }
  .side-foot form { margin: 0; }
  .side-foot button { width: 100%; background: transparent; border: 0; font: inherit; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; border-radius: 10px; color: var(--c-text); font-weight: 500; }
  .side-foot button:hover { background: var(--c-bg); }
  .content { padding: var(--sp-6) var(--sp-6) 48px; }
  h1 { font-size: 1.75rem; }
}
.sidebar .tagline { font-size: .8125rem; color: var(--c-muted); margin: var(--sp-2) 0 0; }

/* ── Seitenkopf, Breadcrumb, Abschnitte ──────────────────────────────────── */
.crumbs li { display: flex; align-items: center; min-height: 32px; line-height: 1.4; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0 0 var(--sp-3); padding: 0; font-size: .875rem; color: var(--c-muted); }
.crumbs li + li::before { content: "›"; margin-right: 8px; color: #8D97AA; line-height: 1; display: inline-flex; align-items: center; }
.crumbs a { color: var(--c-muted); text-decoration: none; display: inline-flex; align-items: center; min-height: 32px; }
.crumbs a:hover { color: var(--c-primary); text-decoration: underline; }
.crumbs [aria-current] { color: var(--c-text); font-weight: 600; display: inline-flex; align-items: center; min-height: 32px; line-height: 1.4; }
.page-head { display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-4); align-items: flex-start; justify-content: space-between; margin-bottom: var(--sp-5); }
.page-head .titles { min-width: 0; flex: 1 1 280px; }
.page-head .lead { margin: 6px 0 0; color: var(--c-muted); font-size: .9375rem; }
.page-head .meta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 8px; }
.section { margin-top: var(--sp-6); }
.section-head { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); align-items: center; justify-content: space-between; margin-bottom: var(--sp-3); }
.two-col { display: grid; gap: var(--sp-5); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 992px) { .two-col { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } .two-col.even { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── Karten, Kennzahlen, Listen ──────────────────────────────────────────── */
.card-x { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: var(--sp-4); min-width: 0; }
@media (min-width: 768px) { .card-x { padding: 20px; } }
.card-x h2, .card-x h3 { margin-bottom: var(--sp-3); }
a.card-x { display: block; text-decoration: none; color: inherit; }
a.card-x:hover { border-color: #AEB9D2; background: #FBFCFE; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-5); }
@media (min-width: 992px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); } }
.stat { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-card); padding: var(--sp-4); }
.stat .label { font-size: .8125rem; color: var(--c-muted); font-weight: 600; margin: 0; }
.stat .value { font-size: 1.75rem; font-weight: 700; line-height: 1.15; margin: 4px 0 0; color: var(--c-text); font-variant-numeric: tabular-nums; }
.stat .sub { font-size: .8125rem; color: var(--c-muted); margin: 2px 0 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-4); margin: 0; }
.facts dt { font-size: .8125rem; color: var(--c-muted); font-weight: 600; }
.facts dd { margin: 2px 0 0; font-weight: 500; }
.kv { display: grid; grid-template-columns: minmax(min-content, 1.2fr) minmax(min-content, 1fr); gap: 8px 0; margin: 0; }
.kv dt { font-weight: 500; color: var(--c-text); padding-right: 16px; } .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: break-word; }
.kv .total { font-weight: 700; border-top: 1px solid var(--c-border); padding-top: 10px; margin-top: 2px; }
.bar { display: block; height: 8px; border-radius: 999px; background: #E3E8F1; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--c-primary); border-radius: 999px; }
.cardlist { display: grid; gap: var(--sp-3); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 768px) { .cardlist { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .cardlist { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
a.card-x.propcard { display: flex; flex-direction: column; gap: var(--sp-3); }
.propcard .top { display: flex; gap: var(--sp-3); align-items: flex-start; }
.propcard .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--c-accent); color: var(--c-primary); display: flex; align-items: center; justify-content: center; flex: none; }
.propcard .name { font-weight: 700; font-size: 1.0625rem; line-height: 1.3; }
.propcard .addr { color: var(--c-muted); font-size: .9375rem; }
.propcard .go { margin-left: auto; color: #8D97AA; align-self: center; }
.propcard .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .875rem; color: var(--c-muted); }
.propcard .meta b { color: var(--c-text); }

/* Zeilenlisten (eine Zeile = ein Link; mobil als Karte, Desktop als Tabellenzeile) */
.trows { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.thead { display: none; }
.trow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 12px 16px; min-height: 60px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; text-decoration: none; color: inherit; }
a.trow:hover { border-color: #AEB9D2; background: #FBFCFE; }
.trow .c-main { flex: 1 1 55%; font-weight: 600; min-width: 0; }
.trow .c-main small { display: block; font-weight: 400; color: var(--c-muted); font-size: .875rem; }
.trow .c-sub { flex: 1 1 100%; color: var(--c-muted); font-size: .9375rem; min-width: 0; }
.trow .c-st { margin-left: auto; }
.trow .c-go { color: #8D97AA; display: none; }
.trow .c-num { font-variant-numeric: tabular-nums; color: var(--c-text); }
@media (min-width: 768px) {
  .thead { display: grid; padding: 0 16px 6px; font-size: .8125rem; font-weight: 600; color: var(--c-muted); gap: 12px; grid-template-columns: var(--cols); }
  .trow { display: grid; grid-template-columns: var(--cols); gap: 12px; padding: 10px 16px; }
  .trow .c-sub { flex: none; } .trow .c-st { margin-left: 0; } .trow .c-go { display: block; }
  .cols-tenants { --cols: minmax(0, 2.2fr) minmax(0, 2.4fr) 150px 20px; }
  .cols-units { --cols: minmax(0, 1.5fr) 72px minmax(0, 2fr) 120px 130px 20px; }
  .cols-docs { --cols: minmax(0, 2.4fr) 110px 150px 160px; }
}
.empty { text-align: center; padding: var(--sp-6) var(--sp-4); background: var(--c-surface); border: 1px dashed #B9C2D3; border-radius: var(--radius-card); }
.empty .ico { width: 52px; height: 52px; border-radius: 50%; background: var(--c-accent); color: var(--c-primary); display: inline-flex; align-items: center; justify-content: center; margin-bottom: var(--sp-3); }
.empty h2 { margin-bottom: 6px; } .empty p { color: var(--c-muted); max-width: 46ch; margin: 0 auto var(--sp-4); }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: #E9EDF3; border-radius: 12px; }
.segmented a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 9px; color: #3E4960; text-decoration: none; font-weight: 600; }
.segmented a[aria-current="true"] { background: var(--c-surface); color: var(--c-primary); box-shadow: var(--shadow-card); }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; margin-bottom: var(--sp-4); }
.searchbox { display: flex; gap: var(--sp-2); flex: 1 1 320px; max-width: none; width: 100%; }
.searchbox .form-control { flex: 1 1 auto; min-width: 0; }
.disclosure { border-top: 1px solid var(--c-border); margin-top: var(--sp-4); padding-top: 4px; }
.disclosure summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--c-primary); list-style: none; }
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::before { content: "›"; display: inline-block; transition: transform .15s; font-size: 1.2em; }
.disclosure[open] summary::before { transform: rotate(90deg); }
.disclosure .tech { font-size: .875rem; color: var(--c-muted); display: grid; gap: 4px; padding: 4px 0 8px; }
.danger-zone { border: 1px solid var(--c-err-line); background: #FFF9F8; border-radius: 12px; padding: var(--sp-4); margin-top: var(--sp-6); }
.danger-zone h2 { color: var(--c-err); font-size: 1rem; margin-bottom: 8px; }
.danger-zone details summary { color: var(--c-err); cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.person-card { background: var(--c-bg); border: 1px solid var(--c-border); border-radius: 12px; padding: var(--sp-3); margin-bottom: var(--sp-3); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.tbl th { text-align: left; font-size: .8125rem; color: var(--c-muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--c-border); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid #EEF1F6; vertical-align: top; }

/* ── Assistent ──────────────────────────────────────────────────────────── */
.steps { list-style: none; display: flex; gap: var(--sp-2); margin: 0 0 var(--sp-5); padding: 0; }
.steps li { flex: 1 1 0; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: #E9EDF3; color: #3E4960; font-weight: 600; font-size: .875rem; min-width: 0; }
.steps .n { width: 24px; height: 24px; border-radius: 50%; background: #fff; color: var(--c-primary); display: inline-flex; align-items: center; justify-content: center; font-size: .8125rem; flex: none; }
.steps li[aria-current="step"] { background: var(--c-primary); color: #fff; }
.steps li.done { background: var(--c-ok-bg); color: var(--c-ok); }
.steps .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 420px) { .steps .t { display: none; } .steps li[aria-current="step"] .t { display: block; } .steps li { flex: 0 0 auto; } .steps li[aria-current="step"] { flex: 1 1 auto; } }
.js .wiz-step:not(.is-active) { display: none; }
.wiz-step:focus { outline: none; }
.wiz-nav { display: flex; flex-wrap: wrap; gap: var(--sp-3); justify-content: space-between; margin-top: var(--sp-5); }
.wiz-nav .btn { flex: 1 1 160px; }
@media (min-width: 576px) { .wiz-nav .btn { flex: 0 0 auto; min-width: 180px; } .wiz-nav .spacer { flex: 1 1 auto; } }
.js-only { display: none; } .js .js-only { display: initial; }
.no-js-only { display: initial; } .js .no-js-only { display: none; }
.scan-box { border: 2px dashed #9FB0D8; background: #F7F9FE; border-radius: var(--radius-card); padding: var(--sp-5) var(--sp-4); text-align: center; }
.scan-box .btn { min-height: 52px; }
.step-error { display: none; } .step-error.on { display: flex; }
.total-box { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; background: var(--c-accent); border-radius: 12px; padding: 14px 16px; font-weight: 700; }
.total-box .v { font-size: 1.375rem; color: var(--c-primary); font-variant-numeric: tabular-nums; }
.summary { display: grid; gap: var(--sp-3); }
.summary .row-s { display: grid; gap: 2px; padding: 12px 0; border-bottom: 1px solid var(--c-border); }
.summary .row-s:last-child { border: 0; }
.summary .k { font-size: .8125rem; color: var(--c-muted); font-weight: 600; }

/* ── Anmeldung (layout_plain) ───────────────────────────────────────────── */
.plain { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--sp-4); background: var(--c-bg); }
.plain-card { width: 100%; max-width: 420px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 16px; padding: var(--sp-5) var(--sp-4); box-shadow: var(--shadow-card); }
@media (min-width: 480px) { .plain-card { padding: 32px; } }
.plain-card .logo { display: block; margin: 0 auto var(--sp-4); width: 100%; max-width: 300px; height: auto; }
.plain-card .sub { text-align: center; color: var(--c-muted); font-size: .9375rem; margin: 0 0 var(--sp-5); }
.plain-card h1 { font-size: 1.375rem; text-align: center; margin-bottom: var(--sp-4); }
.plain-card .links { text-align: center; margin-top: var(--sp-4); }

/* ── Seitenspezifisch ───────────────────────────────────────────────────── */
.tile { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4); min-height: 76px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-card); text-decoration: none; color: inherit; }
.tile:hover { border-color: #AEB9D2; background: #FBFCFE; color: inherit; }
.tile .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--c-accent); color: var(--c-primary); display: flex; align-items: center; justify-content: center; flex: none; }
.tile .t { font-weight: 700; } .tile .s { color: var(--c-muted); font-size: .9375rem; } .tile .chev { margin-left: auto; color: #8D97AA; }
.tiles { display: grid; gap: var(--sp-3); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.import-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 var(--sp-5); }
.import-steps li { padding: 6px 14px; border-radius: 999px; background: #E9EDF3; color: #3E4960; font-weight: 600; font-size: .875rem; }
.import-steps li[aria-current="step"] { background: var(--c-primary); color: #fff; } .import-steps li.done { background: var(--c-ok-bg); color: var(--c-ok); }
.docitem { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--c-border); }
.docitem:last-child { border: 0; }
.docitem .t { font-weight: 600; } .docitem .s { color: var(--c-muted); font-size: .875rem; }
.meterbox { border: 1px solid var(--c-border); border-radius: 12px; padding: var(--sp-3) var(--sp-4); background: #fff; }
.reading-ref { font-size: .8125rem; color: var(--c-muted); }
.save-hint { font-size: .875rem; color: var(--c-muted); }

@media print { .topbar, .bottomnav, .sidebar { display: none !important; } body { background: #fff; } .app { display: block; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }

/* Breitenklassen für Belegungsbalken (5-%-Schritte, kein Inline-Style) */
.fill-0{width:0}.fill-5{width:5%}.fill-10{width:10%}.fill-15{width:15%}.fill-20{width:20%}.fill-25{width:25%}.fill-30{width:30%}.fill-35{width:35%}.fill-40{width:40%}.fill-45{width:45%}.fill-50{width:50%}
.fill-55{width:55%}.fill-60{width:60%}.fill-65{width:65%}.fill-70{width:70%}.fill-75{width:75%}.fill-80{width:80%}.fill-85{width:85%}.fill-90{width:90%}.fill-95{width:95%}.fill-100{width:100%}

/* Hilfsklassen (ersetzen Inline-Styles) */
.plainlist { list-style: none; padding: 0; margin: 0; }
.actions.center { justify-content: center; }
.mt-section { margin-top: var(--sp-5); }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
label.btn:focus-within { outline: 3px solid var(--c-primary); outline-offset: 2px; }
.warn-text { color: var(--c-warn); font-size: .875rem; }
.field { display: block; margin: 0; min-width: 0; }
.field .form-label { display: block; }

@media (max-width: 575.98px) { .page-head .actions .btn { flex: 1 1 auto; } .btn { --bs-btn-padding-x: .9rem; } }

.docitem + .disclosure { border-top: 0; margin-top: 0; }
/* Spaltenvorgaben für Zeilenlisten ab 768 px */
@media (min-width: 768px) {
  .cols-simple { --cols: minmax(0, 1fr) auto; }
  .cols-parties { --cols: minmax(0, 1.4fr) minmax(0, 1.6fr) 20px; }
  .cols-batch { --cols: minmax(0, 1fr) auto 20px; }
}
/* Breadcrumb mobil: nur Rück-Link zur übergeordneten Seite */
@media (max-width: 767.98px) {
  .crumbs li { display: none; } .crumbs li + li::before { content: none; }
  .crumbs li.crumb-parent { display: list-item; } .crumbs li.crumb-parent a::before { content: "‹"; margin-right: 8px; font-size: 1.3em; line-height: 1; }
  .crumbs li.crumb-parent a { min-height: 44px; font-size: 1rem; }
  .crumbs ol { margin-bottom: var(--sp-1); }
}
.scan-box .btn { white-space: normal; max-width: 100%; }
@media (max-width: 575.98px) {
  .wiz-nav { flex-direction: column-reverse; } .wiz-nav .spacer { display: none; } .wiz-nav .btn { flex: 1 1 auto; width: 100%; }
}

@media (max-width: 991.98px) { .crumbs a { min-height: 44px; } }
@media (max-width: 991.98px) { .crumbs a { min-width: 44px; padding: 0 8px; justify-content: center; } .crumbs li.crumb-parent a { justify-content: flex-start; padding-left: 0; } }

/* Logo: Original-JPEG (Datei unverändert) hat einen Hintergrund von rgb(253,253,253). Weißpunkt-Kompensation (255/253 ≈ 1,008), damit auf weißen Flächen kein heller Kasten sichtbar wird. */
.brand img, .plain-card .logo { filter: brightness(1.008); }

@media (max-width: 380px) { .btn { white-space: normal; text-align: center; } }

.toolbar > .form-select { flex: 0 1 280px; }
@media (max-width: 575.98px) { .toolbar > .form-select { flex: 1 1 100%; } }

/* KI & Verbrauch: Diagramm (nur Klassen, keine Inline-Styles – CSP) */
.ai-chart { width: 100%; height: auto; display: block; }
.ai-bar { fill: var(--c-primary); } .ai-axis { stroke: var(--c-border); stroke-width: 1; }
.ai-val { font-size: 10px; fill: var(--c-text); font-variant-numeric: tabular-nums; } .ai-lbl { font-size: 11px; fill: var(--c-muted); }

/* Ausweisdokumente: Umbruch auf schmalen Viewports */
code { overflow-wrap: anywhere; }
.docitem .actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; max-width: 100%; min-width: 0; }
.docitem .actions .disclosure { flex-basis: 100%; } .docitem .actions .btn { white-space: normal; }
.idoc-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); } .idoc-actions form { max-width: 100%; } .idoc-actions .btn { max-width: 100%; white-space: normal; text-align: left; }
.idoc-opts { border: 0; padding: 0; margin: 0; } .idoc-opts legend { float: none; font-size: 1rem; }

/* Vorlageneditor / Versionshistorie */
.tpl-html { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .875rem; min-height: 16rem; }
.tpl-readonly { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 16rem; overflow: auto; }
.inline-form { display: inline-flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }

/* Formular mit Eingabefeld + Aktionsbutton: Button bündig zum Eingabefeld (Hilfetext liegt unterhalb der Zeile und beeinflusst die Ausrichtung nicht) */
.inline-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px var(--sp-3); align-items: end; }
.inline-field .field { min-width: 0; } .inline-field .form-text { grid-column: 1 / -1; margin: 0; }
@media (max-width: 575.98px) { .inline-field { grid-template-columns: 1fr; } .inline-field .btn { width: 100%; } }
.inline-field .span-all { grid-column: 1 / -1; }

/* ── Vorlagen-Editor (UI-003, QS-UI-012…017) ── */
.tpl-editor{border:1px solid var(--bs-border-color,#ccd);border-radius:.5rem;background:#fff}
.tpl-toolbar{display:flex;flex-wrap:wrap;gap:.25rem .5rem;align-items:center;padding:.25rem .5rem;border-bottom:1px solid var(--bs-border-color,#ccd);position:sticky;top:0;background:#f7f8fb;z-index:20;border-radius:.5rem .5rem 0 0}
@media (max-width:991.98px){.tpl-toolbar{top:var(--bar-h,56px)}}
.tpl-grp{display:inline-flex;align-items:center;gap:.125rem;padding-right:.5rem;border-right:1px solid #d6dae4}.tpl-grp:last-child{border-right:0}
.tpl-btn{display:inline-flex;align-items:center;justify-content:center;gap:.25rem;min-width:32px;height:32px;padding:0 .375rem;border:0;border-radius:.375rem;background:transparent;color:#2b3550;line-height:1;font-size:.85rem}
.tpl-btn:hover{background:#e6eaf3}.tpl-btn:focus-visible{outline:2px solid var(--bs-primary,#082578);outline-offset:1px}.tpl-btn.active{background:#d5deef;color:#082578}.tpl-btn:disabled{opacity:.4}
.tpl-btn-text{padding:0 .5rem}.tpl-primary{background:#082578;color:#fff}.tpl-primary:hover{background:#0a2f94}
@media (max-width:991.98px){.tpl-btn{min-width:44px;height:44px}.tpl-style{height:44px!important}}
.tpl-style{height:32px;border:1px solid #cfd5e3;border-radius:.375rem;background:#fff;font-size:.85rem;padding:0 .25rem}
.tpl-menu{position:relative;display:inline-block}.tpl-menu[hidden]{display:none}
.tpl-pop{position:absolute;z-index:40;top:100%;left:0;margin-top:.25rem;min-width:15rem;max-width:min(24rem,92vw);max-height:60vh;overflow:auto;background:#fff;border:1px solid #bbc2d4;border-radius:.5rem;box-shadow:0 .5rem 1.5rem rgba(0,0,0,.18);padding:.25rem}
.tpl-pop[hidden]{display:none}.tpl-cat{font-weight:600;font-size:.72rem;text-transform:uppercase;color:#59627a;padding:.5rem .5rem .125rem}
.tpl-item,.tpl-ph-item{display:flex;justify-content:space-between;gap:.5rem;width:100%;text-align:left;border:0;background:none;padding:.375rem .5rem;border-radius:.25rem;min-height:34px;font-size:.88rem}
.tpl-item:hover,.tpl-ph-item:hover,.tpl-item:focus-visible,.tpl-ph-item:focus-visible{background:#eef3fb}.tpl-item:disabled{opacity:.4}.tpl-ph-item code{white-space:nowrap;color:#6a5600}
@media (max-width:991.98px){.tpl-item,.tpl-ph-item{min-height:44px}}
.tpl-search{width:100%;min-height:36px;border:1px solid #cfd5e3;border-radius:.375rem;padding:0 .5rem;margin:.125rem 0 .25rem}.tpl-ph-list{max-height:48vh;overflow:auto}.tpl-empty{padding:.5rem;color:#59627a}
.tpl-surface{padding:1rem 1.25rem;min-height:22rem;border-radius:0 0 .5rem .5rem;background:#fff}
.tpl-content{outline:none;min-height:20rem}.tpl-content:focus-visible{outline:2px solid var(--bs-primary,#082578);outline-offset:6px}
.tpl-content .mp-ph{background:#fff3c4;border:1px dashed #b58900;border-radius:.25rem;padding:0 .25rem;font-family:monospace;font-size:.9em;white-space:nowrap}
.tpl-content .page-break{border-top:2px dashed #888;margin:1rem 0;text-align:center;color:#666;font-size:.75rem}.tpl-content .page-break::after{content:"Seitenumbruch"}
.tpl-content .ta-center{text-align:center}.tpl-content .ta-right{text-align:right}.tpl-content .ta-justify{text-align:justify}
/* Tabellen im Editor: neutral (ohne Rahmen/Hintergrund), Hilfslinien nur im Editor */
.tpl-content table{border-collapse:collapse;margin:.5rem 0;table-layout:auto}.tpl-content table.tw-auto{width:auto}.tpl-content table.tw-100{width:100%}.tpl-content table.tw-75{width:75%}.tpl-content table.tw-50{width:50%}.tpl-content table.tw-25{width:25%}
.tpl-content td,.tpl-content th{vertical-align:top;min-width:2rem;font-weight:normal;text-align:left;outline:1px dotted #c3c9d8;outline-offset:-1px}.tpl-content th{font-weight:bold}
.tpl-content table.tb-all td,.tpl-content table.tb-all th{border:1px solid #666}.tpl-content table.tp-0 td,.tpl-content table.tp-0 th{padding:0}.tpl-content table.tp-1 td,.tpl-content table.tp-1 th{padding:.2rem}.tpl-content table.tp-2 td,.tpl-content table.tp-2 th{padding:.45rem}.tpl-content table.tp-3 td,.tpl-content table.tp-3 th{padding:.75rem}
.tpl-content .ha-center{text-align:center}.tpl-content .ha-right{text-align:right}.tpl-content .va-middle{vertical-align:middle}.tpl-content .va-bottom{vertical-align:bottom}.tpl-content .bg-light{background:#eceff4}.tpl-content .bg-blue{background:#dfeaf8}
.tpl-content .cw-10{width:10%}.tpl-content .cw-20{width:20%}.tpl-content .cw-25{width:25%}.tpl-content .cw-30{width:30%}.tpl-content .cw-40{width:40%}.tpl-content .cw-50{width:50%}.tpl-content .cw-60{width:60%}.tpl-content .cw-75{width:75%}
.tpl-content .selectedCell{background:#cfe3ff}.tpl-content .selectedCell:after{content:"";position:absolute;inset:0;background:rgba(120,150,255,.25);pointer-events:none}.tpl-content td,.tpl-content th{position:relative}
/* Vollbild: eigener Scrollbereich, Fenster gesperrt */
.tpl-editor.tpl-full{position:fixed;inset:0;z-index:2000;border-radius:0;display:flex;flex-direction:column;background:#fff}.tpl-editor.tpl-full .tpl-toolbar{top:0;position:static;border-radius:0}.tpl-editor.tpl-full .tpl-surface{flex:1;overflow:auto;border-radius:0}.tpl-noscroll{overflow:hidden}
/* ── Öffentliche Unterschriftsseite (SIGN-003) ── */
.sign-body{background:#f3f5fa;min-height:100vh}.sign-card{max-width:36rem;margin:0 auto;padding:1rem;background:#fff;min-height:100vh}.sign-card .logo{max-width:11rem;height:auto;margin:.5rem 0 1rem}
.sign-facts{display:grid;grid-template-columns:max-content 1fr;gap:.25rem 1rem}.sign-facts dt{font-weight:600}.sign-facts dd{margin:0}
.sign-pad-wrap{border:2px dashed #7a86a8;border-radius:.5rem;background:#fff;touch-action:none}.sign-pad-wrap canvas{width:100%;height:auto;aspect-ratio:5/2;display:block;touch-action:none}
@media (max-width:480px){.sign-card{padding:.75rem}}
.steps{list-style:none;margin:0;padding:0;display:grid;gap:.75rem}.step{display:flex;gap:.75rem;align-items:flex-start}.step-n{flex:0 0 2rem;height:2rem;border-radius:50%;display:grid;place-items:center;font-weight:700;background:#e3e7f0;color:#374160}
.step-done .step-n{background:#1b7f4b;color:#fff}.step-todo .step-n{background:var(--bs-primary,#082578);color:#fff}.step-blocked{opacity:.65}.sig-row{align-items:flex-start;flex-wrap:wrap}.share-box{background:#f6f8fc;border:1px solid #d6dbe8;border-radius:.5rem;padding:.75rem}
.bell{position:relative}.bell .count{position:absolute;top:-.15rem;right:-.15rem;min-width:1.1rem;height:1.1rem;border-radius:.55rem;background:#c0182b;color:#fff;font-size:.7rem;display:grid;place-items:center;padding:0 .2rem}
.test-banner{background:#a00;color:#fff;text-align:center;font-weight:700;padding:.4rem .75rem;font-size:.85rem;position:sticky;top:0;z-index:50}
/* UI-001: Suchbutton nur als Lupen-Icon, einheitliche Größe/Ausrichtung, ≥ 44 px */
.btn-search{flex:0 0 auto;width:44px;min-width:44px;height:44px;padding:0;display:inline-flex;align-items:center;justify-content:center}.btn-search .icon{margin:0}
/* ProseMirror-Basisregeln (statt der von TipTap per <style> injizierten – CSP) */
.ProseMirror{position:relative;word-wrap:break-word;white-space:pre-wrap;white-space:break-spaces;font-variant-ligatures:none}.ProseMirror-hideselection *::selection{background:transparent}.ProseMirror-selectednode{outline:2px solid #8cf}
.ProseMirror table{table-layout:fixed;overflow:hidden}.ProseMirror .selectedCell:after{z-index:2;position:absolute;content:"";left:0;right:0;top:0;bottom:0;background:rgba(200,200,255,.4);pointer-events:none}.ProseMirror td,.ProseMirror th{position:relative}
.ProseMirror-gapcursor{display:none;pointer-events:none;position:absolute}.ProseMirror-gapcursor:after{content:"";display:block;position:absolute;top:-2px;width:20px;border-top:1px solid #000;animation:ProseMirror-cursor-blink 1.1s steps(2,start) infinite}
@keyframes ProseMirror-cursor-blink{to{visibility:hidden}}.ProseMirror-focused .ProseMirror-gapcursor{display:block}
.sidebar .bell{position:relative}.sidebar .bell .count{position:static;margin-left:auto}
.dev-target{flex:1 1 12rem;min-width:0;max-width:100%}
/* Vertragsansicht (QS-UI-029…033) */
.contract-status{margin:.25rem 0 1rem}.main-action{border-left:4px solid var(--bs-primary,#082578)}.main-action h2{margin-top:0}
.steps-compact{gap:.35rem}.steps-compact .step-n{flex:0 0 1.6rem;height:1.6rem;font-size:.8rem}.sign-pad-wrap canvas{max-width:100%}
.sign-pad-wrap[data-signpad]{max-width:36rem;margin-bottom:.5rem}.sign-pad-wrap[data-signpad] [data-signpad-clear]{margin:.5rem}
/* Personen-Autocomplete */
.person-search{margin-bottom:.75rem}.combo{position:relative}.combo-list{position:absolute;z-index:30;left:0;right:0;top:100%;margin:.125rem 0 0;padding:.25rem;list-style:none;background:#fff;border:1px solid #bbc2d4;border-radius:.5rem;box-shadow:0 .5rem 1.5rem rgba(0,0,0,.15);max-height:16rem;overflow:auto}
.combo-opt{padding:.6rem .75rem;border-radius:.25rem;cursor:pointer;min-height:44px;display:flex;align-items:center}.combo-opt.active,.combo-opt:hover{background:#e8eefb}.person-search .chosen{display:flex;gap:.75rem;align-items:center;flex-wrap:wrap;padding:.5rem .75rem;background:#eef6ee;border:1px solid #b9d9bd;border-radius:.5rem}
[data-ps-new][hidden]{display:none}

/* QS-UI-011: Suchfeld über die volle Breite, Lupe rechts im Feld, kein eigener Buttonrahmen */
.searchfield{position:relative}.searchfield .form-control{width:100%;padding-right:3rem;min-height:44px}.searchfield-btn{position:absolute;right:.25rem;top:50%;transform:translateY(-50%);width:44px;height:44px;border:0;background:transparent;color:#3E4960;display:inline-flex;align-items:center;justify-content:center;border-radius:50%}
.searchfield-btn:hover{background:var(--c-accent,#e8eefb);color:var(--c-primary,#082578)}.searchfield-btn:focus-visible{outline:2px solid var(--c-primary,#082578);outline-offset:-2px}.toolbar .searchfield{flex:1 1 100%}

.ai-stats{grid-template-columns:repeat(auto-fit,minmax(14rem,1fr))}.ai-val{font-size:13px}.ai-lbl{font-size:13px}.table-wrap{overflow-x:auto}
/* Teilen-Dialog, Optionsmenü (QS-UI-039/047) */
.share-dialog{border:0;border-radius:.75rem;padding:1.25rem;width:min(34rem,94vw);box-shadow:0 1rem 3rem rgba(0,0,0,.3)}.share-dialog::backdrop{background:rgba(10,20,50,.55)}
.opt-menu{position:relative;display:inline-block}.opt-menu>summary{list-style:none;cursor:pointer}.opt-menu>summary::-webkit-details-marker{display:none}.opt-pop{position:absolute;right:0;z-index:10;margin-top:.25rem;min-width:15rem;background:#fff;border:1px solid #bbc2d4;border-radius:.5rem;box-shadow:0 .5rem 1.5rem rgba(0,0,0,.18);padding:.75rem}

/* QS-UI-035/036: H1-Abstand, Platzhalter-Menü mit natürlichem Umbruch */
.tpl-content h1{margin-bottom:.6em}.tpl-ph-item{align-items:flex-start;text-align:left}.tpl-ph-item span{white-space:normal;overflow-wrap:anywhere;word-break:normal;hyphens:auto}.tpl-pop{min-width:18rem}

/* lange Statusbezeichnungen dürfen umbrechen (320 px) */
.docitem .badge-s,.contract-status .badge-s{white-space:normal;max-width:100%;line-height:1.3}
/* UX-Beta 2 */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); } .chip { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--c-border); border-radius: 999px; text-decoration: none; color: inherit; }
.chip.on, .chip[aria-current] { background: var(--c-primary, #1d3a5f); color: #fff; border-color: transparent; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); } @media (min-width: 992px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat-link { display: block; color: inherit; text-decoration: none; }
.next-step { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); } .next-step .grow { flex: 1 1 14rem; min-width: 0; }
details.card-x > summary, details.mt-3 > summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; }
.next-step { padding: 12px 16px; margin-bottom: var(--sp-4); border: 1px solid var(--c-border); border-left: 4px solid var(--c-primary); border-radius: 10px; background: var(--c-surface); }
.logo-preview { max-height: 80px; max-width: 240px; height: auto; width: auto; }
.mail-preview { width: 100%; height: 640px; border: 1px solid var(--c-border); border-radius: 10px; background: #fff; }
.mail-text { white-space: pre-wrap; word-break: break-word; font-size: .875rem; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 8px; padding: 12px; }

/* Franz Edition 2: vier Hauptpunkte in der Topbar (768–991 px) ohne Überlauf */
@media (min-width: 768px) and (max-width: 991.98px) { .top-actions .btn-cta { display: none; } .topnav { margin-left: var(--sp-2); } .topnav a { padding: 0 10px; gap: 6px; } }
/* Dokumentenliste (Franz Edition 2) */
.fz-list { list-style: none; margin: 0; padding: 0; } .fz-list li { border-bottom: 1px solid var(--c-border, #eef0f5); } .fz-list a { display: flex; align-items: center; gap: 12px; padding: 12px 4px; min-height: 56px; text-decoration: none; color: inherit; }
.fz-list a:hover { background: #f8f9fd; } .fz-list .fz-ico { color: #082578; flex: none; } .fz-list .fz-txt { flex: 1; min-width: 0; } .fz-list b { display: block; font-weight: 600; } .fz-list small { display: block; color: #6b7280; font-size: .85rem; overflow-wrap: anywhere; }
.fz-list .fz-chev { color: #9aa3b5; flex: none; width: 18px; height: 18px; }
.fz-search { display: grid; gap: 10px; margin-bottom: 8px; } .fz-search .form-control, .fz-search .form-select { min-height: 48px; border-radius: 12px; }
.fz-search .fz-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; } .fz-search .form-select { min-width: 0; width: 100%; padding-left: .75rem; padding-right: 2rem; text-overflow: ellipsis; }

/* ── Zentrale Kopfzeile (FE2-UX-001): identisch auf allen regulären Seiten ───────────────── */
.app { display: block; } .sidebar, .topbar { display: none !important; }
.fz-top { position: sticky; top: 0; z-index: 1030; background: #fff; border-bottom: 1px solid var(--c-border); padding-top: env(safe-area-inset-top); }
.fz-top-in { display: flex; align-items: center; gap: 4px; height: 60px; padding: 0 12px; max-width: 1280px; margin: 0 auto; }
.fz-logo { display: inline-flex; align-items: center; margin-right: auto; min-height: 44px; } .fz-logo img { display: block; height: 40px; width: auto; }
.fz-back, .fz-bell, .fz-gear { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; color: #6b7280; text-decoration: none; flex: none; }
.fz-back { color: #082578; margin-left: -8px; } .fz-back:hover, .fz-bell:hover, .fz-gear:hover { background: #f1f4fb; } .fz-bell[aria-current], .fz-gear[aria-current] { color: #082578; background: #eaf0fd; }
.fz-back .icon, .fz-bell .icon, .fz-gear .icon { width: 24px; height: 24px; }
.fz-acts { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.fz-count { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #082578; color: #fff; font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center; }
.fz-topnav { display: none; }
.content { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
@media (min-width: 768px) {
  .fz-top-in { padding: 0 24px; gap: 8px; } .fz-logo { margin-right: 12px; } .fz-top-in .fz-acts { margin-left: auto; }
  .fz-topnav { display: flex; gap: 4px; }
  .fz-topnav a { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 10px; color: #3E4960; text-decoration: none; font-weight: 500; }
  .fz-topnav a:hover { background: #f1f4fb; } .fz-topnav a[aria-current="page"] { background: #eaf0fd; color: #082578; font-weight: 700; } .fz-topnav .icon { width: 20px; height: 20px; }
  .content { padding-bottom: 48px; }
}
@media (min-width: 768px) and (max-width: 991.98px) { .fz-topnav a { padding: 0 10px; gap: 6px; } }
@media (max-width: 767.98px) { body.fz-wiz .bottomnav { display: none; } }
.fz-chips { display: flex; gap: 8px; margin: 0 0 12px; flex-wrap: wrap; } .fz-chips a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid var(--c-border); background: #fff; color: #3E4960; text-decoration: none; font-weight: 600; } .fz-chips a[aria-current] { background: #082578; border-color: #082578; color: #fff; }
.fz-list .badge-s { flex: none; }
.tbl .num, .tbl th.num { text-align: right; white-space: nowrap; } .tbl caption { caption-side: top; font-weight: 600; padding: 0 0 6px; color: #3E4960; }


/* Layouts for the template workspace, property details and the Franz contract step. */
.ux-stack { display: grid; align-content: start; gap: 16px; }
.ux-stack > *, .ux-grid > * { min-width: 0; }
.ux-grid { display: grid; gap: 16px; align-items: start; }
.ux-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.ux-tabs a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 13px; border: 1px solid var(--c-border); border-radius: 9px; background: #fff; color: var(--c-text, #27344a); text-decoration: none; font-weight: 650; }
.ux-tabs a[aria-current] { border-color: #b0c1eb; background: #eaf0fd; color: #082578; }
.ux-tab-short { display: none; }
@media (max-width: 575px) {
  .ux-template-crumbs .crumbs li[aria-current] { display: none; }
  .ux-tab-wide { display: none; }
  .ux-tab-short { display: inline; }
}
.ux-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 13px 15px; }
.ux-row + .ux-row, .ux-list li + li { border-top: 1px solid var(--c-border); }
.ux-list { padding: 0; overflow: hidden; }
.ux-row[href] { text-decoration: none; color: var(--c-text, #27344a); }
.ux-row[href]:hover, .ux-row[href]:focus-visible { background: #f1f5ff; }
.ux-row .ico { display: grid; place-items: center; border-radius: 9px; width: 36px; height: 36px; flex: none; background: #eaf0fd; color: #082578; }
.ux-row .ux-row-text { min-width: 8rem; flex: 1; overflow-wrap: anywhere; }
.ux-row strong, .ux-row small { display: block; }
.ux-row small { color: #56637a; margin-top: 2px; }
.ux-row .badge-s { white-space: normal; }
.ux-hero { position: relative; overflow: hidden; padding: clamp(16px, 3vw, 25px); border-radius: 14px; background: linear-gradient(112deg, #082578, #1d449e); color: #fff; }
.ux-hero h2, .ux-hero p { color: #fff; }
.ux-hero h2 { overflow-wrap: anywhere; margin: 5px 0 12px; }
.ux-hero .btn { background: white; color: #082578; border-color: white; }
.ux-step { color: #082578; font-weight: 700; }
.ux-status { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.ux-details > summary { min-height: 44px; align-content: center; }
.ux-review-form { display: grid; gap: 9px; max-width: 38rem; }
.ux-picker { display: grid; gap: 2px 14px; }
.ux-picker label { display: flex; align-items: center; gap: 9px; min-height: 44px; overflow-wrap: anywhere; }
.ux-picker input { flex: none; width: 18px; height: 18px; accent-color: #082578; }
.ux-editor-card { padding: clamp(9px, 2vw, 20px); }
.ux-editor-card .tpl-html { width: 100%; }
.ux-wizard .fz-card { margin: 0; }
.ux-wizard [data-template-warnings][hidden] { display: none; }
.ux-wizard .fz-card h2 { margin: 0 0 10px; }
.ux-wizard .ux-wizard-address { overflow-wrap: anywhere; }
.ux-wizard .ux-warm { display: flex; justify-content: space-between; gap: 8px; padding: 12px; border-radius: 9px; color: #082578; background: #eaf0fd; font-weight: 750; }
.ux-wizard .ux-warm #fz-warm { white-space: nowrap; }
.ux-wizard .ux-summary { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); margin-bottom: 12px; }
.ux-wizard .ux-summary dt { color: #56637a; font-size: .88rem; font-weight: 500; }
.ux-wizard .ux-summary dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
@media (min-width: 720px) {
  .ux-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ux-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .ux-grid.ux-wide-start { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
}
@media (max-width: 374px) {
  .ux-tabs { gap: 6px; }
  .ux-tabs a { padding-inline: 8px; font-size: .84rem; }
}

/* Existing TipTap controls, with a single compact toolbar and visual-viewport-aware menus. */
.tpl-editor { border-color: #c5d0e3; border-radius: 12px; }
.tpl-editor .tpl-toolbar { top: calc(60px + env(safe-area-inset-top)); padding: 5px 4px; background: #f3f6fc; border-radius: 11px 11px 0 0; }
.tpl-editor .tpl-content { overflow-wrap: anywhere; scroll-margin-block: 7rem 3rem; }
.tpl-editor .tableWrapper { width: 100%; overflow: auto; }
.tpl-editor .tpl-content .mp-ph { color: #082578; background: #eaf0fd; border: 0; font: inherit; font-size: .86em; font-weight: 650; white-space: normal; border-radius: 4px; }
.tpl-editor .tpl-pop { min-width: 0; }
.tpl-editor .tpl-menu:has(.tpl-primary) > .tpl-pop, .tpl-editor .tpl-menu[data-tool-menu="more"] > .tpl-pop { left: auto; right: 0; }
.tpl-compact-panel { display: flex; flex-direction: column; gap: 8px; }
.tpl-compact-panel .tpl-grp { display: flex; flex-wrap: wrap; padding: 0 0 6px; border-right: 0; border-bottom: 1px solid var(--c-border); }
.tpl-compact-panel .tpl-grp:last-child { border-bottom: 0; }
.tpl-compact-panel .tpl-grp::before { content: attr(data-caption); width: 100%; padding-inline: 6px; font-size: .8rem; color: #56637a; font-weight: 700; }
.tpl-compact-panel [data-tool="table"]::after { content: "Tabelle einfügen"; }
.tpl-compact-panel [data-tool="full"]::after { content: "Vollbild"; }
.tpl-compact-panel .tpl-menu { width: 100%; }
.tpl-compact-panel .tpl-pop { position: static; box-shadow: none; max-width: none; max-height: min(250px, 36dvh); }
.tpl-compact-toggle { margin-left: auto; font-weight: 700; }
.tpl-editor .tpl-btn[aria-expanded="true"] { box-shadow: inset 0 0 0 1px #8da7e4; }
.tpl-editor [hidden] { display: none !important; }
.tpl-editor.tpl-full .tpl-toolbar { top: 0; }
@media (max-width: 1099px) {
  .tpl-editor .tpl-toolbar { flex-wrap: nowrap; gap: 3px; }
  .tpl-editor .tpl-btn, .tpl-editor .tpl-style, .tpl-editor .tpl-item, .tpl-editor .tpl-ph-item { min-height: 44px; }
  .tpl-editor .tpl-btn { min-width: 44px; padding-inline: 6px; }
  .tpl-editor .tpl-surface { padding: 13px; }
  .tpl-editor .tpl-primary .tpl-ic { display: none; }
  .tpl-editor .tpl-toolbar > .tpl-menu { position: static; }
  .tpl-editor .tpl-toolbar > .tpl-menu > .tpl-pop, .tpl-compact-panel {
    position: fixed; z-index: 40; inset: auto 12px max(16px, calc(var(--tpl-visual-bottom, 0px) + 12px)) 12px;
    width: min(calc(100% - 24px), 29rem); margin: 0 auto; padding: 8px;
    max-height: min(425px, calc(var(--tpl-visual-height, 100dvh) * .55)); overflow: auto; overscroll-behavior: contain;
    border: 1px solid #becae0; border-radius: 10px; background: #fff; box-shadow: 0 10px 24px #17295728;
  }
  .tpl-editor .tpl-toolbar > .tpl-menu > .tpl-pop { left: 12px; right: 12px; }
  .tpl-editor .tpl-ph-list { max-height: min(315px, calc(var(--tpl-visual-height, 100dvh) * .34)); }
  .tpl-editor input.tpl-search { min-height: 44px; font-size: 16px; }
  .tpl-editor.tpl-full { bottom: var(--tpl-visual-bottom, 0px); }
}
@media (max-width: 767.98px) {
  .tpl-editor:not(.tpl-full):not(.tpl-keyboard) .tpl-toolbar > .tpl-menu > .tpl-pop,
  .tpl-editor:not(.tpl-full):not(.tpl-keyboard) .tpl-compact-panel { bottom: calc(68px + env(safe-area-inset-bottom)); }
}
@media (max-width: 374px) {
  .tpl-compact-toggle > span { display: none; }
  .tpl-editor .tpl-btn-text.tpl-primary { padding-inline: 6px; }
}

/* Product logo on the unauthenticated login. */
body.mitiwo-login { display: grid; justify-items: center; align-items: center; min-height: 100svh; padding: clamp(16px, 5vw, 40px); background: radial-gradient(ellipse at 50% 0, #e8eeff, #f7f8fc 60%); }
.mitiwo-login-card { width: min(100%, 410px); padding: clamp(22px, 7vw, 40px); border: 1px solid #dfe5f1; border-radius: 20px; background: #fff; box-shadow: 0 14px 48px #13275011; }
.mitiwo-brand { margin: 0 0 23px; }
.mitiwo-brand img { display: block; width: min(100%, 225px); height: auto; aspect-ratio: 4.65; object-fit: cover; }
.mitiwo-login-card h1 { margin: 0 0 18px; font-size: 1.35rem; letter-spacing: -.025em; }
.mitiwo-login-form { display: grid; }
.mitiwo-login-form label { margin-bottom: 5px; font-weight: 650; }
.mitiwo-login-form input { min-height: 48px; margin-bottom: 14px; font-size: 16px; }
.mitiwo-login-form .btn { min-height: 48px; margin-top: 4px; }
.mitiwo-help { display: inline-flex; justify-self: center; align-items: center; min-height: 44px; margin-top: 7px; color: #082578; }
