/* Sternheim-Gruppe – Personalverwaltung
 * Mobile first · Hell/Dunkel · Safe-Areas (Notch, Dynamic Island, Home-Indicator)
 * Foldables/Dual-Screen über Viewport-Segments. */

/* ---------- Tokens ---------- */
:root {
  --brand: #2e2a86;
  --brand-hover: #24206c;
  --brand-ink: #ffffff;
  --ink: #141414;
  --ink-2: #4a4a4a;
  --ink-3: #6e6e6e;
  --bg: #f3f3f7;
  --surface: #ffffff;
  --surface-2: #f8f8f7;
  --line: #e2e2df;
  --focus: #2e2a86;
  --ok-bg: #e8f5ec;   --ok-ink: #17602f;
  --warn-bg: #fff5dc; --warn-ink: #7a5300;
  --err-bg: #fdecec;  --err-ink: #a3000b;
  --info-bg: #eef3fb; --info-ink: #1f4d8f;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 2px 8px rgb(0 0 0 / .04);
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --gutter: 16px;
  --topbar-h: 60px;
  --bottombar-h: 62px;
  --sidebar-w: 240px;
  color-scheme: light;
}

/* Dunkel: automatisch nach Gerät (außer fest „Hell“ gewählt) oder fest „Dunkel“ (data-theme am <html>) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #9d98ff;
    --brand-hover: #b5b1ff;
    --brand-ink: #15123f;
    --ink: #f0f0ee;
    --ink-2: #c4c4c0;
    --ink-3: #9a9a96;
    --bg: #101010;
    --surface: #1b1b1b;
    --surface-2: #232323;
    --line: #333331;
    --focus: #b5b1ff;
    --ok-bg: #12301c;   --ok-ink: #8ee0a8;
    --warn-bg: #3a2c05; --warn-ink: #ffd56b;
    --err-bg: #3d0f12;  --err-ink: #ff9aa0;
    --info-bg: #13253f; --info-ink: #a6c8ff;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #9d98ff;
  --brand-hover: #b5b1ff;
  --brand-ink: #15123f;
  --ink: #f0f0ee;
  --ink-2: #c4c4c0;
  --ink-3: #9a9a96;
  --bg: #101010;
  --surface: #1b1b1b;
  --surface-2: #232323;
  --line: #333331;
  --focus: #b5b1ff;
  --ok-bg: #12301c;   --ok-ink: #8ee0a8;
  --warn-bg: #3a2c05; --warn-ink: #ffd56b;
  --err-bg: #3d0f12;  --err-ink: #ff9aa0;
  --info-bg: #13253f; --info-ink: #a6c8ff;
  --shadow: none;
  color-scheme: dark;
}

/* ---------- Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.45rem, 1.2rem + 1vw, 1.9rem); }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; margin-top: 1.5em; }
p { margin: 0 0 1em; }
a { color: inherit; text-decoration-color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand); }
img, svg { max-width: 100%; }
code { font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip-link { position: absolute; left: -999px; top: 0; z-index: 100; background: var(--surface); padding: 8px 12px; }
.skip-link:focus { left: calc(var(--sal) + 8px); top: calc(var(--sat) + 8px); }
.muted { color: var(--ink-3); }
.small { font-size: .875rem; }
.center { text-align: center; }
.stack > * + * { margin-top: 14px; }

.icon { width: 22px; height: 22px; flex: none; }
.icon-lg { width: 30px; height: 30px; }
.icon-xl { width: 48px; height: 48px; }
.inline-icon .icon { width: 18px; height: 18px; vertical-align: -3px; }

/* Logo: Hell/Dunkel */
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  font: inherit; font-weight: 600; line-height: 1.1; text-decoration: none;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; touch-action: manipulation;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:disabled { opacity: .55; cursor: progress; }
.btn .icon { width: 20px; height: 20px; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); color: var(--brand-ink); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .875rem; }
.btn-lg { min-height: 52px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; min-width: 44px; }

/* ---------- Formulare ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: .925rem; }
.field label small { font-weight: 400; color: var(--ink-3); }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px;
  font: inherit; font-size: max(16px, 1rem); /* 16px verhindert Auto-Zoom auf iOS */
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px;
}
textarea { min-height: 96px; resize: vertical; }
input:disabled { color: var(--ink-3); background: var(--surface-2); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.hint { font-size: .85rem; color: var(--ink-3); margin: 0; }
.form-error { color: var(--err-ink); background: var(--err-bg); padding: 10px 12px; border-radius: var(--radius-sm); margin: 0; }
.grid-2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; }
.inline-form input { flex: 1 1 220px; }
.inline-form select { flex: 0 1 180px; }
.inline-form .btn { flex: 0 0 auto; }
.search-field { margin-bottom: 12px; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: .85rem; margin: 22px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
details > summary { cursor: pointer; color: var(--ink-2); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.divider-details { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 6px; }
.divider-details[open] > summary { margin-bottom: 12px; }
.explain p { font-size: .9rem; color: var(--ink-2); margin-top: 4px; }

/* ---------- Meldungen ---------- */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); margin: 0 0 16px; display: flex; gap: 8px; align-items: flex-start; }
.alert-success { background: var(--ok-bg); color: var(--ok-ink); }
.alert-warning { background: var(--warn-bg); color: var(--warn-ink); }
.alert-error { background: var(--err-bg); color: var(--err-ink); }
.alert-info { background: var(--info-bg); color: var(--info-ink); }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--info-bg); color: var(--info-ink); }
.badge-danger { background: var(--err-bg); color: var(--err-ink); }
pre.debug { white-space: pre-wrap; font-size: .75rem; background: var(--surface-2); padding: 12px; border-radius: 6px; max-height: 50vh; overflow: auto; }

/* ---------- Einfaches Layout (Login, Einladung, Fehler) ---------- */
body.plain { min-height: 100dvh; }
.plain-main {
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(var(--sat) + 24px) calc(var(--sar) + var(--gutter)) calc(var(--sab) + 24px) calc(var(--sal) + var(--gutter));
}
.plain-card {
  width: 100%; max-width: 440px; background: var(--surface);
  border-radius: 14px; box-shadow: var(--shadow); padding: 28px 24px;
  border-top: 4px solid var(--brand);
}
.plain-logo { display: block; margin: 0 auto 24px; max-width: 240px; }
.plain-logo img { width: 100%; height: auto; }
.plain-footer { margin-top: 20px; font-size: .8rem; color: var(--ink-3); text-align: center; }
@media (max-width: 380px) {
  .plain-card { padding: 22px 16px; border-radius: 10px; }
}

/* ---------- App-Layout (mobil zuerst) ---------- */
.app {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "top" "main";
}
.topbar {
  grid-area: top; position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: calc(var(--topbar-h) + var(--sat));
  padding: var(--sat) calc(var(--sar) + var(--gutter)) 0 calc(var(--sal) + var(--gutter));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-logo { display: block; width: 132px; flex: none; }
.topbar-logo img { width: 100%; height: auto; }
.topbar-context { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tenant-name { display: none; font-weight: 600; color: var(--ink-2); }
.tenant-switch select { min-height: 38px; padding-block: 6px; font-size: 16px; max-width: 46vw; }
.user-chip { display: none; flex-direction: column; text-align: right; font-weight: 600; font-size: .9rem; line-height: 1.25; }
.user-chip small { font-weight: 400; color: var(--ink-3); }

.content {
  grid-area: main; min-width: 0; width: 100%; max-width: 1100px; margin: 0 auto;
  padding: 20px calc(var(--sar) + var(--gutter)) calc(var(--bottombar-h) + var(--sab) + 28px) calc(var(--sal) + var(--gutter));
}
.content:focus { outline: none; }

.sidebar { display: none; }
.sidebar ul, .more-menu ul { list-style: none; margin: 0; padding: 0; }


/* Untere Navigation (Smartphone) */
.bottombar {
  position: fixed; inset: auto 0 0 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 0 var(--sar) var(--sab) var(--sal);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
}
.bottombar a, .bottombar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--bottombar-h); padding: 6px 2px;
  font: inherit; font-size: .7rem; font-weight: 600; color: var(--ink-3); text-decoration: none;
  background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.bottombar [aria-current="page"], .bottombar [aria-expanded="true"] { color: var(--brand); }
.bottombar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.more-menu {
  position: fixed; z-index: 40;
  right: calc(var(--sar) + 10px); bottom: calc(var(--bottombar-h) + var(--sab) + 10px);
  width: min(300px, calc(100vw - var(--sal) - var(--sar) - 20px));
  max-height: calc(100dvh - var(--bottombar-h) - var(--sab) - var(--sat) - 40px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgb(0 0 0 / .18); padding: 6px;
}
.more-menu a, .nav-button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 10px 12px;
  font: inherit; color: var(--ink); text-decoration: none; text-align: left;
  background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer;
}
.more-menu a:hover, .nav-button:hover { background: var(--surface-2); color: var(--ink); }

/* Sehr schmale Displays (z. B. Galaxy Z Fold außen, iPhone SE) */
@media (max-width: 359px) {
  :root { --gutter: 12px; }
  .topbar-logo { width: 112px; }
  .bottombar span { font-size: .62rem; }
}

/* Breiter als ein Smartphone: Namen zeigen */
@media (min-width: 600px) {
  .user-chip { display: flex; }
  .tenant-name { display: inline; }
  .topbar-logo { width: 160px; }
}

/* Tablet quer / Desktop / aufgeklapptes Foldable: Seitenleiste statt unterer Leiste */
@media (min-width: 900px) {
  .app {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    grid-template-areas: "top top" "nav main";
  }
  .sidebar {
    grid-area: nav; display: flex; flex-direction: column; justify-content: space-between;
    position: sticky; top: calc(var(--topbar-h) + var(--sat)); align-self: start;
    height: calc(100dvh - var(--topbar-h) - var(--sat));
    padding: 16px 12px calc(16px + var(--sab)) calc(var(--sal) + 12px);
    border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto;
  }
  .sidebar a, .sidebar .nav-button {
    display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 12px;
    color: var(--ink-2); text-decoration: none; font-weight: 600; border-radius: var(--radius-sm);
  }
  .sidebar a:hover, .sidebar .nav-button:hover { background: var(--surface-2); color: var(--ink); }
  .sidebar a[aria-current="page"] { background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--brand); }
  .sidebar-secondary { border-top: 1px solid var(--line); padding-top: 12px !important; margin-top: 12px !important; }
  .bottombar, .more-menu { display: none !important; }
  .content { padding: 28px calc(var(--sar) + 32px) calc(var(--sab) + 40px) 32px; }
}

/* Foldables / Dual-Screen nebeneinander (Surface Duo, Galaxy Fold aufgeklappt mit Scharnier):
   Navigation auf dem linken Display, Inhalt auf dem rechten – nie über das Scharnier. */
@media (horizontal-viewport-segments: 2) {
  .app {
    grid-template-columns: env(viewport-segment-width 0 0, 50vw) minmax(0, 1fr);
    column-gap: calc(env(viewport-segment-left 1 0, 50vw) - env(viewport-segment-right 0 0, 50vw));
    grid-template-areas: "top main" "nav main";
    grid-template-rows: auto 1fr;
  }
  .topbar { position: static; }
  .sidebar {
    grid-area: nav; display: flex; flex-direction: column; position: static; height: auto;
    padding: 16px calc(var(--gutter)) calc(var(--sab) + 16px) calc(var(--sal) + var(--gutter));
    border: 0; background: transparent;
  }
  .sidebar a, .sidebar .nav-button { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 12px; text-decoration: none; color: var(--ink-2); font-weight: 600; }
  .sidebar a[aria-current="page"] { color: var(--brand); }
  .bottombar, .more-menu { display: none !important; }
  .content { max-width: none; height: 100dvh; overflow-y: auto; padding: calc(var(--sat) + 20px) calc(var(--sar) + 20px) calc(var(--sab) + 20px) 20px; }
}

/* Foldable übereinander (Laptop-Haltung): Inhalt oben, Navigation unten */
@media (vertical-viewport-segments: 2) {
  .content { padding-bottom: calc(100dvh - env(viewport-segment-top 0 1, 50dvh) + 16px); }
}

/* Querformat auf niedrigen Smartphones: kompaktere Leisten */
@media (max-height: 480px) and (orientation: landscape) and (max-width: 899px) {
  :root { --topbar-h: 48px; --bottombar-h: 50px; }
  .bottombar a span, .bottombar button span { display: none; }
}

/* ---------- Bausteine ---------- */
.page-head { margin-bottom: 20px; }
.page-head .muted { margin: -2px 0 0; }
.page-head-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.page-head-actions h1 { margin: 0; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px;
}
@media (max-width: 480px) { .card { padding: 16px; border-radius: 8px; } }

.callout {
  display: grid; grid-template-columns: auto 1fr; gap: 12px 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand);
  border-radius: var(--radius); padding: 16px; margin-bottom: 18px;
}
.callout p { margin: 2px 0 0; color: var(--ink-2); font-size: .925rem; }
.callout .btn { grid-column: 1 / -1; }
.callout > .icon { color: var(--brand); }
.callout-subtle { border-left-color: var(--line); }
.callout-subtle > .icon { color: var(--ink-2); }
@media (min-width: 600px) {
  .callout { grid-template-columns: auto 1fr auto; }
  .callout .btn { grid-column: auto; }
}

.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); margin-bottom: 18px; }
.stat {
  display: flex; flex-direction: column; padding: 16px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--ink-3); font-size: .85rem; }

.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.tile {
  display: flex; flex-direction: column; gap: 6px; padding: 20px; min-height: 140px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s;
}
.tile:hover { border-color: var(--brand); color: var(--ink); }
.tile > .icon { color: var(--brand); margin-bottom: 4px; }
.tile span { color: var(--ink-3); font-size: .9rem; }

.list { list-style: none; margin: 0; padding: 0; }
.list.card { padding: 0; overflow: hidden; }
.list-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.list.card .list-row { padding: 12px 16px; }
.list-row:last-child { border-bottom: 0; }
.list-row > .icon { color: var(--ink-3); }
.list-main { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; text-decoration: none; color: inherit; }
a.list-main:hover strong { color: var(--brand); }
.list-row.is-disabled { opacity: .6; }
.list-row.is-pending > .icon { color: var(--info-ink); }
.list-row form { margin: 0; }
.list-empty { padding: 20px 16px; color: var(--ink-3); text-align: center; }

.empty-state { text-align: center; padding: 40px 20px; }
.empty-state > .icon { color: var(--ink-3); margin-bottom: 8px; }

/* Installationsanleitung */
.tab-list { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; scrollbar-width: none; }
.tab-list [role="tab"] {
  flex: 0 0 auto; min-height: 44px; padding: 8px 16px; font: inherit; font-weight: 600;
  color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; cursor: pointer;
}
.tab-list [aria-selected="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.steps { padding-left: 1.4em; margin: 0 0 1em; }
.steps li { margin-bottom: 10px; padding-left: 4px; }
.steps li::marker { font-weight: 700; color: var(--brand); }
.install-auto { margin-bottom: 18px; }

/* Druck */
@media print {
  .topbar, .sidebar, .bottombar, .more-menu { display: none !important; }
  .app { display: block; }
  .content { padding: 0; }
  .no-print, .no-tenant, .flash, .alert-info { display: none !important; }
  .card.statement { border: 0; box-shadow: none; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Flächen & Verträge ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.grid-3 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.badge-ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge-muted { background: var(--surface-2); color: var(--ink-3); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 16px; }
.toolbar input[type="search"] { flex: 1 1 220px; width: auto; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.segmented button {
  min-height: 44px; padding: 8px 14px; font: inherit; font-weight: 600; color: var(--ink-2);
  background: none; border: 0; border-right: 1px solid var(--line); cursor: pointer;
}
.segmented button:last-child { border-right: 0; }
.segmented [aria-pressed="true"] { background: var(--ink); color: var(--surface); }

.building { margin-bottom: 28px; }
.floor-head { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 18px 0 8px; }
.unit-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.unit {
  --section: #888888;
  display: flex; flex-direction: column; gap: 2px; min-height: 92px; padding: 10px 12px 10px 14px;
  background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--section);
  border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); font-size: .875rem;
}
.unit:hover { border-color: var(--ink-3); border-left-color: var(--section); color: var(--ink); }
.unit-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.unit-head strong { font-size: 1rem; }
.unit-section { font-size: .72rem; font-weight: 700; color: var(--ink-3); }
.unit-area { color: var(--ink-3); }
.unit-tenant { font-weight: 600; line-height: 1.3; }
.unit-tenant small { display: block; font-weight: 400; color: var(--ink-3); }
.unit-free { background: var(--surface-2); border-style: dashed; border-left-style: solid; }
.unit-free .unit-tenant { color: var(--ok-ink); }
.unit-inactive { opacity: .55; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip {
  --section: #888888;
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 10px;
  font-size: .85rem; font-weight: 600; color: var(--ink); text-decoration: none;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px;
}
.chip small { font-weight: 400; color: var(--ink-3); }
.chip-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--section); flex: none; }
a.chip:hover { border-color: var(--ink-3); color: var(--ink); }

.lease { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; }
.lease-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.lease-head > div { display: flex; flex-direction: column; }
.lease-foot { margin: 10px 0 0; }
.facts { display: grid; gap: 8px 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); margin: 8px 0 0; }
.facts div { display: flex; flex-direction: column; }
.facts dt { font-size: .78rem; color: var(--ink-3); }
.facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

.picker-sum { font-variant-numeric: tabular-nums; }
.picker-group { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.picker-group legend { font-weight: 700; margin-bottom: 8px; }
.picker-grid { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 128px), 1fr)); }
.pick {
  --section: #888888;
  position: relative; display: flex; flex-direction: column; min-height: 56px; padding: 8px 10px 8px 34px;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--section);
  border-radius: var(--radius-sm); cursor: pointer; font-size: .85rem; -webkit-tap-highlight-color: transparent;
}
.pick input { position: absolute; left: 9px; top: 10px; width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }
.pick-num { font-weight: 700; font-size: .95rem; }
.pick-meta { color: var(--ink-3); line-height: 1.25; }
.pick.is-selected { background: color-mix(in srgb, var(--brand) 8%, var(--surface)); border-color: var(--brand); border-left-color: var(--section); }
.pick.is-busy:not(.is-selected) { opacity: .6; }
.pick:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }

.sticky-actions {
  position: sticky; bottom: calc(var(--bottombar-h) + var(--sab) + 8px); z-index: 5;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end;
  padding: 10px 12px; margin-top: 12px; background: color-mix(in srgb, var(--surface) 94%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.sticky-actions > span { margin-right: auto; }
@media (min-width: 900px) { .sticky-actions { bottom: calc(var(--sab) + 12px); } }

.area-table { display: grid; gap: 6px 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.area-floor { grid-column: 1 / -1; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 14px 0 2px; }
.area-floor:first-child { margin-top: 0; }
.area-row {
  --section: #888888;
  display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 8px;
  padding-left: 8px; border-left: 4px solid var(--section);
}
.area-num { font-weight: 700; }
.area-num small { font-weight: 400; color: var(--ink-3); }
.area-row input { min-height: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.area-unit { color: var(--ink-3); font-size: .85rem; }

.table-wrap { overflow-x: auto; margin: 0 -4px 12px; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
.table th { font-size: .78rem; color: var(--ink-3); font-weight: 600; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table form { margin: 0; }
.color-input { flex: 0 0 56px !important; min-height: 46px; padding: 4px !important; }

/* ---------- Tickets ---------- */
.segmented a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px;
  font-weight: 600; color: var(--ink-2); text-decoration: none; border-right: 1px solid var(--line);
}
.segmented a:last-child { border-right: 0; }
.segmented a[aria-current="true"] { background: var(--ink); color: var(--surface); }
.search-form { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 320px; }
.search-form input[type="search"] { flex: 1 1 200px; width: auto; }
.search-form select { flex: 0 1 200px; width: auto; }
.badge-new { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }

.ticket-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ticket-row {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink);
}
.ticket-row:hover { border-color: var(--ink-3); color: var(--ink); }
.ticket-row.prio-urgent { border-left: 4px solid var(--brand); }
.ticket-row.prio-high { border-left: 4px solid var(--warn-ink); }
.ticket-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ticket-no { font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ticket-time { margin-left: auto; font-size: .8rem; color: var(--ink-3); }
.ticket-title { font-size: 1.02rem; display: flex; align-items: center; gap: 8px; }
.ticket-row.is-unread .ticket-title { font-weight: 800; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); flex: none; }
.ticket-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .85rem; color: var(--ink-3); }
.meta-count { display: inline-flex; align-items: center; gap: 3px; }
.meta-count .icon { width: 15px; height: 15px; }

.choice-group { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.choice-group legend { font-weight: 600; font-size: .925rem; margin-bottom: 8px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px;
  font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px;
}
.choice input:checked + span { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.check-urgent { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.check-urgent:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); }

.upload-drop {
  display: flex; align-items: center; gap: 14px; padding: 18px; cursor: pointer;
  border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface-2);
}
.upload-drop:hover { border-color: var(--ink-3); }
.upload-drop > .icon { color: var(--brand); }
.uploader:has(input:focus-visible) .upload-drop { outline: 3px solid var(--focus); outline-offset: 2px; }
.uploader.is-busy .upload-drop { opacity: .6; cursor: progress; }
.upload-previews { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.upload-item {
  position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
}
.upload-item img { width: 100%; height: 100%; object-fit: cover; }
.upload-item small { position: absolute; left: 4px; bottom: 4px; background: rgb(0 0 0 / .6); color: #fff; padding: 0 5px; border-radius: 4px; font-size: .7rem; }
.upload-name { font-size: .75rem; padding: 6px; text-align: center; word-break: break-all; }
.upload-remove {
  position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: rgb(0 0 0 / .65); color: #fff; font-size: 1.2rem; line-height: 1; cursor: pointer;
}

.ticket-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.ticket-layout { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) {
  .ticket-layout { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
  .ticket-side { position: sticky; top: calc(var(--topbar-h) + var(--sat) + 16px); }
}
.ticket-desc { margin-top: 14px; white-space: normal; line-height: 1.6; }

.attachments { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 120px), 1fr)); margin-top: 12px; }
.thumb { display: block; aspect-ratio: 4 / 3; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-chip {
  display: flex; flex-direction: column; gap: 4px; padding: 10px; min-height: 90px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); font-size: .85rem;
  overflow-wrap: anywhere;
}
.file-chip small { color: var(--ink-3); }

.timeline-head { margin: 22px 0 10px; }
.timeline { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tl-event { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; font-size: .85rem; color: var(--ink-3); text-align: center; }
.tl-event time { opacity: .8; }
.tl-msg { display: flex; }
.tl-msg.is-mine { justify-content: flex-end; }
.tl-bubble {
  max-width: min(640px, 92%); padding: 10px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
}
.tl-msg.is-staff .tl-bubble { border-left: 3px solid var(--brand); }
.tl-msg.is-mine .tl-bubble { background: color-mix(in srgb, var(--ink) 6%, var(--surface)); }
.tl-msg.is-internal .tl-bubble { background: var(--warn-bg); border-color: transparent; color: var(--ink); }
.tl-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; font-size: .82rem; margin-bottom: 4px; }
.tl-meta time { color: var(--ink-3); }
.tl-body { line-height: 1.55; }

.category-form { flex: 1; align-items: center; }
.category-form input[name="name"] { flex: 1 1 180px; }
.sort-input { flex: 0 0 80px !important; }

/* ---------- Nachrichten & Badges ---------- */
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px;
  margin-left: auto; font-size: .72rem; font-weight: 700; line-height: 1; color: #fff; background: #ff3b30; border-radius: 99px;
}
.nav-icon { position: relative; display: inline-flex; }
.bottombar .nav-icon { overflow: visible; max-width: none; }
.bottombar .nav-badge { position: absolute; top: -7px; left: 14px; right: auto; max-width: none; overflow: visible; margin: 0; min-width: 18px; height: 18px; font-size: .66rem; border: 2px solid var(--surface); box-sizing: content-box; }
.conv-row.is-broadcast { border-left: 4px solid var(--brand); }
.conv-company { font-size: .9rem; }
.conv-excerpt { display: block; overflow: hidden; text-overflow: ellipsis; }
.conv-excerpt .meta-count { margin-left: 8px; }
.badge .icon { width: 13px; height: 13px; vertical-align: -2px; }
a.badge { text-decoration: none; }
.tl-msg.is-letter .tl-bubble { max-width: 100%; width: 100%; border-radius: var(--radius); padding: 18px 20px; }
.tl-msg.is-letter .tl-body { font-size: 1.02rem; line-height: 1.65; }
.recipients summary { min-height: auto; }
.audience-panel { margin-top: 6px; display: grid; gap: 8px; }
.company-picks { display: grid; gap: 6px 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); max-height: 340px; overflow-y: auto; padding: 4px; }
.company-pick { min-height: 36px; align-items: center; }

/* ---------- Dokumente ---------- */
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.doc-row {
  display: flex; align-items: stretch; gap: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.doc-row:hover { border-color: var(--ink-3); }
.doc-open { flex: 1; min-width: 0; display: flex; gap: 14px; padding: 14px 4px 14px 14px; text-decoration: none; color: var(--ink); }
.doc-open:hover { color: var(--ink); }
.doc-icon {
  flex: none; width: 44px; height: 52px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; background: var(--surface-2); color: var(--ink-2); font-size: .7rem; font-weight: 800; letter-spacing: .04em;
}
.doc-icon.is-pdf { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.doc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.doc-title { display: flex; align-items: center; gap: 8px; }
.doc-row.is-unread .doc-title { font-weight: 800; }
.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: .82rem; color: var(--ink-3); }
.doc-desc { font-size: .88rem; color: var(--ink-2); }
.doc-read { font-size: .8rem; color: var(--ink-3); display: inline-flex; align-items: center; gap: 4px; }
.doc-read.is-read { color: var(--ok-ink); }
.doc-read .icon { width: 15px; height: 15px; }
.doc-actions { display: flex; flex-direction: column; justify-content: center; padding: 6px; }
.doc-actions form { margin: 0; }
@media (min-width: 600px) { .doc-actions { flex-direction: row; align-items: center; } }
.push-state { font-weight: 600; color: var(--ink-2); }
.push-state.is-on { color: var(--ok-ink); }

/* ---------- Statusleiste (iOS, black-translucent) ----------
   Die App reicht unter die Statusleiste – oben, im Querformat oder beim iPhone Duo auch seitlich.
   iOS beschriftet sie dann immer weiß; damit Uhrzeit & Co. lesbar bleiben, liegt unter jedem
   Sicherheitsrand (oben/links/rechts) ein dunkler Streifen. Ohne Ränder (Desktop) ist er 0 px breit. */
:root { --chrome: #141414; }
html::before, body::before, body::after {
  content: ""; position: fixed; z-index: 1000; pointer-events: none; background: var(--chrome);
}
html::before { top: 0; left: 0; right: 0; height: var(--sat); }
body::before { top: 0; bottom: 0; left: 0; width: var(--sal); }
body::after  { top: 0; bottom: 0; right: 0; width: var(--sar); }

/* ---------- 1.7.0: Raumhistorie, Verlauf, Profil, Versionen ---------- */
.btn-danger { background: var(--err-ink); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); color: #fff; }
.danger-zone { border-color: color-mix(in srgb, var(--err-ink) 40%, var(--line)); }
.danger-zone > summary, .history > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 700; color: var(--ink); }
.history-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 12px; }
.history-list > li { border-left: 3px solid var(--line); padding: 2px 0 2px 12px; }
.history-list > li:first-child { border-left-color: var(--brand); }
.history-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.history-version { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: .85rem; }
.history-changes { margin: 6px 0 0; padding-left: 18px; font-size: .88rem; }
.history-changes del { color: var(--err-ink); text-decoration: line-through; }
.history-changes ins { color: var(--ok-ink); text-decoration: none; font-weight: 600; }
.unit-table td { vertical-align: top; }
.unit-table tr.is-past td { color: var(--ink-3); }
.row-actions { text-align: right; }
.inline-menu { position: relative; display: inline-block; text-align: left; }
.inline-menu > summary { list-style: none; min-height: 36px; }
.inline-menu > summary::-webkit-details-marker { display: none; }
.inline-menu-body {
  position: absolute; right: 0; z-index: 20; width: min(340px, 86vw); margin-top: 6px; padding: 14px;
  display: grid; gap: 14px; white-space: normal;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgb(0 0 0 / .2);
}
.unit-history { margin: 4px 0 8px; }
.unit-history ul { margin: 6px 0 0; padding-left: 18px; }
.profile-layout { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .profile-layout { grid-template-columns: 280px minmax(0, 1fr); align-items: start; } }
.profile-preview { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.logo-box {
  width: 100%; aspect-ratio: 3 / 2; display: flex; align-items: center; justify-content: center; padding: 14px;
  background: #fff; border: 1px dashed var(--line); border-radius: var(--radius-sm);
}
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.profile-name { font-size: 1.1rem; }
.releases { list-style: none; margin: 0; padding: 0; }
.release-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.release-version { font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }
.release-date { margin-left: auto; }
.release ul { margin: 10px 0 0; padding-left: 20px; }
.release li + li { margin-top: 4px; }

/* ---------- 1.8.0: Hilfe ---------- */
.help-button {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none;
  border-radius: 50%; color: var(--ink-2); text-decoration: none; border: 1px solid var(--line); background: var(--surface);
}
.help-button:hover { color: var(--brand); border-color: var(--brand); }
.help-groups { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); align-items: start; }
.help-group h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.help-links { list-style: none; margin: 0; padding: 0; }
.help-links li + li { border-top: 1px solid var(--line); }
.help-links a { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; text-decoration: none; color: var(--ink); }
.help-links a:hover strong { color: var(--brand); }
.help-article { max-width: 760px; line-height: 1.65; }
.help-article h2 { margin-top: 1.4em; font-size: 1.2rem; }
.help-article h2:first-child { margin-top: 0; }
.help-article h3 { margin-top: 1.2em; }
.help-article ul, .help-article ol { padding-left: 1.4em; margin: 0 0 1em; }
.help-article li { margin-bottom: 6px; }
.help-article ol li::marker { font-weight: 700; color: var(--brand); }
.help-tip {
  margin: 0 0 1em; padding: 12px 14px; border-left: 4px solid var(--brand); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--brand) 7%, var(--surface));
}
.table td.neg { color: var(--err-ink); font-weight: 600; }
.table td.pos { color: var(--ok-ink); font-weight: 600; }

/* ---------- 1.11.0: Rollen ---------- */
.role-legend { display: grid; gap: 10px 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); margin: 0; }
.role-legend div { display: flex; flex-direction: column; }
.role-legend dt { font-weight: 700; }
.role-legend dd { margin: 0; color: var(--ink-2); font-size: .9rem; }
.team-row .chips { margin: 6px 0 0; }
.chip-extra { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.extra-roles { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
.extra-roles[disabled] { opacity: .45; }

/* ---------- 1.12.0: Mieterakte ---------- */
.drop-zone {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 28px 16px; cursor: pointer;
  border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface-2); transition: border-color .15s, background-color .15s;
}
.drop-zone > .icon { color: var(--brand); }
.drop-zone.is-over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.record-drop:has(input:focus-visible) .drop-zone { outline: 3px solid var(--focus); outline-offset: 2px; }
.drop-options { margin-top: 12px; }
.upload-progress { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; font-size: .88rem; }
.upload-progress li { padding: 6px 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
.upload-progress li.is-ok { background: var(--ok-bg); color: var(--ok-ink); }
.upload-progress li.is-error { background: var(--err-bg); color: var(--err-ink); }
.record-list { list-style: none; margin: 0; padding: 0; }
.record-row { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); }
.record-row:last-child { border-bottom: 0; }
.record-main { flex: 1; min-width: 0; display: flex; gap: 12px; padding: 12px 0; text-decoration: none; color: var(--ink); }
.record-main:hover strong { color: var(--brand); }
.record-icon { flex: none; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); }
.record-icon.kind-email { background: var(--info-bg); color: var(--info-ink); }
.record-icon.kind-contract { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.record-icon.kind-note { background: var(--warn-bg); color: var(--warn-ink); }
.record-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.record-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: .82rem; color: var(--ink-3); }
.record-snippet { font-size: .86rem; color: var(--ink-2); }
mark { background: color-mix(in srgb, #ffd400 55%, transparent); color: inherit; padding: 0 2px; border-radius: 3px; }
.record-text { white-space: normal; line-height: 1.6; margin-top: 14px; overflow-wrap: anywhere; }
.record-actions { margin-top: 12px; }
.record-actions form { margin: 0; }
.record-image { max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); }

/* ---------- 1.13.0: Vertragsunterlagen ---------- */
.cdoc-current { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 0; }
.cdoc-current > div { flex: 1 1 220px; display: flex; flex-direction: column; gap: 2px; }
.cdoc-history, .cdoc-upload { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 6px; }
.cdoc-history .list-row form { margin: 0; }

/* ---------- Nebenkosten ---------- */
.grow { flex: 1 1 auto; min-width: 0; }
.statement h1 { font-size: 1.35rem; margin: 18px 0 4px; }
.statement h2 { font-size: 1rem; margin: 22px 0 6px; }
.statement-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.statement-head img { max-width: 40%; height: auto; }
.statement .table td, .statement .table th { white-space: normal; }
.statement tfoot th { border-top: 2px solid var(--ink); }

/* ---------- Strom ---------- */
.input-sm { width: 7.5em; min-height: 40px; padding: 6px 8px; }
.table select { min-height: 40px; padding: 6px 8px; width: auto; }

/* ---------- Profilbild & Ansprechpartner ---------- */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; background: var(--surface-2); }
.avatar-lg { width: 72px; height: 72px; }
.avatar-xl { width: 112px; height: 112px; }
.avatar-initials { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--ink-2); border: 1px solid var(--line); }
.avatar-lg.avatar-initials { font-size: 1.4rem; }
.avatar-xl.avatar-initials { font-size: 2rem; }
.avatar-edit { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.chip-contact { background: var(--ok-bg); color: var(--ok-ink); }
.contact-grid { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.contact-card { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.contact-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.contact-body a { overflow-wrap: anywhere; }

/* ---------- Hausmeister-Bericht ---------- */
.print-only { display: none; }
@media print { .print-only { display: block; } }
.person { display: inline-flex; align-items: center; gap: 8px; }
.person .avatar { width: 28px; height: 28px; font-size: .75rem; }
.activity-table td { white-space: normal; vertical-align: top; }
.activity-table tr.is-done td { background: var(--ok-bg); }

/* ---------- Monatsbericht & Diagramme ---------- */
/* Reihenfarben: geprüfte Palette (Hell/Dunkel je eigene Stufe), Text bleibt in Textfarben */
:root { --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --viz-surface: var(--surface); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; } }
:root[data-theme="dark"] { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; }
.s1 { --c: var(--series-1); }
.s2 { --c: var(--series-2); }
.s3 { --c: var(--series-3); }
.viz { display: block; width: 100%; height: auto; overflow: visible; }
.viz-grid { stroke: var(--line); stroke-width: 1; }
.viz-base { stroke: var(--ink-3); }
.viz-tick, .viz-label, .viz-value { fill: var(--ink-3); font-size: 14px; font-family: inherit; }
.viz-label { fill: var(--ink-2); font-size: 15px; }
.viz-value { fill: var(--ink); font-size: 15px; font-weight: 600; }
.viz-fill { fill: var(--c); }
.viz-line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-dot { fill: var(--c); stroke: var(--viz-surface); stroke-width: 2; }
.viz-hit { fill: transparent; cursor: pointer; outline: none; }
.viz-hit:hover, .viz-hit:focus { fill: var(--ink); fill-opacity: .05; }
.viz-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 8px; padding: 0; font-size: .82rem; color: var(--ink-2); }
.viz-legend li { display: inline-flex; align-items: center; gap: 6px; }
.viz-swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--c); display: inline-block; }
.viz-tooltip { position: fixed; z-index: 50; pointer-events: none; max-width: 280px; padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--ink); color: var(--surface); font-size: .8rem; line-height: 1.35; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.viz-table { margin-top: 6px; }
.report-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-end; }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); margin-bottom: 16px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.kpi-label { font-size: .78rem; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 1.55rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .8rem; color: var(--ink-3); }
.kpi-delta { font-size: .78rem; color: var(--ink-2); }
.kpi-delta.is-up::first-letter, .kpi-delta.is-down::first-letter { font-size: .7rem; }
.report-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); margin-bottom: 16px; }
.report-grid > .card { margin: 0; }
.report-tenants td.wrap { white-space: normal; min-width: 120px; }
@media print {
  .report .card { break-inside: avoid; border: 1px solid #ccc; box-shadow: none; }
  .report-grid { grid-template-columns: 1fr 1fr; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .viz-hit { display: none; }
  .report-tenants .table { font-size: 9pt; }
  :root:root:root { --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --ink: #141414; --ink-2: #3b3b3b; --ink-3: #6e6e6e; --surface: #fff; --line: #ddd; }
}

.report-units { margin: -4px 0 16px; font-size: .9rem; color: var(--ink-2); }
.viz-fill.is-forecast { fill-opacity: .42; }
.viz-swatch.is-forecast { opacity: .42; }
.viz-swatch.is-hatch { background: repeating-linear-gradient(45deg, var(--c) 0 2px, transparent 2px 5px); border: 1px solid var(--c); }
.is-forecast-row td { color: var(--ink-2); font-style: italic; }

/* Druck/PDF immer hell – auch wenn am Bildschirm der Dunkelmodus aktiv ist */
@media print {
  :root:root:root {
  --brand: #2e2a86;
  --brand-hover: #24206c;
  --brand-ink: #ffffff;
  --ink: #141414;
  --ink-2: #4a4a4a;
  --ink-3: #6e6e6e;
  --bg: #f3f3f7;
  --surface: #ffffff;
  --surface-2: #f8f8f7;
  --line: #e2e2df;
  --focus: #2e2a86;
  --ok-bg: #e8f5ec;   --ok-ink: #17602f;
  --warn-bg: #fff5dc; --warn-ink: #7a5300;
  --err-bg: #fdecec;  --err-ink: #a3000b;
  --info-bg: #eef3fb; --info-ink: #1f4d8f;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 2px 8px rgb(0 0 0 / .04);
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --gutter: 16px;
  --topbar-h: 60px;
  --bottombar-h: 62px;
  --sidebar-w: 240px;
  color-scheme: light;
    color-scheme: light;
  }
  body { background: #fff; }
  .logo-light { display: block !important; }
  .logo-dark { display: none !important; }
}

/* ---------- Darstellung: Übersicht anpassen & Navigation sortieren ---------- */
.dash-toolbar { display: flex; justify-content: flex-end; margin: -6px 0 8px; }
.dash-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); align-items: stretch; }
.dash-item { position: relative; display: flex; flex-direction: column; min-width: 0; }
.dash-item > .tile { flex: 1; }
.dash-item.is-wide { grid-column: 1 / -1; }
.dash-item.is-mid { grid-column: span 2; }
/* Mauerwerk-Anordnung (Höhe je Kachel per JS in 8-px-Zeilen): Kacheln rücken nach oben, Lücken werden gefüllt */
.dash-grid.is-masonry { grid-auto-rows: 8px; grid-auto-flow: row dense; align-items: start; }
.dash-grid.is-masonry .dash-item { align-self: start; }
@media (max-width: 720px) { .dash-item.is-mid { grid-column: 1 / -1; } }
.dash-controls .dash-size { width: auto; padding: 0 8px; font-size: .8rem; white-space: nowrap; }
.dash-item > .card, .dash-item > .stats { margin: 0; }
.dash-controls { display: none; }
.dash-editing .dash-item { outline: 2px dashed var(--line); outline-offset: 3px; border-radius: var(--radius); }
.dash-editing .dash-item a { pointer-events: none; }
.dash-editing .dash-controls { display: flex; gap: 4px; justify-content: flex-end; order: -1; margin-bottom: 6px; }
.dash-controls button, .dash-handle {
  min-width: 36px; min-height: 36px; padding: 0 8px; font: inherit; font-size: 1rem; line-height: 1;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer;
}
.dash-handle { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.dash-item.is-dragging, .sort-list li.is-dragging { opacity: .55; outline: 2px solid var(--brand); }
.dash-catalog { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.dash-catalog li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.sort-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.sort-list li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.sort-list .sort-label { flex: 1; font-weight: 600; }
.sort-list .sort-main { display: none; }
.sort-list li.is-main { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.sort-list li.is-main .sort-main { display: inline-flex; }
.chip-object { background: var(--info-bg); color: var(--info-ink); }

/* ---------- Fotos & Schloss ---------- */
.photo-grid { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.photo-item { display: flex; flex-direction: column; gap: 4px; position: relative; }
.photo-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); display: block; }
.photo-item form { position: absolute; top: 4px; right: 4px; }
.photo-item form .btn { background: var(--surface); min-height: 34px; padding: 4px 8px; }
.photo-heic { display: flex; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 4 / 3; border: 1px dashed var(--line); border-radius: var(--radius-sm); font-size: .85rem; }
.lock-fields { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0; display: grid; gap: 10px; }
.lock-fields legend { padding: 0 6px; }

/* ---------- Personalverwaltung 0.1 ---------- */
.card-list { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); margin-bottom: 16px; }
.card-list > .card { margin: 0; }
.choices-stack { display: grid; gap: 8px; }
.choices-stack .check { align-items: flex-start; }
.copy-row { display: flex; flex-wrap: wrap; gap: 8px; }
.copy-row input { flex: 1 1 260px; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0; }
.nowrap { white-space: nowrap; }
.change-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; overflow-wrap: anywhere; }
.change-list del { color: var(--err-ink); }
.change-list ins { color: var(--ok-ink); text-decoration: none; }
.audit-table td { vertical-align: top; }
form.inline { display: inline-block; margin-left: 8px; }
.color-dot { display: inline-block; vertical-align: baseline; margin-right: 4px; }
.totp-setup { display: grid; gap: 16px; grid-template-columns: minmax(0, 220px) 1fr; align-items: start; margin-bottom: 16px; }
@media (max-width: 560px) { .totp-setup { grid-template-columns: 1fr; } }
.qr-box { background: #fff; border-radius: var(--radius-sm); padding: 4px; max-width: 220px; }
.qr-box svg.qr { display: block; width: 100%; height: auto; }
code.secret { font-size: 15px; letter-spacing: .04em; word-break: break-all; }
.recovery-codes { columns: 2; column-gap: 32px; font-size: 18px; line-height: 2; padding-left: 1.4em; }
@media print { .recovery-codes { columns: 2; } }

/* ---------- Organisation (0.3) ---------- */
.org-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; }
.org-head h2 { margin-bottom: 4px; }
.org-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.org-tree { list-style: none; margin: 12px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: grid; gap: 12px; }
.org-company > .org-tree { padding-left: 0; border-left: 0; }
.org-node { padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.org-node .org-tree { margin-top: 10px; }
.org-teams { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.org-team { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.org-team-main { flex: 1; min-width: 0; }
.is-inactive { opacity: .6; }

/* ---------- Rechte (0.4) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-size: 14px; }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip.is-active .muted { color: inherit; opacity: .8; }
.perm-group { margin: 20px 0 8px; font-size: 15px; color: var(--ink-2); }
.perm-list { display: grid; gap: 2px; }
.perm-row { display: grid; grid-template-columns: 1fr minmax(170px, 230px); gap: 6px 16px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.perm-row label { display: grid; gap: 2px; }
.perm-row select.is-set { border-color: var(--brand); font-weight: 600; }
@media (max-width: 560px) { .perm-row { grid-template-columns: 1fr; } }
.matrix td, .matrix th { white-space: nowrap; font-size: 13px; }

/* ---------- Personalakte (0.5) ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-bar input[type=search] { flex: 1 1 240px; min-width: 0; }
.filter-bar select { flex: 1 1 160px; min-width: 0; }
.person-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.person-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.person-row:hover { border-color: var(--brand); }
.person-main { flex: 1; min-width: 0; display: grid; }
.person-main .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-meta { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; }
@media (max-width: 560px) { .person-meta .muted { display: none; } }
.person-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.person-head h1 { margin: 0; }
section[id] { scroll-margin-top: calc(var(--topbar-h) + var(--sat) + 12px); }

/* ---------- Dokumente & Vermerke (0.6) ---------- */
.record-drop { display: grid; gap: 10px; margin: 8px 0 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.tag { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.doc-preview { display: block; max-width: 100%; max-height: 70vh; margin-top: 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.note { padding: 12px 14px; border-left: 3px solid var(--line); background: var(--surface-2); border-radius: var(--radius-sm); margin: 0 0 10px; }
.note-vertraulich { border-left-color: var(--warn-ink); }
.note header { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.note p { margin: 6px 0 0; white-space: normal; }

/* ---------- Abwesenheiten (0.7) ---------- */
:root { --abs-urlaub: #2e8b57; --abs-krank: #c0392b; --abs-sonder: #7a5ccc; --abs-schule: #d4881c; --abs-abwesend: #6b7280; }
.abs-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; vertical-align: -1px; }
.abs-dot.abs-urlaub, .abs.abs-urlaub { background: var(--abs-urlaub); }
.abs-dot.abs-krank, .abs.abs-krank { background: var(--abs-krank); }
.abs-dot.abs-sonder, .abs.abs-sonder { background: var(--abs-sonder); }
.abs-dot.abs-schule, .abs.abs-schule { background: var(--abs-schule); }
.abs-dot.abs-abwesend, .abs.abs-abwesend { background: var(--abs-abwesend); }
.abs-dot.abs-pending { background: repeating-linear-gradient(45deg, var(--abs-urlaub) 0 3px, transparent 3px 6px); border: 1px solid var(--abs-urlaub); }
.cal-nav { display: flex; align-items: center; gap: 10px; margin: 8px 0 12px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; color: var(--ink-2); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.cal { border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 100%; }
.cal th, .cal td { border-bottom: 1px solid var(--line); text-align: center; padding: 0; height: 30px; min-width: 26px; }
.cal thead th { position: sticky; top: 0; background: var(--surface); font-weight: 600; padding: 4px 0; line-height: 1.1; z-index: 2; }
.cal thead th span { display: block; font-weight: 400; color: var(--ink-3); font-size: 10px; }
.cal .cal-name { position: sticky; left: 0; z-index: 3; background: var(--surface); text-align: left; padding: 0 10px; min-width: 150px; max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; border-right: 1px solid var(--line); }
.cal .is-free, .cal th.is-weekend, .cal th.is-holiday { background: var(--surface-2); }
.cal th.is-holiday { color: var(--err-ink); }
.cal .is-today { box-shadow: inset 2px 0 0 var(--brand), inset -2px 0 0 var(--brand); }
.cal .abs { display: block; margin: 4px 2px; height: 20px; border-radius: 4px; }
.cal .abs.abs-pending { opacity: .55; background-image: repeating-linear-gradient(45deg, rgb(255 255 255 / .5) 0 3px, transparent 3px 6px); }
.cal .abs.abs-half { width: 50%; }
.days-result { margin: 0; font-weight: 600; color: var(--brand); min-height: 1.4em; }
.weekdays { display: flex; flex-wrap: wrap; gap: 4px 12px; border: 0; padding: 0; }
.weekdays legend { width: 100%; font-weight: 600; margin-bottom: 4px; }
.balance .stat-value { font-variant-numeric: tabular-nums; }

/* ---------- Auswertungen (0.8) ---------- */
.kpis { margin: 8px 0 12px; }
.kpis .stat-value { font-variant-numeric: tabular-nums; }
.report-title { margin: 16px 0 2px; }
.report-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); margin: 12px 0 16px; }
.report-grid > .card { margin: 0; break-inside: avoid; }
.report-grid h3, .card > h3 { margin-top: 0; }
.today-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.today-list li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; }
.open-items { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.open-item { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink); text-decoration: none; }
.open-item strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.open-item.is-zero strong { color: var(--ink-3); }
.print-page { background: #fff; color: #141414; }
.print-main { max-width: 1000px; margin: 0 auto; padding: 24px; }
.print-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 2px solid var(--brand); padding-bottom: 12px; margin-bottom: 8px; }
.print-head > div { text-align: right; }
.print-hint { background: var(--info-bg); color: var(--info-ink); padding: 8px 12px; border-radius: var(--radius-sm); }
.print-foot { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 8px; color: var(--ink-3); }
@media print {
  .no-print { display: none !important; }
  .print-main { padding: 0; max-width: none; }
  .report-grid { grid-template-columns: 1fr 1fr; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  @page { size: A4; margin: 14mm 12mm; }
}

/* Faktenlisten mit direkten dt/dd-Paaren: Bezeichnung links, Wert rechts (mobil untereinander) */
.facts:not(:has(> div)) { grid-template-columns: minmax(130px, max-content) minmax(0, 1fr); gap: 6px 18px; align-items: baseline; }
.facts:not(:has(> div)) dt { font-size: .85rem; }
.facts:not(:has(> div)) dd { font-weight: 500; overflow-wrap: anywhere; }
.facts .facts-heading { grid-column: 1 / -1; margin-top: 10px; font-size: .9rem; font-weight: 600; color: var(--ink); }
.field-heading { grid-column: 1 / -1; margin: 8px 0 -4px; font-size: 1rem; }
@media (max-width: 520px) {
  .facts:not(:has(> div)) { grid-template-columns: 1fr; gap: 2px; }
  .facts:not(:has(> div)) dd { margin-bottom: 8px; }
}

/* ---------- Nachrichten (0.9) ---------- */
.chat { display: flex; flex-direction: column; height: calc(100dvh - var(--topbar-h) - var(--sat) - var(--bottombar-h) - var(--sab) - 48px); min-height: 420px; }
@media (min-width: 900px) { .chat { height: calc(100dvh - var(--topbar-h) - var(--sat) - 48px); } }
.chat-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.chat-title { flex: 1; min-width: 0; display: grid; }
.chat-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-menu { position: relative; }
.chat-menu summary { list-style: none; }
.chat-menu summary::-webkit-details-marker { display: none; }
.chat-menu-panel { position: absolute; right: 0; top: 100%; z-index: 20; width: min(340px, 86vw); margin: 0; }
.chat-list { flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 12px 2px; display: flex; flex-direction: column; gap: 6px; overscroll-behavior: contain; }
.msg { display: flex; align-items: flex-end; gap: 8px; max-width: 86%; }
.msg.is-mine { align-self: flex-end; flex-direction: row-reverse; }
.avatar-sm { width: 30px; height: 30px; font-size: .7rem; }
.bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 8px 12px; display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.msg.is-mine .bubble { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); border-radius: 16px 16px 4px 16px; }
.msg.is-mine .bubble a { color: inherit; }
.msg-author { font-size: 12px; font-weight: 600; color: var(--brand); }
.msg-meta { font-size: 11px; opacity: .7; justify-self: end; display: inline-flex; gap: 6px; align-items: center; }
.msg-del { background: none; border: 0; color: inherit; cursor: pointer; padding: 0 2px; font-size: 11px; opacity: .8; }
.msg-image img { display: block; max-width: min(260px, 60vw); max-height: 260px; border-radius: 10px; }
.lightbox { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); background: rgb(0 0 0 / .88); }
.lightbox img { max-width: 100%; max-height: calc(100% - 64px); object-fit: contain; border-radius: 8px; }
.lightbox-bar { display: flex; gap: 10px; }
.lightbox-doc { justify-content: stretch; }
.lightbox-frame { flex: 1; width: 100%; max-width: 1000px; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; background: #fff; }
.lightbox-frame iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.phone { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.teams-call { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; background: rgb(75 83 188 / .14); color: #5B63D3; flex: none; }
.teams-call .icon { width: 18px; height: 18px; }
.teams-call:hover, .teams-call:focus-visible { background: #4B53BC; color: #fff; }
html.lightbox-open { overflow: hidden; }
.msg-file, .msg-link { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.msg-link { padding: 4px 8px; border-radius: 8px; background: rgb(0 0 0 / .06); }
.msg-day { align-self: center; font-size: 12px; color: var(--ink-3); margin: 8px 0; }
.msg-day span { background: var(--surface-2); padding: 2px 10px; border-radius: 999px; }
.msg-system { align-self: center; font-size: 12px; color: var(--ink-3); text-align: center; }
.msg-more { align-self: center; }
.chat-compose { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 6px; }
.chat-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-row textarea { flex: 1; resize: none; min-height: 44px; max-height: 200px; }
.chat-link { padding: 4px 8px; border-radius: 8px; background: var(--info-bg); color: var(--info-ink); }
.people-pick { list-style: none; margin: 6px 0 0; padding: 4px; max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.people-pick li { padding: 4px 6px; }
.person-row.is-unread strong { font-weight: 800; }
.chat-index .nav-badge, .person-meta .nav-badge { position: static; }
.unit-chat { margin-top: 12px; }

/* ---------- Verträge (1.0) ---------- */
.contract-preview { max-width: 820px; line-height: 1.55; }
.contract-preview .c-title { text-align: center; margin: 0 0 18px; }
.contract-preview h3 { margin: 18px 0 4px; font-size: 1rem; }
.contract-preview p { margin: 0 0 8px; }
.contract-preview .c-bullet { padding-left: 14px; }
mark.ph { background: #fff1a8; color: #4d3b00; padding: 0 3px; border-radius: 3px; }
.mono-area { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.5; }
.ph-list { display: grid; gap: 4px 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.contract-sign { border: 1px dashed var(--line); border-radius: var(--radius); padding: 12px; margin: 12px 0; display: grid; gap: 8px; }
.sign-canvas { width: 100%; max-width: 600px; aspect-ratio: 900 / 260; height: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); touch-action: none; cursor: crosshair; }
.contract-data { align-items: end; margin-bottom: 12px; }
tr.is-current td { background: var(--ok-bg); }

.list-main .badge, .list-main > .small .badge { justify-self: start; }

.mail-body { margin-top: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 8px; white-space: normal; overflow-wrap: anywhere; max-height: 32rem; overflow: auto; }

/* 1.0.2 Profilbilder */
.stack-sm { display: grid; gap: 8px; justify-items: start; flex: 1 1 220px; }
.stack-sm .hint { margin: 0; }
.user-link { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; border-radius: 999px; }
.user-link:hover .user-chip { color: var(--brand); }
.user-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.person-head form.inline { display: inline-block; margin-right: 6px; }

/* 1.1.0 Qualifikationen & Fristen */
.add-box { margin-top: 12px; }
.add-box > summary, .row-edit > summary { list-style: none; display: inline-flex; cursor: pointer; }
.add-box > summary::-webkit-details-marker, .row-edit > summary::-webkit-details-marker { display: none; }
.add-box[open] > form { margin-top: 12px; }
.row-edit[open] { flex-basis: 100%; display: grid; gap: 8px; padding-top: 8px; }
.list-row:has(> .row-edit[open]) { flex-wrap: wrap; }
.deadline-list .list-row { align-items: center; }
.deadline-date { min-width: 6.5em; font-variant-numeric: tabular-nums; font-weight: 600; }
.deadline-group { margin: 18px 0 6px; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }

/* 1.2.0 Aufgaben & Abläufe */
.task-check { flex: 0 0 auto; }
.check-btn { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: transparent; padding: 0; }
.check-btn .icon { width: 16px; height: 16px; }
.check-btn:hover, .check-btn:focus-visible { border-color: var(--ok-ink); color: var(--ok-ink); }
.check-btn.is-checked { background: var(--ok-bg); border-color: var(--ok-ink); color: var(--ok-ink); }
.task-list .is-done .list-main strong { text-decoration: line-through; color: var(--ink-3); font-weight: 500; }
.add-box-card > summary { margin: 0; }
.process { display: grid; gap: 6px; padding: 12px; margin: 0 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.process-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress-bar { display: block; height: 100%; background: var(--ok-ink); border-radius: inherit; width: 0; }
.progress-bar.w-5 { width: 5%; }
.progress-bar.w-10 { width: 10%; }
.progress-bar.w-15 { width: 15%; }
.progress-bar.w-20 { width: 20%; }
.progress-bar.w-25 { width: 25%; }
.progress-bar.w-30 { width: 30%; }
.progress-bar.w-35 { width: 35%; }
.progress-bar.w-40 { width: 40%; }
.progress-bar.w-45 { width: 45%; }
.progress-bar.w-50 { width: 50%; }
.progress-bar.w-55 { width: 55%; }
.progress-bar.w-60 { width: 60%; }
.progress-bar.w-65 { width: 65%; }
.progress-bar.w-70 { width: 70%; }
.progress-bar.w-75 { width: 75%; }
.progress-bar.w-80 { width: 80%; }
.progress-bar.w-85 { width: 85%; }
.progress-bar.w-90 { width: 90%; }
.progress-bar.w-95 { width: 95%; }
.progress-bar.w-100 { width: 100%; }
.comment-list .is-system { padding-top: 4px; padding-bottom: 4px; }
.pre-line { white-space: pre-line; }

/* 1.3.0 Personalgespräche */
.print-doc .table th { width: 30%; text-align: left; }
.sign-row { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 56px; font-size: .85rem; color: var(--ink-3); }
.sign-line-print { border-bottom: 1px solid #555; height: 40px; margin-bottom: 6px; }
.field > .label { font-weight: 600; font-size: .9rem; }

/* 1.4.0 Arbeitszeit */
.clock { display: grid; gap: 12px; }
.clock-status { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; }
.clock-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ink-3); flex: none; }
.clock-arbeit .clock-dot { background: var(--ok-ink); box-shadow: 0 0 0 4px var(--ok-bg); }
.clock-pause .clock-dot { background: var(--warn-ink); }
.clock-vergessen .clock-dot { background: var(--err-ink); }
.clock-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.clock-actions .btn { flex: 1 1 140px; min-height: 56px; font-size: 1.1rem; }
.time-table td, .time-table th { vertical-align: top; }
.time-table td.num, .time-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.time-table .neg { color: var(--err-ink); }
.time-table .pos { color: var(--ok-ink); }
.time-table tr.is-weekend td { background: var(--surface-2); }
.time-table tr.is-today td { box-shadow: inset 3px 0 0 var(--brand); }
.time-table tr.is-inactive td { opacity: .45; }
.time-table .nowrap { white-space: nowrap; }
.time-seg { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-variant-numeric: tabular-nums; }
.time-seg.is-request { color: var(--warn-ink); }
.time-seg .row-edit[open] { flex-basis: 100%; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; text-decoration: underline; font: inherit; }
.link-btn.small { font-size: .8rem; }
.warn-text { color: var(--warn-ink); }
pre.code { background: var(--surface-2); padding: 10px 12px; border-radius: var(--radius-sm); overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
@media (max-width: 600px) { .time-table th:nth-child(3), .time-table td:nth-child(3) { display: none; } }

/* 1.5.0 Lohn */
.payroll-list .list-main .small { display: block; }
.company-payroll + .company-payroll { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.callout-subtle ul { margin: 6px 0 0; padding-left: 18px; }

/* 1.6.0 Bewerber */
.stars { color: #d9a400; letter-spacing: 1px; white-space: nowrap; }
.rating-input { display: flex; flex-wrap: wrap; gap: 8px 14px; border: 0; padding: 0; margin: 0; }
.rating-input label { display: inline-flex; gap: 4px; align-items: center; color: #d9a400; }

/* 2.0.0 CRM */
.org-logo { width: 40px; height: 40px; border-radius: 8px; object-fit: contain; background: #fff; border: 1px solid var(--line); flex: 0 0 auto; }
.org-logo-lg { width: 64px; height: 64px; }
.org-logo-xl { width: 96px; height: 96px; border-radius: 12px; }
.org-initials { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; color: #fff; border: 0; letter-spacing: .02em; }
.org-logo-xl.org-initials { font-size: 1.8rem; }
.tone-0 { background: #2E2A86; } .tone-1 { background: #2E7D32; } .tone-2 { background: #1565C0; } .tone-3 { background: #EF6C00; }
.tone-4 { background: #6A1B9A; } .tone-5 { background: #00838F; } .tone-6 { background: #5D4037; } .tone-7 { background: #455A64; }
.org-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.org-head > div { flex: 1 1 260px; min-width: 0; }
.cat-line { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin: 4px 0 0; }
.cat-badge { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 4px 0 14px; border-bottom: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; padding: 10px 14px; font-weight: 600; font-size: .9rem; color: var(--ink-2); text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.tab.is-disabled { color: var(--ink-3); opacity: .55; cursor: default; }
.channel-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.channel-list li { display: grid; }
.assignment { padding: 12px 0; border-top: 1px solid var(--line); }
.assignment:first-of-type { border-top: 0; }
.assignment-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.repeat { display: grid; gap: 8px; }
.repeat-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.repeat-row select { flex: 0 1 130px; }
.repeat-row input:first-of-type { flex: 1 1 220px; min-width: 0; }
.input-md { flex: 0 1 200px; min-width: 0; }
.dup-item { display: block; }

/* 2.1.0 CRM Kontakte */
.contact-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); margin-bottom: 12px; }
.contact-card { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.contact-card.is-former { opacity: .65; }
.contact-main { display: grid; gap: 2px; flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.contact-card .row-edit[open] { flex-basis: 100%; }
.suggest { position: relative; display: block; }
.suggest-list { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: 4px 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 6px 20px rgb(0 0 0 / .15); max-height: 280px; overflow-y: auto; }
.suggest-list li { padding: 8px 12px; cursor: pointer; display: grid; }
.suggest-list li:hover, .suggest-list li.is-active { background: var(--surface-2); }
.suggest-list small { color: var(--ink-3); }
.suggest input.is-chosen { border-color: var(--ok-ink); }

/* 2.2.0 CRM Chronik */
.fav-form { display: inline; vertical-align: middle; }
.fav-btn { background: none; border: 0; cursor: pointer; font-size: 1.4rem; line-height: 1; color: var(--ink-3); padding: 0 4px; }
.fav-btn.is-on { color: #d9a400; }
.quick-note { display: grid; gap: 8px; margin-bottom: 14px; }
.quick-note-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.quick-note-bar select, .quick-note-bar input { flex: 0 1 auto; min-width: 0; }
.inline-details { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.inline-details[open] > summary { margin-right: 4px; }
.chronik-filter .chip { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline-item { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.timeline-item:first-child { border-top: 0; }
.timeline-icon { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--ink-2); }
.timeline-icon .icon { width: 16px; height: 16px; }
.kind-telefonat .timeline-icon { background: var(--ok-bg); color: var(--ok-ink); }
.kind-termin .timeline-icon, .kind-besuch .timeline-icon { background: var(--info-bg); color: var(--info-ink); }
.is-confidential .timeline-icon { background: var(--warn-bg); color: var(--warn-ink); }
.timeline-body { display: grid; gap: 2px; flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.timeline-body p { margin: 2px 0; }
.dash-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); align-items: start; }
.dash-grid .card { margin: 0; }

/* 2.3.0 CRM Dokumente */
.dropzone-lite { position: relative; display: flex; align-items: center; justify-content: center; text-align: center; min-height: 72px; padding: 14px; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--ink-2); cursor: pointer; }
.dropzone-lite:hover, .dropzone-lite:focus-within { border-color: var(--brand); color: var(--ink); }
.dropzone-lite input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.doc-icon { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--ink-2); }

/* 2.4.0 CRM Verträge */
.light { flex: 0 0 12px; width: 12px; height: 12px; border-radius: 50%; background: var(--ink-3); margin-top: 5px; align-self: flex-start; }
.light-ok { background: var(--ok-ink); } .light-bald { background: var(--warn-ink); } .light-faellig, .light-verpasst { background: var(--err-ink); }
.light-unbefristet { background: var(--info-ink); } .light-gekuendigt, .light-beendet, .light-entwurf { background: var(--line); }

/* 2.5.0 Globale Suche */
.topbar-search { position: relative; flex: 1 1 320px; max-width: 520px; margin: 0 16px; display: flex; align-items: center; }
.topbar-search input[type="search"] { width: 100%; min-height: 40px; padding: 6px 14px 6px 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2);
  -webkit-appearance: none; appearance: none; transition: padding-left .15s; }
.topbar-search input[type="search"]:focus { background: var(--surface); }
.topbar-search input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.topbar-search .search-ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-3); pointer-events: none; transition: opacity .15s; }
/* Ticket #25: Lupe verschwindet beim Tippen, der Text rückt nach links */
.topbar-search input[type="search"]:not(:placeholder-shown) { padding-left: 16px; }
.topbar-search input[type="search"]:not(:placeholder-shown) + .search-ic { opacity: 0; }
.topbar-search .suggest-list { top: calc(100% + 4px); }
.topbar-search .suggest-list a { display: grid; padding: 8px 12px; color: inherit; text-decoration: none; }
.topbar-search .suggest-list a:hover, .topbar-search .suggest-list a.is-active { background: var(--surface-2); }
.topbar-search .suggest-list .all { border-top: 1px solid var(--line); font-weight: 600; color: var(--brand); }
.snippet { color: var(--ink-2); }
kbd { font: inherit; font-size: .8em; padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); }
@media (max-width: 700px) { .topbar-search { order: 3; flex-basis: 100%; max-width: none; margin: 8px 0 0; } .topbar { flex-wrap: wrap; } }

/* 2.6.0 CRM Import */
.import-table tr.act-zusammenfuehren td { background: color-mix(in srgb, var(--info-bg) 60%, transparent); }
.import-table tr.act-pruefen td { background: color-mix(in srgb, var(--warn-bg) 60%, transparent); }
.import-table tr.act-ueberspringen td { opacity: .7; }
.import-table select { min-width: 160px; }

/* 2.7 Outlook */
.copy-code { display: inline-block; padding: .35rem .6rem; border: 1px solid var(--line); border-radius: 6px; user-select: all; overflow-wrap: anywhere; }
.mail-row .row-edit form { min-width: min(28rem, 100%); }

/* 2.12 Digitale Visitenkarte */
.vcard-button {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; cursor: pointer;
  border-radius: 50%; color: var(--ink-2); border: 1px solid var(--line); background: var(--surface); padding: 0;
}
.vcard-button:hover, .vcard-button:focus-visible { color: var(--brand); border-color: var(--brand); }
.vcard-dialog { border: 0; border-radius: 16px; padding: 0; width: min(380px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.vcard-dialog::backdrop { background: rgba(10, 10, 30, .45); }
.vcard { padding: 20px; display: grid; gap: 12px; }
.vcard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-left: 4px solid var(--brand); padding-left: 12px; }
.vcard-head h2 { margin: 0; font-size: 1.2rem; }
.vcard-role, .vcard-org { margin: 2px 0 0; color: var(--ink-2); font-size: .9rem; }
.vcard-qr { background: #fff; border-radius: 12px; padding: 8px; }
.vcard-qr svg { display: block; width: 100%; height: auto; }
.vcard-hint { margin: 0; text-align: center; font-size: .82rem; color: var(--ink-3); }
.vcard-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .9rem; }
.vcard-lines span { display: inline-block; min-width: 72px; color: var(--ink-3); }
@media (max-width: 560px) { .vcard-button { width: 36px; height: 36px; } }

/* 3.0 DMS */
.dms-layout { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 16px; align-items: start; }
.dms-side { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow: auto; padding: 10px; }
.dms-main { min-width: 0; }
.dms-tree, .dms-sub { list-style: none; margin: 0; padding: 0; }
.dms-sub { padding-left: 14px; border-left: 1px solid var(--line); margin-left: 8px; }
.dms-tree a { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 6px; color: inherit; text-decoration: none; min-height: 36px; }
.dms-tree a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.dms-tree a small { color: var(--ink-3); }
.dms-tree a:hover { background: var(--surface-2); }
.dms-tree a[aria-current="page"] { background: var(--brand); color: #fff; }
.dms-tree a[aria-current="page"] small { color: inherit; }
.dms-tree summary { list-style: none; cursor: pointer; }
.dms-tree summary::-webkit-details-marker { display: none; }
.dms-tree summary a::before { content: '▸'; font-size: .7rem; color: var(--ink-3); width: 10px; }
.dms-tree details[open] > summary a::before { content: '▾'; }
.dms-leaf a { padding-left: 22px; }
.dms-folders { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.dms-folders a { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: inherit; text-decoration: none; min-height: 44px; }
.dms-folders a:hover { border-color: var(--brand); }
.dms-folders small { margin-left: auto; color: var(--ink-3); }
.dms-preview { width: 100%; height: min(75vh, 900px); border: 1px solid var(--line); border-radius: 8px; margin-top: 12px; background: #fff; }
.dms-crumbs a { color: inherit; }
@media (max-width: 860px) {
  .dms-layout { grid-template-columns: 1fr; }
  .dms-side { position: static; max-height: 40vh; }
}

.icon-sm { width: 16px; height: 16px; flex: none; }

/* 3.4 Tickets */
.ticket-dialog { width: min(560px, calc(100vw - 32px)); }
.list-row.is-internal { background: var(--surface-2); }

/* 3.5 Nachrichten: Lesebestätigung, Support */
.msg-read { margin-left: 6px; font-size: .72rem; opacity: .75; white-space: nowrap; }
.msg-read.is-read { opacity: 1; color: #34c759; }
.msg.is-mine .msg-read.is-read { color: inherit; font-weight: 600; }
.avatar-support { background: var(--brand); color: #fff; }
.avatar-support .icon { width: 16px; height: 16px; }

/* 3.6 Abzeichen überall */
.nav-badge-alert { min-width: 20px; padding: 0; font-size: .8rem; }
.bottombar .nav-badge-alert { min-width: 18px; }

/* 3.6.1 Lange Listen: feste Höhe, im Kasten scrollen (Ticket #9) */
.scroll-box { max-height: 30rem; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding-right: 4px; margin-top: 8px;
  mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), transparent); -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), transparent); }
.scroll-box:not(:has(> :nth-child(8))) { max-height: none; mask-image: none; -webkit-mask-image: none; }
@media (max-width: 760px) { .scroll-box { max-height: 60vh; } }
.lock-avatar { display: flex; justify-content: center; color: var(--brand); margin: 8px 0 0; }

/* Melde- und Lohndaten (DATEV) je Beschäftigung */
.contract-data .datev-fields { grid-column: 1 / -1; }
.datev-fields > .grid-3 { margin-top: 10px; }
.daily-hours { display: flex; flex-wrap: wrap; gap: 8px 14px; border: 0; padding: 0; margin: 10px 0 0; }
.daily-hours label { display: inline-flex; align-items: center; gap: 4px; font-size: .9rem; }
.daily-hours input { width: 4.2em; }
.pay-list td.num, .pay-list th.num { text-align: right; white-space: nowrap; }

/* DATEV-Konten an der Firma */
.datev-account { margin: .4rem 0; }
.datev-account > summary { cursor: pointer; }
.datev-account .facts { margin: .4rem 0 .2rem; }

/* Physische Ordner */
.binder-no { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.binder-place { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: 1.05rem; }
.binder-list .list-row { align-items: center; gap: .6rem; }
.binder-pick { width: 1.15rem; height: 1.15rem; flex: none; }
.doc-original { display: inline-flex; align-items: center; gap: .35rem; }
.doc-original .icon { width: 1rem; height: 1rem; }
.company-logo-preview { max-width: 220px; max-height: 80px; background: #fff; padding: 4px; border-radius: 4px; }

/* Dokument per E-Mail (3.19.0) */
.doc-mail { margin: 12px 0 0; }
.doc-mail > summary { list-style: none; display: inline-flex; }
.doc-mail > summary::-webkit-details-marker { display: none; }
.doc-mail[open] > summary { margin-bottom: 12px; }
.doc-mail h3 { font-size: 1rem; margin: 0 0 4px; }
.doc-mail-share { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 0 0 14px; }
.doc-mail-form { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 0 0 10px; }

/* Fuhrpark (4.0.0) */
.check-grid { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin: 0 0 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }
.check-grid legend { padding: 0 4px; }

/* Fuhrpark: Freigabe-Matrix (4.3.0) */
.fleet-matrix th, .fleet-matrix td { text-align: center; }
.fleet-matrix th[scope="row"], .fleet-matrix thead th:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
.cell-tip > summary { list-style: none; cursor: pointer; display: inline-block; min-width: 2em; }
.cell-tip > summary::-webkit-details-marker { display: none; }
.cell-tip[open] > span { display: block; white-space: normal; max-width: 240px; margin-top: 4px; text-align: left; }

/* Fuhrpark: Mängelmeldung (4.5.0) */
.safety-check { padding: 10px 12px; border: 1px solid var(--err-bg); background: var(--err-bg); color: var(--err-ink); border-radius: var(--radius-sm); }

/* NFC (5.0.0) */
.nfc-box { margin: 8px 0 0; padding: 8px 10px; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.nfc-box .inline { display: inline; }
.code-block { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; overflow-x: auto; font-size: .85rem; white-space: pre-wrap; word-break: break-all; }
.quick-actions { flex-wrap: wrap; }

/* NFC: Mac-App koppeln (5.2.0) */
.pair-code { font-size: 2rem; font-weight: 700; letter-spacing: .12em; font-variant-numeric: tabular-nums; margin: 8px 0; }

/* Terminals (6.0.0) */
.qr-provision { background: #fff; display: inline-block; padding: 8px; border-radius: var(--radius-sm); }
.qr-provision svg { display: block; max-width: 100%; height: auto; }

/* Krankheitsauswertung in der Personalakte */
.sick-block { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.sick-block h3 { margin: 0 0 10px; }
.callout-warn { border-left-color: var(--warn-ink); }

.table-compact th, .table-compact td { padding: 6px 8px; font-size: .9rem; }

.bem-summary { white-space: normal; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 14px; font-size: .95rem; }

/* ---------- Fahrzeugaufkleber: Schnellmeldung & Werkstatt ---------- */
.quick-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); margin-bottom: 16px; }
.quick-tile { min-height: 0; }
details.quick-tile > summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
details.quick-tile > summary::-webkit-details-marker { display: none; }
details.quick-tile > summary > .icon { color: var(--brand); margin-bottom: 4px; }
details.quick-tile[open] { grid-column: 1 / -1; border-color: var(--brand); }
details.quick-tile[open] > summary { margin-bottom: 12px; }
.ws-defect { margin: 0 0 12px; padding: 14px; box-shadow: none; border: 1px solid var(--line); }
.ws-defect p { margin: 0; }
.ws-log { margin: 0; padding-left: 18px; color: var(--ink-3); }
.ws-foot { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.ws-code-value { font-size: 2rem; font-weight: 700; letter-spacing: .12em; font-variant-numeric: tabular-nums; margin: 6px 0; }
.quick-tile .choice span { color: var(--ink); font-size: .95rem; }
.quick-tile .choice input:checked + span { color: var(--surface); }

/* ---------- Mitarbeiterausweise ---------- */
.idcard-layout { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: start; }
.idcard-preview { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.pair-code.small-code { font-size: 1rem; letter-spacing: .02em; overflow-wrap: anywhere; }
tr.is-present td:first-child { box-shadow: inset 3px 0 0 var(--ok-ink, #1a7f37); }

.probe-banner { position: sticky; top: 0; z-index: 1000; background: #b45309; color: #fff; font-weight: 700; text-align: center; padding: 6px 12px; font-size: .9rem; }

.doc-thumb-link:empty { display: none; }
.doc-thumb { width: 48px; height: 64px; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: 4px; background: #fff; flex: 0 0 auto; }
