:root {
  --bg: #23262B;
  --card: #2E333A;
  --text: #E8ECF0;
  --muted: #A0A6B0;
  --line: #3A4048;
  --primary: #96E661;
  --primary-text: #1A1D22;
  --danger: #FF5A7A;
  --radius: 12px;
  --sidebar: #2E333A;
}

* { box-sizing: border-box; }
/* display:grid/flex na klasama poništava UA [hidden]{display:none} — mora eksplicitno */
[hidden] { display: none !important; }
html, body {
  margin: 0; padding: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100%;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(150,230,97,.12), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(58,110,165,.15), transparent 45%),
    var(--bg);
}

.login-card {
  width: min(400px, 100%);
  background: var(--card);
  border-radius: 16px;
  padding: 28px 24px;
  border: 1px solid var(--line);
}

.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand h1 { margin: 10px 0 4px; font-size: 1.5rem; }
.login-brand p { margin: 0; color: var(--muted); font-size: .85rem; }

.logo-mark {
  width: 52px; height: 52px; margin: 0 auto;
  border-radius: 12px; background: var(--bg);
  display: grid; place-items: center;
  color: var(--primary); font-size: 1.4rem;
}
.logo-mark.sm { width: 40px; height: 40px; margin: 0; font-size: 1.1rem; }

.field { display: block; margin-bottom: 14px; }
.field span { display: block; color: var(--muted); font-size: .8rem; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
  font: inherit;
}
.field textarea { min-height: 100px; resize: vertical; }

.btn {
  border: 0; border-radius: 10px; padding: 12px 16px;
  font: inherit; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.primary { background: var(--primary); color: var(--primary-text); width: 100%; }
.btn.secondary { background: var(--line); color: var(--text); }
.btn.small { padding: 8px 12px; width: auto; font-size: .9rem; }
.error { color: var(--danger); font-size: .9rem; margin: 0 0 12px; }

.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.mobile-topbar { display: none; }
.menu-close { display: none; }
.sidebar-backdrop { display: none; }
.sidebar {
  background: var(--sidebar); padding: 20px 0 16px;
  display: flex; flex-direction: column; gap: 8px;
  border-right: 1px solid var(--line);
}
.side-brand {
  display: flex; gap: 10px; align-items: center;
  padding: 0 12px 12px; min-height: 70px;
}
.logo-box {
  width: 48px; height: 48px; border-radius: 8px;
  background: var(--bg); flex-shrink: 0;
  display: grid; place-items: center; overflow: hidden;
}
.sidebar-logo {
  width: 100%; height: 100%; object-fit: contain; padding: 4px;
}
.side-brand-text { min-width: 0; }
.firma {
  font-weight: 600; font-size: 14px; line-height: 1.25;
  color: #fff; word-break: break-word;
}
.sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.nav {
  position: relative; display: flex; flex-direction: column;
  gap: 10px; flex: 1; padding: 10px 0 0; margin: 0;
}
.nav-indicator {
  position: absolute; right: 0; width: 6px; height: 28px;
  background: var(--primary); border-radius: 3px 0 0 3px;
  top: 10px; transition: top 0.18s ease;
  pointer-events: none;
}
.nav-item {
  background: transparent; border: 0; color: var(--text);
  text-align: left; padding: 6px 18px; border-radius: 0;
  font: inherit; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
}
.nav-item .nav-icon {
  width: 28px; flex-shrink: 0; text-align: center; font-size: 22px; line-height: 1;
}
.nav-item:hover { background: rgba(255,255,255,.04); }
.nav-item.active { background: transparent; color: #fff; }
.nav-item.logout { color: var(--text); font-size: 18px; }
.nav-item.logout .nav-icon { color: var(--danger); }
.side-foot { border-top: 1px solid var(--line); padding: 12px 0 0; margin-top: auto; }
.user { color: var(--muted); font-size: .8rem; margin-bottom: 8px; padding: 0 12px; }

.main { padding: 28px; }
.view h2 { margin: 0; font-size: 1.6rem; }
.lead { color: var(--muted); margin: 8px 0 20px; }
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}
.tile {
  background: var(--card); border: 0; border-radius: var(--radius);
  padding: 18px 12px; min-height: 110px; color: var(--text);
  cursor: pointer; text-align: center; font: inherit;
}
.tile:hover { outline: 1px solid var(--primary); }
.tile .icon { font-size: 1.6rem; margin-bottom: 8px; }
.tile .t { font-weight: 650; font-size: .95rem; }
.tile .d { color: var(--muted); font-size: .75rem; margin-top: 4px; }

.back {
  background: transparent; border: 0; color: var(--primary);
  font: inherit; cursor: pointer; padding: 0; margin-bottom: 10px;
}
.module-body {
  background: var(--card); border-radius: var(--radius);
  padding: 18px; border: 1px solid var(--line);
}
.module-body:has(.pat-wpf),
.module-body:has(.doku-wpf),
.module-body:has(.ki-a) {
  padding: 0; background: transparent; border: 0;
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left; padding: 10px 8px;
  border-bottom: 1px solid var(--line); font-size: .92rem;
}
.table th { color: var(--muted); font-weight: 600; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.hint { color: var(--muted); font-size: .85rem; }
.hint.ok { color: var(--primary); }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: rgba(150,230,97,.15); color: var(--primary); font-size: .75rem;
}

/* Patienten — WPF order/layout */
.pat-wpf {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 14px;
}
.pat-top {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}
.pat-list-block { min-width: 0; }
.pat-items {
  height: 90px;
  overflow: auto;
  background: #2E333A;
  border: 1px solid var(--line);
  border-radius: 4px;
  margin-bottom: 8px;
}
.pat-item {
  display: block; width: 100%; text-align: left;
  border: 0; border-bottom: 1px solid #3A4048;
  background: transparent; color: #fff;
  padding: 8px 10px; font: inherit; font-size: .9rem; cursor: pointer;
}
.pat-item:hover, .pat-item.active { background: #4A5360; }
.pat-search {
  width: 100%; padding: 8px 10px; border-radius: 4px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit;
}
.stam-title {
  margin: 0 0 12px; color: #fff; font-size: 14px; font-weight: 650;
}
.stam-2col, .pflege-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}
.wpf-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.pflege-2col .wpf-row { grid-template-columns: 130px 1fr; }
.wpf-label { color: var(--muted); font-size: .82rem; }
.wpf-label.inline { white-space: nowrap; margin: 0 6px; }
.wpf-ctrl {
  width: 100%; height: 36px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 4px;
  background: #2E333A; color: #fff; font: inherit;
}
textarea.wpf-ctrl { height: auto; min-height: 160px; resize: vertical; }
.geb-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 6px;
}
.beihilfe-row {
  display: grid;
  grid-template-columns: 1fr auto 70px;
  align-items: center;
}
.beihilfe-row .hoehe { width: 70px; }
.la-head { margin-bottom: 6px; }
.la-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  background: #2E333A;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px 10px;
  margin-bottom: 10px;
}
.la-col { display: flex; flex-direction: column; gap: 6px; }
.check { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: #fff; }
.wpf-area { display: flex; flex-direction: column; gap: 8px; }
.wpf-tabs {
  display: flex; flex-wrap: wrap; gap: 0;
  margin: 16px 0 0;
  border-bottom: 1px solid var(--line);
}
.wpf-tabs .tab {
  background: transparent; border: 0; border-bottom: 3px solid transparent;
  color: var(--muted); border-radius: 0; padding: 10px 12px;
  font: inherit; font-size: .82rem; cursor: pointer;
}
.wpf-tabs .tab.active {
  color: #fff; border-bottom-color: var(--primary); background: transparent;
}
.tab-panel { padding: 14px 0 8px; min-height: 220px; }
.pat-footer {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.btn-save {
  background: #7B5CFF; color: #fff; border: 0; border-radius: 8px;
  padding: 14px; font-weight: 700; cursor: pointer; font: inherit;
}
.btn-cancel {
  background: #3A4048; color: #fff; border: 0; border-radius: 8px;
  padding: 14px; font-weight: 700; cursor: pointer; font: inherit;
}
.btn-delete {
  background: #C8CDD4; color: #5B616A; border: 0; border-radius: 8px;
  padding: 14px; font-weight: 700; cursor: pointer; font: inherit;
}
.btn-delete:disabled { opacity: .45; cursor: not-allowed; }
.ben-list { height: 140px; }
.ben-check {
  display: flex; align-items: center; gap: 8px;
  margin: 14px 0 6px; color: var(--muted); font-size: .9rem;
}
.ben-check input { width: auto; margin: 0; }
.doc-row {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.file-btn { cursor: pointer; margin: 0; }

/* Pflegedoku — WPF dark theme */
.doku-wpf {
  --doku-bg: #1a1d22;
  --doku-panel: #252830;
  --doku-card: #2c313a;
  --doku-line: #3a404a;
  --doku-text: #f0f2f5;
  --doku-muted: #a8b0bc;
  --doku-muss: #e67e22;
  --doku-ok: #8bc34a;
  --doku-chip: #3b82c4;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--doku-text);
}
.doku-wpf .wpf-label { color: var(--doku-muted); }
.doku-wpf .wpf-ctrl {
  background: var(--doku-panel);
  border-color: var(--doku-line);
  color: var(--doku-text);
}
.doku-top { max-width: 420px; }
.doku-search-block { position: relative; }
.doku-combo { position: relative; }
.doku-pat-list {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 4px);
  z-index: 40;
  max-height: 280px;
  overflow: auto;
  background: #2c313a;
  border: 1px solid var(--doku-line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0,0,0,.35);
}
.doku-pat-list[hidden] { display: none !important; }
.doku-pat-item {
  display: block; width: 100%; text-align: left;
  border: 0; background: transparent; color: #fff;
  padding: 10px 12px; font: inherit; font-size: .9rem;
  cursor: pointer; border-bottom: 1px solid rgba(255,255,255,.05);
}
.doku-pat-item:hover, .doku-pat-item:focus {
  background: rgba(150,230,97,.12);
  outline: none;
}
.doku-pat-item:last-child { border-bottom: 0; }
.doku-pat-empty {
  padding: 12px; color: var(--doku-muted); font-size: .88rem;
}
.doku-empty {
  padding: 28px 16px;
  color: var(--doku-muted);
  border: 1px dashed var(--doku-line);
  border-radius: 10px;
  background: var(--doku-panel);
}
.doku-card {
  display: flex; gap: 14px; align-items: center;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--doku-card);
  border: 1px solid var(--doku-line);
}
.doku-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--doku-ok); color: #111; font-weight: 800; font-size: 1.05rem;
  flex-shrink: 0;
}
.doku-name { font-size: 1.2rem; font-weight: 700; color: #fff; }
.doku-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.doku-badges .badge {
  font-size: .75rem; padding: 3px 9px; border-radius: 6px;
  background: #3a404a; color: #d7dbe2;
}
.doku-badges .badge.sgb {
  background: var(--doku-ok); color: #111; font-weight: 700;
}
.doku-card .hint { color: var(--doku-muted); }
.doku-content {
  display: grid; grid-template-columns: 42px 1fr; gap: 0;
  border-radius: 10px; overflow: hidden;
  background: var(--doku-bg);
  border: 1px solid var(--doku-line);
  min-height: 420px;
}
.doku-rail {
  background: #2a2f38; color: #fff;
  writing-mode: vertical-rl; transform: rotate(180deg);
  display: grid; place-items: center;
  font-size: .78rem; font-weight: 600; letter-spacing: .04em;
  padding: 12px 0;
}
.doku-list {
  padding: 6px 0 12px;
  overflow: auto;
  max-height: 62vh;
  scrollbar-color: #5a6270 transparent;
}
.doku-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 7px 14px;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.doku-row.clickable { cursor: pointer; }
.doku-row.clickable:hover { background: rgba(255,255,255,.04); }
.doku-check {
  width: 18px; color: var(--doku-ok); font-weight: 800; text-align: center;
  font-size: .95rem;
}
.doku-title { flex: 1; min-width: 180px; font-size: .9rem; }
.doku-title.pflicht { color: var(--doku-muss); font-weight: 700; }
.doku-title.optional { color: #fff; font-weight: 500; }
.doku-title.child { font-weight: 400; color: #fff; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.doku-wpf .chip {
  border: 0;
  background: var(--doku-chip);
  color: #fff;
  border-radius: 4px;
  padding: 3px 9px;
  font-size: .72rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset -3px 0 0 0 var(--doku-ok);
}
.doku-wpf .chip.ok {
  background: var(--doku-ok);
  color: #111;
  box-shadow: none;
}
.doku-wpf .chip.light {
  background: #f2f4f7;
  color: #1a1d22;
  box-shadow: none;
}
.doku-legend {
  display: flex; flex-wrap: wrap; gap: 16px;
  padding: 14px 14px 4px;
  font-size: .8rem; font-weight: 600;
}
.doku-legend .leg-ok { color: var(--doku-ok); }
.doku-legend .leg-muss { color: var(--doku-muss); }
.doku-legend .leg-muss::before,
.doku-legend .leg-opt::before {
  content: "";
  display: inline-block;
  width: 10px; height: 10px;
  margin-right: 6px;
  vertical-align: -1px;
  border-radius: 1px;
}
.doku-legend .leg-muss::before { background: var(--doku-muss); }
.doku-legend .leg-opt { color: #fff; }
.doku-legend .leg-opt::before { background: #fff; }
.doku-stand {
  padding: 4px 14px 10px;
  color: #8b929c;
  font-size: .78rem;
}
.doku-modal {
  position: fixed; inset: 0; background: rgba(8,10,14,.65);
  display: grid; place-items: center; z-index: 50; padding: 16px;
}
.doku-modal[hidden] { display: none !important; }
.doku-dialog {
  width: min(520px, 100%); max-height: 90vh; overflow: auto;
  background: var(--doku-card); color: var(--doku-text);
  border: 1px solid var(--doku-line);
  border-radius: 12px; padding: 18px;
  box-shadow: 0 16px 40px rgba(0,0,0,.45);
}
.doku-dialog h3 { margin: 0 0 12px; color: #fff; }
.doku-dialog .field { display: grid; gap: 4px; margin-bottom: 10px; }
.doku-dialog .field span { font-size: .78rem; color: var(--doku-muted); }
.doku-dialog input, .doku-dialog textarea {
  font: inherit; padding: 8px 10px;
  border: 1px solid var(--doku-line); border-radius: 8px;
  background: var(--doku-bg); color: var(--doku-text);
}
.doku-dialog .actions { margin-top: 12px; display: flex; justify-content: flex-end; }

/* KI-Analyse — Berichte-Analyse mit KI (WPF layout) */
#view-module:has(.ki-a) > #moduleTitle,
#view-module:has(.ki-a) > #moduleLead { display: none; }
#view-module:has(.ki-a) {
  background: #23262B;
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
}
#view-module:has(.ki-a) > .back {
  margin: 12px 16px 0;
}
.module-body:has(.ki-a) {
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
}

.ki-a {
  --ki-bg: #23262B;
  --ki-panel: #2E333A;
  --ki-line: #3A4048;
  --ki-text: #E8ECF0;
  --ki-muted: #A0A6B0;
  --ki-sub: #7A818C;
  --ki-green: #96E661;
  --ki-blue: #3A6EA5;
  --ki-yellow: #E6C261;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 0 16px;
  color: var(--ki-text);
  background: var(--ki-bg);
  min-height: 640px;
}
.ki-a-head {
  background: var(--ki-panel);
  padding: 14px 18px;
  border-bottom: 1px solid var(--ki-line);
}
.ki-a-title { display: flex; gap: 12px; align-items: flex-start; }
.ki-a-spark { color: var(--ki-green); font-size: 1.35rem; line-height: 1.2; }
.ki-a-title h3 { margin: 0; font-size: 1.12rem; font-weight: 700; color: #fff; }
.ki-a-sub { margin: 4px 0 0; color: var(--ki-muted); font-size: .82rem; }

.ki-a-toolbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  align-items: end;
  background: var(--ki-panel);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 16px 18px 0;
}
.ki-a-field { display: grid; gap: 4px; }
.ki-a-field-grow { min-width: 0; }
.ki-a-field span { font-size: 11px; color: #C8CDD4; }
.ki-a-field select {
  font: inherit; height: 36px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--ki-line); background: var(--ki-panel); color: #fff;
  width: 100%;
}
.ki-a-chips { display: flex; gap: 8px; }
.ki-chip {
  width: 96px; height: 34px;
  border: 1px solid var(--ki-line); background: var(--ki-panel); color: #fff;
  border-radius: 8px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.ki-chip.on { background: var(--ki-green); color: #1A1D22; border-color: var(--ki-green); }
.ki-a-actions { display: flex; gap: 8px; align-items: end; }
.ki-btn-blue {
  background: var(--ki-blue) !important; color: #fff !important;
  width: auto !important; height: 36px; padding: 0 16px !important;
  border-radius: 8px; font-weight: 600;
}
.ki-btn-green {
  background: var(--ki-green) !important; color: #1A1D22 !important;
  width: auto !important; height: 36px; padding: 0 14px !important;
  border-radius: 8px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 8px;
}
.ki-star { font-size: 14px; line-height: 1; }

.ki-a-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 14px;
  align-items: start;
  margin: 16px 18px 0;
}
.ki-a-left, .ki-a-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* KPI — UniformGrid 4 cols inside left column (WPF) */
.ki-a-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.ki-kpi {
  background: var(--ki-panel);
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 78px;
}
.ki-kpi .l {
  color: var(--ki-muted);
  font-size: 11px;
  line-height: 1.2;
}
.ki-kpi .v {
  font-size: 26px;
  font-weight: 600;
  line-height: 1.15;
  margin: 4px 0 0;
  color: #fff;
}
.ki-kpi .s {
  color: var(--ki-sub);
  font-size: 11px;
  margin-top: 2px;
  line-height: 1.25;
}

.ki-panel {
  background: var(--ki-panel);
  border: 0;
  border-radius: 10px;
  padding: 12px 14px;
}
.ki-panel-h {
  font-weight: 700; margin-bottom: 10px; color: #fff;
  display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap;
}
.ki-panel-h .hint { font-weight: 400; color: var(--ki-muted); font-size: .78rem; }
.ki-chart-leg {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin-top: 8px; font-size: .78rem; color: var(--ki-muted);
}
.ki-chart-leg .dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
  margin-right: 4px; vertical-align: -1px;
}
.ki-chart-leg .dot.green { background: var(--ki-green); }
.ki-chart-leg .dot.yellow { background: var(--ki-yellow); }
.ki-dist { margin-left: auto; }
#kiChart { width: 100%; display: block; background: #1A1D22; border-radius: 8px; }
.ki-rank {
  width: 100%; text-align: left; border: 0; cursor: pointer;
  background: #23262B; color: inherit; border-radius: 8px;
  padding: 10px 12px; margin-bottom: 8px;
}
.ki-rank:hover { outline: 1px solid var(--ki-green); }
.ki-rank-top { display: flex; justify-content: space-between; gap: 8px; }
.ki-rank-sub { color: var(--ki-muted); font-size: .78rem; margin: 4px 0 8px; }
.ki-bar { height: 6px; background: #1A1D22; border-radius: 99px; overflow: hidden; }
.ki-bar i { display: block; height: 100%; border-radius: 99px; }
.ki-bericht-list { max-height: 360px; overflow: auto; display: grid; gap: 8px; }
.ki-bericht {
  border-radius: 8px; padding: 10px 12px;
  border-left: 4px solid #E85D5D;
}
.ki-bericht-top {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px;
}
.ki-bericht-top .ki-meta, .ki-ampel { font-size: .78rem; color: var(--ki-muted); }
.ki-bericht-top .ki-score { margin-left: auto; font-weight: 700; }
.ki-bericht p { margin: 0; font-size: .88rem; color: #d7dbe2; line-height: 1.35; }
.ki-empty, .ki-placeholder { color: var(--ki-muted); font-size: .88rem; line-height: 1.45; }
.ki-src-berichte { margin-top: .75rem; font-size: .82rem; color: var(--ki-muted); }
.ki-src-berichte ul { margin: .35rem 0 0; padding-left: 1.1rem; }
.ki-src-berichte li { margin-bottom: .35rem; line-height: 1.35; }
.ki-status { font-weight: 400; color: var(--ki-muted); font-size: .8rem; margin-left: auto; }
.ki-status.err { color: #E85D5D; }
.ki-lage { margin: 0 0 8px; color: #fff; }
.ki-trend { margin: 0 0 8px; color: var(--ki-yellow); font-size: .9rem; }
.ki-risks { margin: 0 0 10px; padding-left: 18px; color: #ffb4b4; font-size: .85rem; }
.ki-mass {
  background: #23262B; border-radius: 8px; padding: 10px; margin-bottom: 8px;
}
.ki-mass-top { display: flex; justify-content: space-between; gap: 8px; }
.ki-mass p { margin: 6px 0 0; font-size: .88rem; color: #d7dbe2; }
.ki-prio { font-size: .75rem; font-weight: 700; text-transform: uppercase; }
.ki-pdl { margin: 8px 0 0; color: var(--ki-muted); font-size: .85rem; }

@media (max-width: 1100px) {
  .ki-a-toolbar { grid-template-columns: 1fr; }
  .ki-a-actions { justify-content: flex-start; }
}
@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 10px 14px;
    background: var(--sidebar);
    border-bottom: 1px solid var(--line);
  }
  .menu-toggle {
    width: 42px; height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    padding: 0;
  }
  .menu-toggle-bars,
  .menu-toggle-bars::before,
  .menu-toggle-bars::after {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    content: "";
  }
  .menu-toggle-bars { position: relative; }
  .menu-toggle-bars::before { position: absolute; top: -6px; left: 0; }
  .menu-toggle-bars::after { position: absolute; top: 6px; left: 0; }
  .mobile-topbar-title { min-width: 0; }
  .mobile-firma {
    font-weight: 650; font-size: 14px; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mobile-sub {
    color: var(--muted); font-size: 11px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(8, 10, 14, .55);
    z-index: 45;
  }
  .sidebar-backdrop[hidden] { display: none !important; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(280px, 86vw);
    z-index: 50;
    transform: translateX(-105%);
    transition: transform .2s ease;
    border-right: 1px solid var(--line);
    box-shadow: 8px 0 28px rgba(0,0,0,.35);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open { overflow: hidden; }

  .menu-close {
    display: grid;
    place-items: center;
    margin-left: auto;
    width: 36px; height: 36px;
    border: 0; border-radius: 8px;
    background: transparent; color: var(--muted);
    font-size: 18px; cursor: pointer; flex-shrink: 0;
  }
  .menu-close:hover { background: rgba(255,255,255,.06); color: #fff; }

  .nav { flex-direction: column; flex: 1; width: auto; }
  .nav-indicator { display: block; }
  .side-foot { width: auto; display: block; }
  .main { padding: 16px 14px 28px; }
  .view h2 { font-size: 1.35rem; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
  .tile { min-height: 96px; padding: 14px 10px; }
  .home-tab { padding: 8px 12px; margin-right: 4px; font-size: 13px; }
  .home-berichte-list { max-height: none; }
  .home-bericht-body { grid-template-columns: 1fr auto; padding: 10px; }
  .home-dialog { max-height: 90vh; padding: 14px; }
  .pat-top, .stam-2col, .pflege-2col, .pat-footer, .la-box { grid-template-columns: 1fr; }
  .wpf-row, .pflege-2col .wpf-row { grid-template-columns: 1fr; gap: 4px; }
  .ki-a-grid { grid-template-columns: 1fr; }
  .ki-a-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ki-a-actions { flex-wrap: wrap; }
  .module-body { padding: 12px; }
}
@media (max-width: 520px) {
  .ki-a-kpis { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Home — Berichten feed (WPF) */
.home-tiles { margin-bottom: 8px; }
.home-tabs { margin-top: 8px; }
.home-tab-bar {
  display: flex; gap: 0; border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.home-tab {
  background: transparent; border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted); font: inherit; font-size: 14px; font-weight: 600;
  padding: 8px 16px; margin-right: 8px; cursor: pointer;
}
.home-tab.active {
  color: #fff;
  border-bottom-color: var(--primary);
}
.home-tab-panel { min-height: 200px; }
.home-tab-empty {
  color: var(--muted); font-size: 13px;
  text-align: center; padding: 32px 16px;
}
.home-berichte-list {
  max-height: min(52vh, 520px);
  overflow: auto;
  display: grid; gap: 8px;
  padding-right: 4px;
}
.home-bericht-card {
  display: grid;
  grid-template-columns: 6px 1fr;
  border: 1px solid;
  border-radius: 10px;
  overflow: hidden;
}
.home-bericht-stripe { border-radius: 10px 0 0 10px; }
.home-bericht-body {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 12px 10px 12px 12px;
}
.home-bericht-open {
  background: transparent; border: 0; color: inherit;
  text-align: left; cursor: pointer; padding: 0; font: inherit;
  min-width: 0;
}
.home-bericht-name {
  color: #fff; font-size: 14px; font-weight: 600;
}
.home-bericht-meta {
  color: var(--muted); font-size: 12px; margin-top: 4px;
}
.home-bericht-label {
  font-size: 11px; font-weight: 600; margin-top: 4px;
}
.home-bericht-text {
  color: #e2e6ed;
  font-size: 13px;
  line-height: 1.45;
  margin-top: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}
.home-bericht-dismiss {
  width: 32px; height: 32px; border: 0; border-radius: 6px;
  background: #505A6B; color: #fff; cursor: pointer;
  font-size: 14px; line-height: 1; flex-shrink: 0;
  margin-top: 2px;
}
.home-bericht-dismiss:hover { background: #5f6a7c; }
.home-modal {
  position: fixed; inset: 0; background: rgba(8,10,14,.65);
  display: grid; place-items: center; z-index: 60; padding: 16px;
}
.home-modal[hidden] { display: none !important; }
.home-dialog {
  width: min(560px, 100%); max-height: 85vh; overflow: auto;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px;
}
.home-dialog-head {
  display: flex; justify-content: space-between; gap: 12px; align-items: flex-start;
}
.home-dialog-head h3 { margin: 0; color: #fff; }
.home-dialog-label { font-weight: 600; font-size: .9rem; margin: 8px 0; }
.home-dialog-text {
  white-space: pre-wrap; line-height: 1.45; color: #d7dbe2;
  font-size: .92rem; margin-bottom: 14px;
}
