:root {
  --bg: #f3f7fb;
  --panel: #ffffff;
  --line: #d9e2ec;
  --text: #1d2430;
  --muted: #657084;
  --brand: #0e8f83;
  --brand-2: #2764d8;
  --brand-3: #f59e0b;
  --danger: #a33b3b;
  --warning: #a86913;
  --ok: #276749;
  --shadow: 0 18px 45px rgba(31, 45, 61, 0.10);
  --soft-shadow: 0 10px 26px rgba(31, 45, 61, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #eef7f8 0%, #f8fbff 36%, #f3f7fb 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

a {
  color: var(--brand-2);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, #102338 0%, #183b4c 56%, #175e59 100%);
  color: #fff;
  padding: 20px 16px;
  box-shadow: 10px 0 30px rgba(18, 35, 55, 0.12);
}

.brand {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 22px;
}

.nav-group {
  margin: 18px 0 7px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.nav-list a {
  display: block;
  color: #dce5ee;
  text-decoration: none;
  padding: 9px 10px;
  border-radius: 6px;
}

.nav-list a:hover,
.nav-list a.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.main {
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.page-title {
  font-size: 28px;
  margin: 0;
  letter-spacing: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--soft-shadow);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric {
  display: grid;
  gap: 4px;
}

.metric strong {
  font-size: 24px;
}

.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #344055;
  font-size: 13px;
  background: #f1f4f7;
}

.btn,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font: inherit;
}

.btn.primary,
button.primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 22px rgba(39, 100, 216, 0.22);
}

.btn.ghost {
  background: #f4f8fb;
}

.btn.danger,
button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #c9d1dc;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-height: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

textarea {
  min-height: 90px;
}

label {
  display: grid;
  gap: 5px;
  color: #2e3949;
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-static-field {
  display: grid;
  gap: 3px;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid rgba(20, 82, 74, 0.16);
  border-radius: 8px;
  background: #eef8f3;
}

.form-static-field strong {
  color: #123d38;
}

.form-static-field small {
  color: #27615a;
  font-weight: 600;
}

.table-search {
  margin-bottom: 10px;
  min-height: 34px;
  background: rgba(255, 255, 255, 0.92);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 12px;
  background: #e8edf2;
  color: #293544;
}

.badge.ok {
  background: #dceee5;
  color: var(--ok);
}

.badge.warn {
  background: #fff0cf;
  color: var(--warning);
}

.badge.danger {
  background: #f7dddd;
  color: var(--danger);
}

.flash {
  padding: 11px 14px;
  border-radius: 7px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.flash.success {
  border-color: #acd5bf;
  background: #eef8f2;
}

.flash.error {
  border-color: #e0b0b0;
  background: #fff0f0;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 460px);
  align-items: center;
  justify-content: center;
  gap: 44px;
  padding: 24px;
  background:
    linear-gradient(135deg, #0e8f83 0%, #2764d8 58%, #f59e0b 100%);
}

.login-box {
  width: min(420px, 100%);
}

.glass-card {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(18px);
}

.login-button {
  width: 100%;
}

.login-visual {
  min-height: 440px;
  display: grid;
  place-items: center;
}

.building-shape {
  width: min(420px, 76vw);
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.32);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding: 42px;
  box-shadow: 0 34px 90px rgba(15, 23, 42, 0.25);
}

.building-shape span {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  min-height: 80px;
}

.dashboard-hero,
.assistant-card,
.cost-overview {
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.dashboard-hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  color: #fff;
  background: linear-gradient(135deg, #0f766e 0%, #2563eb 70%, #f59e0b 100%);
}

.dashboard-hero h1,
.dashboard-hero p {
  margin: 4px 0;
}

.dashboard-hero .eyebrow {
  color: rgba(255, 255, 255, 0.78);
}

.hero-controls {
  min-width: min(420px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-content: center;
}

.hero-controls label {
  color: #fff;
}

.status-pill {
  grid-column: 1 / -1;
  display: inline-flex;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.20);
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-weight: 800;
}

.assistant-card {
  background: #fff;
}

.cost-overview {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.card-heading,
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-heading h2,
.section-title h2 {
  margin: 0;
}

.card-heading strong {
  font-size: 34px;
  color: var(--brand-2);
}

.progress-track,
.mini-bar {
  height: 12px;
  border-radius: 999px;
  background: #e8eef5;
  overflow: hidden;
}

.progress-track span,
.mini-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-2) 100%);
}

.check-grid,
.category-grid,
.quick-action-grid {
  display: grid;
  gap: 12px;
}

.check-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  background: #f4f8fb;
}

.check-item span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  font-weight: 900;
}

.check-item.done span {
  color: #fff;
  background: var(--brand);
}

.check-item.open span {
  color: #fff;
  background: var(--brand-3);
}

.cost-bars {
  display: grid;
  gap: 14px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.mini-bar.teal span { background: linear-gradient(90deg, #0e8f83, #21c6a8); }
.mini-bar.blue span { background: linear-gradient(90deg, #2563eb, #60a5fa); }
.mini-bar.amber span { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.mini-bar.rose span { background: linear-gradient(90deg, #e11d48, #fb7185); }

.dashboard-section {
  margin-top: 18px;
}

.category-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.category-card,
.quick-action,
.issue-card,
.data-card {
  text-decoration: none;
  color: var(--text);
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 7px;
}

.category-card:hover,
.quick-action:hover,
.issue-card:hover,
.data-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--soft-shadow);
}

.issue-list {
  display: grid;
  gap: 10px;
}

.issue-card.warn {
  border-color: #f4d08a;
  background: #fff8e8;
}

.issue-card.danger {
  border-color: #f1b8b8;
  background: #fff1f1;
}

.quick-action-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.quick-action span {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  font-weight: 900;
}

.assistant-timeline {
  display: grid;
  gap: 14px;
}

.workflow-step {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 14px;
  align-items: stretch;
}

.step-number {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: var(--soft-shadow);
}

.step-body {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--soft-shadow);
}

.workflow-step.done .step-number {
  background: linear-gradient(135deg, #16a34a, #0e8f83);
}

.focus-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  padding: 26px;
  color: #fff;
  border-radius: 8px;
  background: linear-gradient(135deg, #0f766e 0%, #2563eb 78%, #f59e0b 100%);
  box-shadow: var(--shadow);
}

.focus-hero h1,
.focus-hero p {
  margin: 4px 0;
}

.focus-hero .eyebrow {
  color: rgba(255, 255, 255, 0.82);
}

.focus-status {
  display: grid;
  gap: 10px;
  min-width: 190px;
}

.focus-grid {
  display: grid;
  grid-template-columns: 1.3fr repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.focus-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--soft-shadow);
}

.focus-card strong {
  display: block;
  margin: 8px 0;
  font-size: 26px;
}

.primary-focus strong {
  font-size: 42px;
  color: var(--brand-2);
}

.calm-panel {
  box-shadow: 0 10px 28px rgba(31, 45, 61, 0.06);
}

.check-grid.compact,
.quick-action-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

details.panel summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 18px;
}

details.panel[open] summary {
  margin-bottom: 16px;
}

.category-grid.relaxed {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-shell {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.form-intro {
  padding: 12px 0;
}

.form-intro h2 {
  margin: 4px 0;
}

.form-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--soft-shadow);
}

.inline-check {
  width: auto;
  min-height: auto;
  margin-right: 8px;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.option-tile {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.option-tile input {
  width: auto;
  min-height: auto;
}

.parking-picker {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.parking-picker-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.parking-picker-toolbar > strong {
  align-self: center;
  color: #151815;
  font-size: 14px;
}

.parking-picker-count {
  align-self: center;
  padding: 7px 9px;
  border: 1px solid rgba(29, 111, 74, 0.16);
  border-radius: 8px;
  background: rgba(232, 242, 222, 0.84);
  color: #1f4f38;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.parking-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(29, 36, 48, 0.10);
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.78);
}

.parking-option {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 0;
  min-height: 48px;
  aspect-ratio: 1.35;
  padding: 8px;
  border: 1px solid rgba(29, 36, 48, 0.12);
  border-radius: 8px;
  color: #151815;
  font-size: 13px;
  font-weight: 880;
  line-height: 1;
  box-shadow: var(--hairline-shadow);
  cursor: pointer;
  transition: transform var(--motion), box-shadow var(--motion), border-color var(--motion), background-color var(--motion), color var(--motion);
}

.parking-option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: inherit;
}

.parking-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parking-option.is-free {
  border-color: rgba(29, 111, 74, 0.24);
  background: rgba(232, 242, 222, 0.82);
  color: #1f6f4d;
}

.parking-option.is-selected,
.parking-option:has(input:checked) {
  border-color: rgba(47, 102, 189, 0.44);
  background: rgba(225, 238, 255, 0.98);
  color: #1e4f95;
  box-shadow: inset 0 0 0 2px rgba(47, 102, 189, 0.18), var(--hairline-shadow);
}

.parking-option.is-occupied {
  border-color: rgba(180, 35, 24, 0.28);
  background: rgba(245, 229, 229, 0.92);
  color: #b42318;
  cursor: not-allowed;
}

.parking-option:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(29, 36, 48, 0.10), var(--hairline-shadow);
}

.parking-option:has(input:focus-visible) {
  outline: 2px solid rgba(47, 102, 189, 0.38);
  outline-offset: 2px;
}

.parking-picker.is-readonly .parking-option {
  cursor: default;
}

.parking-picker.is-readonly .parking-option:hover {
  transform: none;
  box-shadow: var(--hairline-shadow);
}

.parking-picker-empty {
  margin-top: 0;
}

.timeline-list {
  display: grid;
  gap: 10px;
}

.lease-audit-panel {
  background: rgba(255, 255, 255, 0.58);
  box-shadow: var(--hairline-shadow);
}

.lease-audit-panel .section-title {
  margin-bottom: 6px;
}

.lease-audit-panel h2 {
  color: rgba(21, 24, 21, 0.74);
  font-size: 18px;
}

.timeline-list.subtle {
  gap: 6px;
}

.timeline-list.subtle .timeline-item {
  padding: 9px 10px;
  border-left-width: 3px;
  background: rgba(248, 251, 255, 0.46);
  color: rgba(21, 24, 21, 0.72);
}

.timeline-list.subtle .timeline-item strong {
  color: rgba(21, 24, 21, 0.78);
  font-size: 12px;
}

.timeline-list.subtle .timeline-item span {
  color: rgba(83, 91, 101, 0.76);
  font-size: 11px;
}

.timeline-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-left: 4px solid var(--brand);
  background: #f8fbff;
  border-radius: 8px;
}

.parking-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.split-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.split-title {
  grid-column: 1 / -1;
  color: var(--brand-2);
  font-weight: 900;
}

.rule-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.rule-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--soft-shadow);
}

.priority-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: #eef6ff;
  color: var(--brand-2);
  font-weight: 900;
}

.rule-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.rule-flow div {
  padding: 12px;
  border-radius: 8px;
  background: #f8fbff;
}

.rule-flow span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.empty-state {
  padding: 18px;
  border-radius: 8px;
  background: #f4f8fb;
  color: var(--muted);
}

.status-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.workbench-head,
.triage-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.workbench-head h1,
.triage-head h1,
.split-heading h1 {
  margin: 3px 0;
  font-size: 30px;
}

.workbench-head p,
.triage-head p {
  margin: 0;
  color: var(--muted);
}

.workbench-actions,
.triage-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.module-tabs,
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.module-tabs a,
.filter-pills a {
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.72);
  font-weight: 700;
}

.module-tabs a.active,
.filter-pills a.active {
  color: #fff;
  background: #111827;
  border-color: #111827;
}

.filter-pills.compact {
  margin-bottom: 14px;
  border-bottom: 0;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card {
  display: grid;
  gap: 6px;
  min-height: 132px;
  padding: 20px;
  background: #fffdf7;
  border: 1px solid #ece5d8;
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
}

.metric-card span {
  color: #495160;
  font-weight: 750;
}

.metric-card strong {
  font-size: 32px;
  letter-spacing: 0;
}

.metric-card small {
  color: var(--muted);
}

.metric-card.warn strong {
  color: #80620f;
}

.metric-card.info strong {
  color: var(--brand-2);
}

.workbench-grid,
.people-leases-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.86fr) minmax(420px, 1.14fr);
  gap: 20px;
  align-items: start;
}

.task-list,
.lease-card-list,
.triage-list {
  display: grid;
  gap: 14px;
}

.task-row {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 16px;
  padding: 14px 0;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

.task-row:last-child {
  border-bottom: 0;
}

.task-row strong,
.task-row small {
  display: block;
}

.task-row strong {
  font-size: 21px;
  line-height: 1.15;
}

.task-row small {
  margin-top: 5px;
  color: #4b5563;
}

.task-label {
  justify-self: start;
  align-self: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 750;
  background: #eef4ff;
  color: var(--brand-2);
}

.task-row.warn .task-label { background: #fff3d8; color: #7a5a10; }
.task-row.danger .task-label { background: #fae6e6; color: var(--danger); }

.unit-board {
  min-height: 420px;
}

.unit-tile-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(72px, 1fr));
  gap: 10px;
}

.unit-tile {
  display: grid;
  gap: 3px;
  min-height: 88px;
  padding: 14px;
  color: #1f2937;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #eaf3dc;
}

.unit-tile:hover,
.lease-work-card:hover,
.person-row:hover,
.owner-account-row:hover,
.triage-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--soft-shadow);
}

.unit-tile strong {
  font-size: 22px;
  color: #2f6f2f;
}

.unit-tile span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-tile.warn { background: #f6eddc; }
.unit-tile.warn strong { color: #75570c; }
.unit-tile.danger { background: #f7e5e7; }
.unit-tile.danger strong { color: #953737; }
.unit-tile.empty { background: #f2f0ea; }
.unit-tile.empty strong { color: #4b4b45; }

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 18px;
  color: #4b5563;
}

.legend-row i {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 6px;
  border-radius: 4px;
  vertical-align: -2px;
}

.legend-row i.ok { background: #eaf3dc; }
.legend-row i.warn { background: #f6eddc; }
.legend-row i.danger { background: #f7e5e7; }
.legend-row i.empty { background: #f2f0ea; }

.section-kicker {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 34px 0 12px;
  color: #4b5563;
  font-weight: 850;
}

.section-kicker small {
  font-weight: 700;
}

.owner-workbench {
  padding: 0;
  overflow: hidden;
}

.owner-account-row,
.person-row {
  display: grid;
  grid-template-columns: 54px 1fr minmax(220px, 0.34fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px 22px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

.owner-account-row:last-child,
.person-row:last-child {
  border-bottom: 0;
}

.avatar,
.unit-avatar {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #dbeafe;
  color: #2c62b7;
  font-weight: 850;
}

.avatar.tenant { background: #e7f1d9; color: #3d781c; }
.avatar.vendor { background: #f0eee8; color: #4b4b45; }

.owner-main,
.owner-progress {
  display: grid;
  gap: 5px;
}

.owner-main small,
.owner-progress small,
.person-row small {
  color: #4b5563;
}

.liquidity-panel {
  min-height: 210px;
  display: grid;
  align-content: end;
  gap: 24px;
}

.liquidity-axis,
.liquidity-footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.liquidity-footer strong {
  color: var(--ok);
}

.triage-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  gap: 16px;
  text-align: center;
  min-width: min(560px, 100%);
}

.triage-stats span {
  display: grid;
  gap: 2px;
  color: #4b5563;
  font-weight: 750;
}

.triage-stats strong {
  font-size: 30px;
}

.triage-stats .ok strong,
.positive { color: var(--ok); }
.triage-stats .info strong { color: var(--brand-2); }
.triage-stats .warn strong { color: #80620f; }
.triage-stats .danger strong,
.negative { color: var(--danger); }

.triage-card {
  display: grid;
  gap: 16px;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--brand-2);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.triage-card.warn { border-left-color: #80620f; }
.triage-card.danger { border-left-color: var(--danger); }

.triage-card header,
.triage-suggestion {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.triage-card h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.triage-card p {
  margin: 0;
  color: #374151;
}

.triage-card header > strong {
  font-size: 26px;
  white-space: nowrap;
}

.suggestion-main {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.suggestion-main small {
  flex-basis: 100%;
  color: #6b665e;
  font-style: italic;
}

.assignment-chip {
  border-radius: 8px;
  padding: 7px 12px;
  background: #dbeafe;
  color: #2c62b7;
  font-weight: 750;
}

.assignment-chip.soft {
  background: #f3f1ea;
  color: #3f3d38;
}

.assignment-chip.muted-chip {
  background: #fbf6df;
  color: #69510b;
}

.confidence-bars {
  display: inline-flex;
  gap: 4px;
}

.confidence-bars i {
  width: 7px;
  height: 22px;
  border-radius: 3px;
  background: #d9dee5;
}

.confidence-bars i.on {
  background: var(--ok);
}

.people-leases-grid {
  grid-template-columns: minmax(520px, 1.6fr) minmax(340px, 1fr);
}

.split-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.lease-work-card {
  position: relative;
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 20px;
  align-items: start;
  padding: 26px 32px;
  color: var(--text);
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--ok);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
}

.lease-work-card.warn { border-left-color: #80620f; }
.lease-work-card.danger { border-left-color: var(--danger); }
.lease-work-card.empty { border-left-color: #b8b1a5; background: #faf8f1; }

.lease-main,
.lease-title {
  display: grid;
  gap: 5px;
}

.lease-title strong {
  font-size: 24px;
}

.lease-main small {
  color: #3f4652;
}

.lease-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.lease-facts span {
  display: grid;
  gap: 3px;
}

.lease-facts small {
  color: #707783;
  font-weight: 800;
}

.person-panel {
  padding: 8px 28px;
}

.person-row {
  grid-template-columns: 64px 1fr;
  padding-left: 0;
  padding-right: 0;
}

.person-row strong {
  display: block;
  font-size: 21px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.badge-row i {
  border-radius: 7px;
  padding: 2px 8px;
  background: #f0eee8;
  color: #3f3d38;
  font-style: normal;
  font-weight: 750;
}

/* Premium workbench layer */
:root {
  --bg: #f5f6f2;
  --panel: rgba(255, 255, 255, 0.84);
  --panel-strong: #ffffff;
  --line: rgba(29, 36, 48, 0.11);
  --line-strong: rgba(29, 36, 48, 0.18);
  --text: #181916;
  --muted: #69706b;
  --brand: #1d6f4a;
  --brand-2: #2f66bd;
  --brand-3: #9a7417;
  --danger: #9c3333;
  --warning: #79560b;
  --ok: #246a2b;
  --cream: #f4f1e8;
  --blue-soft: #e8f0fb;
  --green-soft: #e8f2de;
  --amber-soft: #f5ecd9;
  --red-soft: #f5e5e5;
  --shadow: 0 22px 70px rgba(29, 36, 48, 0.13);
  --soft-shadow: 0 14px 36px rgba(29, 36, 48, 0.08);
  --hairline-shadow: 0 1px 0 rgba(255, 255, 255, 0.72) inset;
  --motion: 220ms cubic-bezier(.2, .8, .2, 1);
  --motion-slow: 620ms cubic-bezier(.16, 1, .3, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background:
    linear-gradient(150deg, rgba(232, 240, 251, 0.66) 0%, rgba(245, 246, 242, 0.92) 34%, rgba(244, 241, 232, 0.82) 100%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.78) 0 1px, transparent 1px 100%),
    var(--bg);
  background-size: auto, 28px 28px, auto;
  color: var(--text);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a,
button,
.btn,
.panel,
.metric-card,
.task-row,
.unit-tile,
.owner-account-row,
.triage-card,
.lease-work-card,
.person-row,
.module-tabs a,
.filter-pills a,
.badge,
.status-chip {
  transition:
    transform var(--motion),
    box-shadow var(--motion),
    border-color var(--motion),
    background-color var(--motion),
    color var(--motion),
    opacity var(--motion);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(47, 102, 189, 0.25);
  outline-offset: 3px;
}

.app-shell {
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 22px 16px;
  color: #27302b;
  background: rgba(255, 255, 255, 0.62);
  border-right: 1px solid rgba(29, 36, 48, 0.10);
  box-shadow: none;
  backdrop-filter: blur(22px) saturate(1.25);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 18px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(145deg, #1d6f4a 0%, #2f66bd 100%);
  box-shadow: 0 12px 24px rgba(47, 102, 189, 0.22);
  font-weight: 850;
}

.brand {
  display: grid;
  gap: 1px;
  margin: 0;
  color: #1f2521;
  font-size: 15px;
  line-height: 1.18;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.nav-group {
  margin: 18px 8px 8px;
  color: #7a817b;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.nav-list {
  gap: 5px;
}

.nav-list a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  color: #39413c;
  padding: 9px 10px;
  border-radius: 8px;
  font-weight: 680;
}

.nav-list a span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(57, 65, 60, 0.22);
}

.nav-list a:hover {
  background: rgba(255, 255, 255, 0.86);
  color: #141713;
  transform: translateX(2px);
}

.nav-list a.active {
  color: #11140f;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 26px rgba(29, 36, 48, 0.08), var(--hairline-shadow);
}

.nav-list a.active span {
  background: var(--brand);
  box-shadow: 0 0 0 5px rgba(29, 111, 74, 0.12);
}

.main {
  width: min(100%, 1540px);
  margin: 0 auto;
  padding: 28px 34px 54px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: -28px -34px 24px;
  padding: 16px 34px;
  background: rgba(245, 246, 242, 0.78);
  border-bottom: 1px solid rgba(29, 36, 48, 0.08);
  backdrop-filter: blur(18px) saturate(1.1);
}

.page-title {
  color: rgba(24, 25, 22, 0.62);
  font-size: 15px;
  font-weight: 720;
}

.panel,
.metric-card,
.triage-card,
.lease-work-card,
.person-panel,
.owner-workbench {
  position: relative;
  border-color: rgba(29, 36, 48, 0.10);
  background: var(--panel);
  box-shadow: var(--soft-shadow), var(--hairline-shadow);
  backdrop-filter: blur(18px) saturate(1.15);
}

.panel::before,
.metric-card::before,
.triage-card::before,
.lease-work-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0));
  opacity: 0.72;
}

.workbench-head,
.triage-head {
  align-items: center;
  margin: 2px 0 20px;
  padding: 22px 24px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  box-shadow: 0 10px 30px rgba(29, 36, 48, 0.05), var(--hairline-shadow);
  backdrop-filter: blur(18px);
}

.workbench-head h1,
.triage-head h1,
.split-heading h1 {
  margin: 2px 0 6px;
  font-size: 34px;
  line-height: 1.06;
  letter-spacing: 0;
}

.workbench-head p,
.triage-head p {
  max-width: 720px;
  color: #59615b;
  font-size: 15px;
}

.eyebrow {
  color: #717971;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.btn,
button {
  min-height: 40px;
  border-radius: 8px;
  border-color: rgba(29, 36, 48, 0.12);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 18px rgba(29, 36, 48, 0.05), var(--hairline-shadow);
  font-weight: 720;
}

.btn:hover,
button:hover {
  transform: translateY(-1px);
  border-color: rgba(29, 36, 48, 0.2);
  box-shadow: 0 14px 28px rgba(29, 36, 48, 0.10), var(--hairline-shadow);
}

.btn.primary,
button.primary {
  color: #fff;
  background: linear-gradient(145deg, #171a16 0%, #28312d 58%, #2f66bd 100%);
  box-shadow: 0 14px 32px rgba(47, 102, 189, 0.22), var(--hairline-shadow);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.62);
}

.module-tabs,
.filter-pills {
  position: sticky;
  top: 71px;
  z-index: 15;
  flex-wrap: nowrap;
  overflow-x: auto;
  margin: 0 0 24px;
  padding: 8px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 8px 24px rgba(29, 36, 48, 0.05), var(--hairline-shadow);
  backdrop-filter: blur(18px) saturate(1.16);
  scrollbar-width: none;
}

.module-tabs::-webkit-scrollbar,
.filter-pills::-webkit-scrollbar {
  display: none;
}

.module-tabs a,
.filter-pills a {
  position: relative;
  flex: 0 0 auto;
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #404740;
  white-space: nowrap;
}

.module-tabs a:hover,
.filter-pills a:hover {
  background: rgba(29, 36, 48, 0.05);
}

.module-tabs a.active,
.filter-pills a.active {
  color: #11140f;
  background: #fff;
  box-shadow: 0 10px 22px rgba(29, 36, 48, 0.10), var(--hairline-shadow);
}

.module-tabs a.active::after,
.filter-pills a.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 5px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.metric-strip {
  gap: 20px;
  margin-bottom: 28px;
}

.metric-card {
  isolation: isolate;
  min-height: 154px;
  padding: 22px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 46px rgba(29, 36, 48, 0.12), var(--hairline-shadow);
}

.metric-label {
  color: #565d58;
  font-size: 15px;
  font-weight: 760;
}

.metric-value {
  margin-top: 4px;
  color: #121411;
  font-size: 36px;
  line-height: 1;
}

.metric-card.primary .metric-value {
  font-size: 40px;
}

.metric-note {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #414942;
  font-weight: 680;
}

.metric-card.warn .metric-value,
.metric-card.warn .metric-tag {
  color: #6d520e;
}

.metric-card.info .metric-value,
.metric-card.info .metric-tag {
  color: var(--brand-2);
}

.metric-card.warn .metric-value.arrears-danger,
.metric-card .metric-value.arrears-danger,
.metric-value.arrears-danger {
  color: #b42318;
}

.metric-card .metric-value.arrears-ok,
.metric-value.arrears-ok {
  color: #276749;
}

.metric-tag,
.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  min-height: 24px;
  padding: 4px 9px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  color: #4a524d;
  font-size: 12px;
  font-weight: 760;
  line-height: 1;
  box-shadow: var(--hairline-shadow);
}

.metric-tag.info,
.status-chip.info {
  color: var(--brand-2);
  background: rgba(232, 240, 251, 0.78);
}

.metric-tag.neutral,
.status-chip.neutral {
  color: #50564f;
  background: rgba(244, 241, 232, 0.92);
}

.status-chip.ok {
  color: var(--ok);
  background: rgba(232, 242, 222, 0.9);
}

.status-chip.warn {
  color: var(--warning);
  background: rgba(245, 236, 217, 0.9);
}

.status-chip.danger {
  color: var(--danger);
  background: rgba(245, 229, 229, 0.95);
}

.signal-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 5px rgba(36, 106, 43, 0.10);
}

.signal-dot.ok { color: var(--ok); }
.signal-dot.warn { color: var(--warning); box-shadow: 0 0 0 5px rgba(121, 86, 11, 0.10); }
.signal-dot.info { color: var(--brand-2); box-shadow: 0 0 0 5px rgba(47, 102, 189, 0.10); }

.metric-meter {
  display: block;
  height: 7px;
  margin-top: 4px;
  border-radius: 999px;
  background: rgba(29, 36, 48, 0.08);
  overflow: hidden;
}

.metric-meter span,
.mini-bar span {
  animation: meterIn 900ms cubic-bezier(.16, 1, .3, 1) both;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.workbench-grid {
  gap: 28px;
}

.section-title h2 {
  font-size: 22px;
  letter-spacing: 0;
}

.action-panel,
.unit-board {
  padding: 26px;
}

.task-row {
  position: relative;
  grid-template-columns: 142px 1fr 28px;
  align-items: center;
  min-height: 106px;
  padding: 18px 10px;
  border-bottom-color: rgba(29, 36, 48, 0.09);
}

.task-row:hover {
  transform: translateX(4px);
}

.task-row strong {
  color: #141713;
  font-size: 24px;
}

.task-label {
  gap: 8px;
  padding: 7px 11px;
  color: var(--brand-2);
  background: rgba(232, 240, 251, 0.92);
}

.task-label i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: currentColor;
}

.task-row.warn .task-label {
  color: var(--warning);
  background: var(--amber-soft);
}

.task-row.danger .task-label {
  color: var(--danger);
  background: var(--red-soft);
}

.row-arrow {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #5b635d;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
}

.task-row:hover .row-arrow {
  color: #fff;
  background: #171a16;
  transform: translateX(2px);
}

.unit-board {
  min-height: 476px;
}

.unit-tile-grid {
  gap: 12px;
}

.unit-tile {
  position: relative;
  min-height: 108px;
  padding: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(232, 242, 222, 0.96), rgba(232, 242, 222, 0.72));
  border-color: rgba(36, 106, 43, 0.08);
  box-shadow: 0 10px 20px rgba(29, 36, 48, 0.05), var(--hairline-shadow);
}

.unit-tile:hover {
  transform: translateY(-3px) scale(1.01);
  border-color: rgba(36, 106, 43, 0.24);
}

.unit-status-dot {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--ok);
  box-shadow: 0 0 0 5px rgba(36, 106, 43, 0.12);
}

.unit-tile strong {
  font-size: 24px;
  letter-spacing: 0;
}

.unit-tile small {
  margin-top: 4px;
  overflow: hidden;
  color: rgba(31, 41, 55, 0.62);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-tile.warn {
  background: linear-gradient(180deg, rgba(245, 236, 217, 0.98), rgba(245, 236, 217, 0.72));
}

.unit-tile.warn .unit-status-dot {
  background: var(--warning);
  box-shadow: 0 0 0 5px rgba(121, 86, 11, 0.12);
}

.unit-tile.danger {
  background: linear-gradient(180deg, rgba(245, 229, 229, 0.98), rgba(245, 229, 229, 0.72));
}

.unit-tile.danger .unit-status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(156, 51, 51, 0.12);
}

.unit-tile.empty {
  background: linear-gradient(180deg, rgba(244, 241, 232, 0.98), rgba(244, 241, 232, 0.74));
}

.unit-tile.empty .unit-status-dot {
  background: #9a9d94;
  box-shadow: 0 0 0 5px rgba(101, 112, 132, 0.10);
}

.legend-row {
  padding-top: 6px;
}

.section-kicker {
  margin-top: 40px;
  color: #3e4540;
  letter-spacing: 0.02em;
}

.owner-account-row {
  grid-template-columns: 58px 1fr minmax(260px, 0.42fr) auto;
  padding: 20px 24px;
}

.owner-account-row:hover,
.person-row:hover {
  background: rgba(255, 255, 255, 0.56);
}

.avatar,
.unit-avatar {
  box-shadow: var(--hairline-shadow), 0 10px 20px rgba(47, 102, 189, 0.10);
}

.owner-main strong,
.person-row strong {
  font-size: 20px;
  letter-spacing: 0;
}

.mini-bar {
  height: 8px;
  background: rgba(29, 36, 48, 0.08);
}

.liquidity-panel {
  min-height: 250px;
  overflow: hidden;
}

.sparkline {
  display: flex;
  align-items: end;
  justify-content: space-between;
  height: 122px;
  padding: 0 4px;
  border-bottom: 1px solid rgba(29, 36, 48, 0.08);
}

.sparkline span {
  display: block;
  width: 12%;
  max-width: 96px;
  height: var(--h);
  border-radius: 8px 8px 0 0;
  background:
    linear-gradient(180deg, rgba(47, 102, 189, 0.9), rgba(29, 111, 74, 0.82));
  box-shadow: 0 12px 30px rgba(47, 102, 189, 0.15);
  animation: barRise 900ms cubic-bezier(.16, 1, .3, 1) both;
  animation-delay: var(--delay);
}

.liquidity-axis {
  color: #5b635d;
  font-weight: 650;
}

.liquidity-footer {
  color: #3f4741;
}

.triage-head {
  align-items: stretch;
}

.triage-stats {
  min-width: min(610px, 100%);
}

.triage-stats span {
  min-height: 84px;
  place-content: center;
  padding: 12px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: var(--hairline-shadow);
}

.triage-stats strong {
  line-height: 1;
}

.triage-card {
  gap: 20px;
  padding: 26px 28px;
  overflow: hidden;
}

.triage-card:hover,
.lease-work-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 54px rgba(29, 36, 48, 0.13), var(--hairline-shadow);
}

.triage-tags,
.lease-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
}

.triage-card h2 {
  color: #11140f;
  font-size: 23px;
  line-height: 1.15;
}

.triage-card p {
  max-width: 960px;
  color: #545d56;
}

.triage-card header > strong {
  padding: 8px 0;
  font-size: 30px;
}

.suggestion-main {
  max-width: 840px;
}

.assignment-chip {
  border: 1px solid rgba(47, 102, 189, 0.09);
  background: rgba(232, 240, 251, 0.95);
  box-shadow: var(--hairline-shadow);
}

.assignment-chip.soft {
  border-color: rgba(29, 36, 48, 0.07);
  background: rgba(244, 241, 232, 0.9);
}

.assignment-chip.muted-chip {
  border-color: rgba(121, 86, 11, 0.09);
  background: rgba(245, 236, 217, 0.92);
}

.confidence-meter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #39413c;
  box-shadow: var(--hairline-shadow);
}

.confidence-meter b {
  font-size: 12px;
}

.confidence-rail {
  display: inline-flex;
  gap: 3px;
}

.confidence-rail i {
  width: 6px;
  height: 17px;
  border-radius: 4px;
  background: rgba(29, 36, 48, 0.12);
}

.confidence-rail i.on {
  background: linear-gradient(180deg, var(--brand), var(--ok));
}

.people-leases-grid {
  gap: 28px;
}

.split-heading {
  align-items: center;
  margin-bottom: 14px;
}

.lease-work-card {
  grid-template-columns: 70px 1fr auto;
  padding: 26px;
  border-left-width: 4px;
}

.lease-tags i {
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(244, 241, 232, 0.9);
  color: #4a524d;
  font-size: 12px;
  font-style: normal;
  font-weight: 760;
}

.lease-tags i.ok {
  color: var(--ok);
  background: var(--green-soft);
}

.lease-tags i.warn {
  color: var(--warning);
  background: var(--amber-soft);
}

.lease-tags i.danger {
  color: var(--danger);
  background: var(--red-soft);
}

.lease-title strong {
  color: #11140f;
  font-size: 25px;
  line-height: 1.12;
}

.lease-facts {
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  border-top-color: rgba(29, 36, 48, 0.09);
}

.lease-facts strong {
  font-size: 18px;
}

.person-panel {
  padding: 10px 26px;
}

.person-row small {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.badge-row i {
  background: rgba(244, 241, 232, 0.92);
  box-shadow: var(--hairline-shadow);
}

.flash {
  box-shadow: var(--soft-shadow), var(--hairline-shadow);
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes meterIn {
  from {
    transform: scaleX(0);
    transform-origin: left;
  }
  to {
    transform: scaleX(1);
    transform-origin: left;
  }
}

@keyframes barRise {
  from {
    opacity: 0;
    transform: scaleY(.18);
    transform-origin: bottom;
  }
  to {
    opacity: 1;
    transform: scaleY(1);
    transform-origin: bottom;
  }
}

.metric-card,
.panel,
.triage-card,
.lease-work-card,
.person-panel {
  animation: panelIn var(--motion-slow) both;
}

.metric-card:nth-child(2),
.task-row:nth-child(2),
.triage-card:nth-child(2),
.lease-work-card:nth-child(2) {
  animation-delay: 60ms;
}

.metric-card:nth-child(3),
.task-row:nth-child(3),
.triage-card:nth-child(3),
.lease-work-card:nth-child(3) {
  animation-delay: 120ms;
}

.metric-card:nth-child(4),
.task-row:nth-child(4),
.triage-card:nth-child(4),
.lease-work-card:nth-child(4) {
  animation-delay: 180ms;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 1180px) {
  .metric-strip,
  .triage-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .people-leases-grid,
  .workbench-grid {
    grid-template-columns: 1fr;
  }

  .unit-tile-grid {
    grid-template-columns: repeat(4, minmax(88px, 1fr));
  }

  .owner-account-row {
    grid-template-columns: 58px 1fr auto;
  }

  .owner-progress {
    grid-column: 2 / -1;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(29, 36, 48, 0.1);
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid.cols-2,
  .grid.cols-3,
  .form-grid,
  .hero-controls,
  .category-grid,
  .quick-action-grid,
  .check-grid,
  .focus-grid,
  .form-shell,
  .option-grid,
  .split-row,
  .parking-grid,
  .rule-card-grid,
  .rule-flow,
  .metric-strip,
  .workbench-grid,
  .people-leases-grid,
  .unit-tile-grid,
  .triage-stats,
  .lease-facts,
  .lease-work-card,
  .owner-account-row {
    grid-template-columns: 1fr;
  }

  .workbench-head,
  .triage-head,
  .triage-card header,
  .triage-suggestion,
  .split-heading,
  .section-kicker {
    flex-direction: column;
  }

  .task-row {
    grid-template-columns: 1fr;
  }

  .dashboard-hero {
    flex-direction: column;
  }

  .focus-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .login-page {
    grid-template-columns: 1fr;
  }

  .login-visual {
    display: none;
  }

  .main {
    padding: 18px;
  }

  .topbar {
    margin: -18px -18px 18px;
    padding: 13px 18px;
  }

  .module-tabs,
  .filter-pills {
    top: 58px;
  }

  .workbench-head,
  .triage-head {
    padding: 18px;
  }

  .workbench-head h1,
  .triage-head h1,
  .split-heading h1 {
    font-size: 28px;
  }

  .task-row {
    min-height: auto;
  }

  .triage-card header > strong {
    white-space: normal;
  }

  .person-row small {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Calm density pass: fewer visible choices, lighter scale, clearer hierarchy */
:root {
  --compact-radius: 8px;
  --compact-gap: 14px;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-soft: color-mix(in srgb, var(--surface), var(--bg) 22%);
  --shadow: 0 14px 38px rgba(29, 36, 48, 0.09);
  --soft-shadow: 0 8px 22px rgba(29, 36, 48, 0.06);
}

body {
  background:
    linear-gradient(180deg, #f8f8f4 0%, #f3f5ef 100%);
}

.app-shell {
  grid-template-columns: 216px minmax(0, 1fr);
}

.main {
  container-type: inline-size;
  width: min(100%, 1320px);
  padding: 18px 24px 40px;
}

.sidebar {
  padding: 16px 12px;
  background: rgba(250, 250, 247, 0.78);
}

.brand-lockup {
  gap: 10px;
  padding: 4px 6px 12px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  font-size: 14px;
}

.brand {
  font-size: 13px;
}

.brand small {
  font-size: 11px;
}

.shell-nav {
  display: grid;
  gap: 10px;
}

.nav-group {
  margin: 10px 8px 4px;
  font-size: 10px;
}

.nav-list a {
  min-height: 32px;
  padding: 7px 9px;
  font-size: 13px;
  font-weight: 660;
}

.nav-list a span {
  width: 6px;
  height: 6px;
}

.secondary-nav {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}

.secondary-nav details {
  border-top: 1px solid rgba(29, 36, 48, 0.08);
  padding-top: 6px;
}

.secondary-nav summary,
.filter-more summary {
  cursor: pointer;
  list-style: none;
  border-radius: var(--compact-radius);
  color: #69706b;
  font-size: 12px;
  font-weight: 760;
  padding: 7px 9px;
}

.secondary-nav summary::-webkit-details-marker,
.filter-more summary::-webkit-details-marker {
  display: none;
}

.secondary-nav summary::after,
.filter-more summary::after {
  content: "+";
  float: right;
  color: #8b928c;
}

.secondary-nav details[open] summary::after,
.filter-more[open] summary::after {
  content: "–";
}

.secondary-nav details:has(a.active) summary {
  color: #252b27;
}

.secondary-nav .nav-list {
  margin-top: 4px;
}

.secondary-nav .nav-list a {
  min-height: 29px;
  padding-left: 16px;
  color: #59615b;
  font-size: 12px;
}

.topbar {
  margin: -18px -24px 16px;
  padding: 10px 24px;
  min-height: 48px;
}

.page-title {
  font-size: 13px;
}

.topbar button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.workbench-head,
.triage-head {
  margin-bottom: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.workbench-head h1,
.triage-head h1,
.split-heading h1 {
  font-size: 26px;
  line-height: 1.12;
  text-wrap: balance;
}

.workbench-head p,
.triage-head p {
  max-width: 620px;
  font-size: 13px;
}

.workbench-actions {
  gap: 8px;
}

.btn,
button {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 13px;
}

.module-tabs,
.filter-pills {
  top: 49px;
  width: fit-content;
  max-width: 100%;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
}

.module-tabs a,
.filter-pills a,
.filter-more summary {
  min-height: 31px;
  padding: 8px 11px;
  font-size: 13px;
}

.filter-more {
  position: relative;
  flex: 0 0 auto;
}

.filter-more > span {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  display: grid;
  gap: 3px;
  min-width: 190px;
  padding: 6px;
  border: 1px solid rgba(29, 36, 48, 0.1);
  border-radius: var(--compact-radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.filter-more:not([open]) > span {
  display: none;
}

.metric-strip {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  min-height: 108px;
  padding: 14px;
}

.metric-card.primary .metric-value,
.metric-value {
  font-size: 27px;
}

.metric-label {
  font-size: 13px;
}

.metric-note,
.metric-tag,
.status-chip {
  font-size: 11px;
}

.workbench-grid,
.people-leases-grid {
  gap: 16px;
}

.panel,
.action-panel,
.unit-board {
  padding: 16px;
}

.section-title {
  margin-bottom: 12px;
}

.section-title h2 {
  font-size: 17px;
}

.task-row {
  grid-template-columns: 108px 1fr 24px;
  min-height: 74px;
  padding: 10px 4px;
}

.task-row strong {
  display: -webkit-box;
  overflow: hidden;
  color: #151815;
  font-size: 18px;
  line-height: 1.18;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.task-row small {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.task-label {
  padding: 5px 9px;
  font-size: 12px;
}

.row-arrow {
  width: 24px;
  height: 24px;
}

.unit-board {
  min-height: 0;
}

.unit-tile-grid {
  grid-template-columns: repeat(6, minmax(78px, 1fr));
  gap: 8px;
}

.unit-tile {
  min-height: 76px;
  padding: 10px;
}

.unit-tile strong {
  font-size: 19px;
}

.unit-tile span {
  font-size: 13px;
}

.unit-tile small {
  display: none;
}

.unit-status-dot {
  top: 9px;
  right: 9px;
  width: 6px;
  height: 6px;
}

.legend-row {
  gap: 10px;
  margin-top: 12px;
  font-size: 12px;
}

.section-kicker {
  margin: 24px 0 8px;
  font-size: 13px;
}

.owner-account-row {
  grid-template-columns: 42px 1fr minmax(190px, .35fr) auto;
  gap: 12px;
  padding: 12px 16px;
}

.avatar,
.unit-avatar {
  width: 42px;
  height: 42px;
  font-size: 13px;
}

.owner-main strong,
.person-row strong {
  font-size: 16px;
}

.owner-main small,
.owner-progress strong {
  font-size: 12px;
}

.mini-bar {
  height: 6px;
}

.liquidity-panel {
  min-height: 176px;
}

.sparkline {
  height: 78px;
}

.sparkline span {
  border-radius: 6px 6px 0 0;
}

.triage-stats {
  grid-template-columns: repeat(4, minmax(86px, 1fr));
  gap: 8px;
  min-width: min(460px, 100%);
}

.triage-stats span {
  min-height: 60px;
  padding: 8px;
  font-size: 11px;
}

.triage-stats strong {
  font-size: 22px;
}

.triage-card {
  gap: 12px;
  padding: 16px;
}

.triage-card h2 {
  display: -webkit-box;
  overflow: hidden;
  font-size: 18px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.triage-card p {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.triage-card header > strong {
  font-size: 22px;
}

.triage-suggestion {
  gap: 12px;
}

.assignment-chip,
.confidence-meter {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 12px;
}

.suggestion-main small {
  font-size: 12px;
}

.triage-actions {
  gap: 6px;
}

.lease-work-card {
  grid-template-columns: 52px 1fr auto;
  gap: 14px;
  padding: 16px;
}

.lease-title strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 19px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.lease-main small {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.lease-tags {
  gap: 5px;
  margin-bottom: 6px;
}

.lease-tags i,
.badge-row i {
  padding: 3px 7px;
  font-size: 11px;
}

.lease-facts {
  grid-template-columns: repeat(4, minmax(86px, 1fr));
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
}

.lease-facts small {
  font-size: 10px;
}

.lease-facts strong {
  font-size: 14px;
}

.person-panel {
  padding: 6px 16px;
}

.person-row {
  grid-template-columns: 46px 1fr;
  gap: 12px;
  padding: 12px 0;
}

.badge-row {
  gap: 4px;
}

:where(input, select, textarea) {
  min-height: 34px;
  border-color: rgba(29, 36, 48, 0.13);
  border-radius: var(--compact-radius);
  background: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  accent-color: var(--brand);
}

:where(label) {
  gap: 4px;
  color: #404842;
  font-size: 13px;
}

:where(th, td) {
  padding: 8px 9px;
  font-size: 13px;
}

:where(th) {
  background: rgba(244, 241, 232, 0.72);
  color: #59615b;
}

:where(.form-card, .rule-card, .category-card, .quick-action, .issue-card, .data-card) {
  padding: 14px;
  border-radius: var(--compact-radius);
  background: var(--surface);
  box-shadow: var(--soft-shadow), var(--hairline-shadow);
}

:where(.flash, .empty-state) {
  padding: 12px 14px;
  border-radius: var(--compact-radius);
  font-size: 13px;
}

:is(.panel, .metric-card, .triage-card, .lease-work-card, .owner-account-row, .person-row) {
  content-visibility: auto;
  contain-intrinsic-size: auto 140px;
}

.detail-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.detail-hero h1 {
  margin: 2px 0 5px;
  font-size: 30px;
  line-height: 1.12;
}

.detail-hero p {
  margin: 0;
  color: var(--muted);
}

.detail-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-value.compact {
  overflow-wrap: anywhere;
  font-size: 21px;
  line-height: 1.12;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.overview-grid.compact-dashboard {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.overview-grid.single-panel {
  grid-template-columns: minmax(0, 1fr);
}

.lease-dashboard {
  display: grid;
  gap: 12px;
}

.lease-dashboard .lease-card-list {
  gap: 8px;
}

.lease-row-wide {
  grid-template-columns: clamp(82px, 7vw, 104px) minmax(0, 1fr) auto;
  gap: 14px;
  align-items: stretch;
  min-height: 128px;
  padding: 14px 16px;
  overflow: hidden;
  border-left-width: 6px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.90), rgba(255, 255, 255, 0.72)),
    linear-gradient(90deg, rgba(232, 242, 222, 0.74), rgba(255, 255, 255, 0) 42%);
  contain-intrinsic-size: auto 128px;
}

.lease-row-wide.warn {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.90), rgba(255, 255, 255, 0.72)),
    linear-gradient(90deg, rgba(245, 236, 217, 0.86), rgba(255, 255, 255, 0) 42%);
}

.lease-row-wide.danger {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.90), rgba(255, 255, 255, 0.72)),
    linear-gradient(90deg, rgba(245, 229, 229, 0.9), rgba(255, 255, 255, 0) 42%);
}

.lease-row-wide.empty {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.90), rgba(255, 255, 255, 0.72)),
    linear-gradient(90deg, rgba(244, 241, 232, 0.95), rgba(255, 255, 255, 0) 42%);
}

.lease-row-wide:hover,
.lease-row-wide:focus-visible {
  border-color: rgba(47, 102, 189, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(232, 240, 251, 0.56)),
    linear-gradient(90deg, rgba(47, 102, 189, 0.16), rgba(255, 255, 255, 0) 48%);
  box-shadow: 0 22px 48px rgba(47, 102, 189, 0.16), var(--hairline-shadow);
  transform: translateY(-2px);
}

.lease-row-wide::after {
  content: "→";
  position: absolute;
  right: 13px;
  bottom: 10px;
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #5a645e;
  font-weight: 850;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity var(--motion), transform var(--motion), background-color var(--motion), color var(--motion);
}

.lease-row-wide:hover::after,
.lease-row-wide:focus-visible::after {
  opacity: 1;
  transform: translateX(0);
}

.lease-row-wide:hover .unit-avatar,
.lease-row-wide:focus-visible .unit-avatar {
  background: linear-gradient(145deg, #171a16, #2f66bd);
  color: #fff;
  transform: scale(1.04);
}

.lease-row-wide .unit-avatar {
  align-self: stretch;
  width: 100%;
  height: 100%;
  min-height: 96px;
  font-size: clamp(23px, 2.3vw, 31px);
  border-radius: 8px;
}

.lease-row-wide .lease-main {
  grid-template-columns: minmax(260px, .9fr) minmax(360px, 1.1fr);
  grid-template-areas:
    "title tags"
    "relations facts";
  gap: 10px 14px;
  align-items: start;
}

.lease-row-wide .lease-tags {
  grid-area: tags;
  justify-content: flex-end;
  align-items: start;
  margin-bottom: 0;
}

.lease-row-wide .lease-tags i {
  padding: 5px 9px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  background: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  box-shadow: var(--hairline-shadow);
}

.lease-row-wide .lease-tags .index-inline-status {
  align-self: center;
  overflow: hidden;
  color: #4f5b68;
  font-size: 11px;
  font-weight: 780;
  line-height: 1.2;
  max-width: 220px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lease-row-wide .lease-tags i.lease-type-index {
  color: #1e4f95;
  border-color: rgba(47, 102, 189, 0.22);
  background: rgba(232, 240, 251, 0.96);
}

.lease-tags i.index-delta {
  border: 1px solid rgba(29, 36, 48, 0.08);
}

.lease-tags i.index-delta.up {
  color: var(--ok);
  background: rgba(232, 242, 222, 0.95);
}

.lease-tags i.index-delta.down {
  color: var(--danger);
  background: rgba(245, 229, 229, 0.95);
}

.lease-tags i.index-delta.flat {
  color: var(--brand-2);
  background: rgba(232, 240, 251, 0.95);
}

.lease-tags i.index-ready {
  color: #795119;
  border-color: rgba(202, 146, 49, 0.28);
  background: rgba(255, 244, 221, 0.96);
}

.lease-row-wide .lease-title {
  grid-area: title;
  gap: 3px;
}

.lease-row-wide .lease-title strong {
  color: #11140f;
  font-size: 19px;
  line-height: 1.15;
  -webkit-line-clamp: 1;
}

.lease-row-wide .lease-title small {
  color: #5d665f;
  font-size: 12px;
  -webkit-line-clamp: 1;
}

.lease-relationship {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.lease-relationship span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
}

.lease-relationship small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.lease-relationship strong {
  overflow-wrap: anywhere;
}

.lease-row-wide .lease-relationship {
  grid-area: relations;
  grid-template-columns: minmax(160px, .95fr) minmax(180px, 1.15fr);
  gap: 8px;
  margin-top: 0;
}

.lease-row-wide .lease-relationship span {
  position: relative;
  padding: 8px 9px;
  overflow: hidden;
  box-shadow: var(--hairline-shadow);
}

.lease-row-wide .lease-relationship span::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 8px 0 0 8px;
  background: var(--brand);
}

.lease-row-wide .lease-relationship .relation-owner::before {
  background: var(--brand-2);
}

.lease-row-wide .lease-relationship .relation-tenant::before {
  background: var(--brand-3);
}

.lease-row-wide .lease-relationship small {
  font-size: 10px;
}

.lease-row-wide .lease-relationship strong {
  overflow-wrap: anywhere;
  color: #161a17;
  font-size: 13px;
  line-height: 1.2;
}

.lease-row-wide .lease-facts {
  grid-area: facts;
  grid-template-columns: minmax(82px, .9fr) minmax(82px, .9fr) minmax(96px, .95fr) minmax(112px, 1.2fr);
  gap: 8px;
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.lease-row-wide .lease-facts span {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: var(--hairline-shadow);
  min-height: 48px;
}

.lease-row-wide .lease-facts .fact-gross {
  border-color: rgba(29, 111, 74, 0.28);
  background: linear-gradient(180deg, rgba(217, 244, 229, 0.96), rgba(246, 255, 249, 0.82));
  box-shadow: inset 0 -2px 0 rgba(29, 111, 74, 0.10), var(--hairline-shadow);
}

.lease-row-wide .lease-facts small {
  display: block;
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lease-row-wide .lease-facts strong {
  overflow-wrap: anywhere;
  color: #151815;
  font-size: 13px;
  line-height: 1.2;
}

.lease-row-wide .lease-facts .fact-gross strong {
  color: #16733e;
  font-size: 16px;
  font-weight: 920;
}

.lease-row-wide .lease-status {
  align-self: center;
}

.people-directory {
  max-width: 900px;
}

.side-stack {
  display: grid;
  gap: 16px;
}

.lease-detail-workspace {
  display: block;
}

.lease-detail-workspace.is-locked .lease-detail-form input:not([type="hidden"]),
.lease-detail-workspace.is-locked .lease-detail-form textarea,
.lease-detail-workspace.is-locked .lease-detail-form select {
  background: rgba(244, 247, 251, 0.72);
  color: rgba(38, 50, 65, 0.68);
  cursor: not-allowed;
}

.lease-detail-workspace.is-locked .check-pill {
  opacity: .68;
}

.lease-data-title {
  align-items: start;
}

.lease-data-title .btn {
  white-space: nowrap;
}

.lease-detail-panels {
  display: grid;
  grid-template-columns: minmax(280px, .75fr) minmax(560px, 1.45fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 24px;
}

.lease-parties-panel,
.lease-data-panel {
  min-width: 0;
}

.party-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.party-summary-grid span {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.78);
}

.party-summary-grid small,
.contract-term-pills small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.party-summary-grid strong,
.contract-term-pills strong {
  overflow-wrap: anywhere;
  color: #151815;
  font-size: 13px;
  line-height: 1.2;
}

.party-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.party-person-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.party-person-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid rgba(29, 36, 48, 0.08);
}

.party-person-row:last-child {
  border-bottom: 0;
}

.party-person-row > span:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.party-person-row strong {
  color: #151815;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.party-person-row small {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.party-role {
  align-self: start;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.15;
  white-space: nowrap;
}

.party-role.owner {
  color: #1f4f38;
  background: rgba(219, 244, 229, 0.95);
  border: 1px solid rgba(39, 103, 73, 0.20);
}

.party-role.tenant {
  color: #234f9f;
  background: rgba(225, 238, 255, 0.95);
  border: 1px solid rgba(47, 102, 189, 0.20);
}

.party-link-list {
  margin-top: 12px;
}

.contract-term-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.contract-term-pills span {
  display: inline-grid;
  gap: 3px;
  min-width: 118px;
  max-width: 210px;
  padding: 8px 10px 8px 12px;
  border: 1px solid rgba(29, 36, 48, 0.06);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(244, 247, 251, 0.95), rgba(255, 255, 255, 0.72));
  box-shadow: inset 3px 0 0 rgba(111, 123, 138, 0.48), 0 8px 18px rgba(29, 36, 48, 0.05);
}

.contract-term-pills .term-pill.start {
  background: linear-gradient(135deg, rgba(227, 245, 235, 0.95), rgba(250, 255, 252, 0.78));
  box-shadow: inset 3px 0 0 rgba(44, 143, 94, 0.78), 0 8px 18px rgba(29, 36, 48, 0.05);
}

.contract-term-pills .term-pill.end {
  background: linear-gradient(135deg, rgba(255, 241, 220, 0.95), rgba(255, 252, 247, 0.78));
  box-shadow: inset 3px 0 0 rgba(207, 127, 36, 0.78), 0 8px 18px rgba(29, 36, 48, 0.05);
}

.contract-term-pills .term-pill.deposit {
  background: linear-gradient(135deg, rgba(229, 241, 235, 0.96), rgba(251, 255, 253, 0.78));
  box-shadow: inset 3px 0 0 rgba(31, 113, 77, 0.78), 0 8px 18px rgba(29, 36, 48, 0.05);
}

.contract-term-pills .term-pill.standard {
  background: linear-gradient(135deg, rgba(239, 243, 248, 0.98), rgba(255, 255, 255, 0.78));
  box-shadow: inset 3px 0 0 rgba(111, 123, 138, 0.78), 0 8px 18px rgba(29, 36, 48, 0.05);
}

.contract-term-pills .term-pill.index {
  background: linear-gradient(135deg, rgba(225, 238, 255, 0.98), rgba(248, 252, 255, 0.78));
  box-shadow: inset 3px 0 0 rgba(47, 102, 189, 0.86), 0 8px 18px rgba(29, 36, 48, 0.05);
}

.contract-term-pills .term-pill.step {
  background: linear-gradient(135deg, rgba(255, 246, 210, 0.96), rgba(255, 253, 244, 0.78));
  box-shadow: inset 3px 0 0 rgba(174, 132, 31, 0.82), 0 8px 18px rgba(29, 36, 48, 0.05);
}

.dashboard-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-form.lease-detail-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-form .full {
  grid-column: 1 / -1;
}

.dashboard-form .span-2 {
  grid-column: span 2;
}

.check-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid rgba(29, 36, 48, 0.10);
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.88);
  color: #263241;
  font-weight: 760;
}

.check-pill:has(input:checked) {
  border-color: rgba(47, 102, 189, 0.28);
  background: rgba(232, 240, 251, 0.94);
  color: #1e4f95;
}

.rent-adjustment-grid {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  gap: 12px;
}

.rent-adjustment-grid[hidden],
.adjustment-card[hidden] {
  display: none !important;
}

.rent-adjustment-grid.single-panel .adjustment-card:not([hidden]) {
  grid-column: 1 / -1;
}

.adjustment-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(29, 36, 48, 0.10);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(248, 251, 255, 0.80)),
    linear-gradient(90deg, rgba(232, 240, 251, 0.66), rgba(255, 255, 255, 0) 38%);
}

.adjustment-card.staffel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(248, 251, 255, 0.80)),
    linear-gradient(90deg, rgba(245, 236, 217, 0.74), rgba(255, 255, 255, 0) 38%);
}

.adjustment-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.adjustment-head strong {
  color: #151815;
  font-size: 15px;
}

.adjustment-head > span {
  display: grid;
  gap: 2px;
}

.index-source-name {
  color: var(--muted);
  font-size: 11px;
  font-weight: 740;
}

.index-refresh-button {
  padding: 7px 10px;
  font-size: 12px;
}

.adjustment-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.index-source-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.index-source-strip span {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.index-source-strip small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.index-source-strip strong {
  overflow-wrap: anywhere;
  color: #263241;
  font-size: 12px;
}

.legal-hint {
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
  color: #546153;
  font-size: 12px;
  font-weight: 760;
}

.step-builder {
  display: grid;
  gap: 8px;
}

.step-row {
  display: grid;
  grid-template-columns: 34px minmax(120px, .72fr) minmax(130px, 1fr);
  gap: 8px;
  align-items: end;
}

.step-row[hidden] {
  display: none;
}

.step-number {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: 4px;
  border-radius: 8px;
  background: rgba(241, 213, 151, 0.50);
  color: #6f5420;
  font-weight: 850;
}

.add-step-row {
  justify-self: start;
}

.add-step-row:disabled {
  opacity: .46;
  cursor: default;
}

.fact-list {
  display: grid;
  gap: 10px;
}

.fact-list span {
  display: grid;
  gap: 3px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(29, 36, 48, 0.08);
}

.fact-list span:last-child {
  border-bottom: 0;
}

.fact-list small,
.compact-row small {
  color: var(--muted);
  font-weight: 680;
}

.fact-list strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.linked-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.compact-list {
  display: grid;
  gap: 8px;
}

.compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid rgba(29, 36, 48, 0.08);
}

.compact-row:last-child {
  border-bottom: 0;
}

.compact-row:hover {
  transform: translateX(2px);
}

.compact-row > span:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.compact-row strong {
  overflow-wrap: anywhere;
}

.compact-row-meta {
  display: grid;
  justify-items: end;
  gap: 5px;
  white-space: nowrap;
}

.compact-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@supports selector(:has(*)) {
  .metric-strip:has(.metric-card:hover) .metric-card:not(:hover) {
    opacity: .86;
  }
}

@container (max-width: 1040px) {
  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workbench-grid,
  .people-leases-grid,
  .overview-grid,
  .lease-detail-panels,
  .overview-grid.compact-dashboard {
    grid-template-columns: 1fr;
  }

  .detail-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lease-row-wide .lease-main {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "tags"
      "relations"
      "facts";
  }

  .lease-row-wide .lease-tags {
    justify-content: flex-start;
  }

  .lease-row-wide .lease-relationship,
  .lease-row-wide .lease-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 12px;
  }

  .primary-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .secondary-nav {
    gap: 4px;
  }

  .main {
    padding: 14px;
  }

  .topbar {
    margin: -14px -14px 14px;
    padding: 9px 14px;
  }

  .metric-strip,
  .triage-stats,
  .unit-tile-grid,
  .lease-facts,
  .detail-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-form,
  .dashboard-form.lease-detail-form,
  .compact-options,
  .party-summary-grid,
  .lease-relationship,
  .parking-picker-toolbar {
    grid-template-columns: 1fr;
  }

  .parking-option {
    min-height: 44px;
  }

  .parking-picker-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-form .span-2,
  .rent-adjustment-grid,
  .adjustment-fields,
  .index-source-strip,
  .step-row {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
  }

  .step-number {
    margin-bottom: 0;
  }

  .lease-row-wide .lease-main,
  .lease-row-wide .lease-relationship,
  .lease-row-wide .lease-facts {
    grid-template-columns: 1fr;
  }

  .lease-row-wide {
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: start;
  }

  .lease-row-wide .unit-avatar {
    min-height: 72px;
  }

  .lease-row-wide .lease-status {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .lease-row-wide .lease-main {
    grid-template-areas:
      "title"
      "tags"
      "relations"
      "facts";
  }

  .workbench-head,
  .triage-head,
  .triage-card header,
  .triage-suggestion,
  .split-heading,
  .section-kicker,
  .detail-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .task-row,
  .owner-account-row,
  .lease-work-card {
    grid-template-columns: 1fr;
  }

  .triage-actions {
    justify-content: stretch;
  }

  .triage-actions .btn {
    flex: 1 1 auto;
  }
}

/* Object dossier */
.object-icon-svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.object-icon {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #1e4f95;
  background: linear-gradient(145deg, rgba(232, 240, 251, 0.98), rgba(255, 255, 255, 0.78));
  border: 1px solid rgba(47, 102, 189, 0.12);
  box-shadow: var(--hairline-shadow), 0 10px 22px rgba(47, 102, 189, 0.08);
}

.object-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  padding: 24px;
  margin-bottom: 18px;
  overflow: hidden;
  color: #fff;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(16, 35, 56, 0.98) 0%, rgba(29, 111, 74, 0.96) 54%, rgba(47, 102, 189, 0.96) 100%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0));
  box-shadow: 0 24px 60px rgba(16, 35, 56, 0.18), var(--hairline-shadow);
}

.object-hero-main {
  display: flex;
  gap: 16px;
  min-width: 0;
  align-items: flex-start;
}

.object-hero .hero-icon {
  width: 52px;
  height: 52px;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.16);
}

.object-hero h1 {
  margin: 2px 0 6px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.02;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.object-hero p {
  margin: 0;
  max-width: 760px;
  color: rgba(255, 255, 255, 0.82);
}

.object-hero .eyebrow {
  color: rgba(255, 255, 255, 0.68);
}

.object-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-content: flex-start;
  gap: 8px;
  max-width: 520px;
}

.object-hero-actions .btn {
  gap: 8px;
  color: #17312f;
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(255, 255, 255, 0.22);
  white-space: nowrap;
}

.object-hero-actions .btn.primary {
  color: #fff;
  background: linear-gradient(145deg, #111827 0%, #263a38 58%, #2f66bd 100%);
}

.object-hero-kpis {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.object-hero-kpis span {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 94px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: var(--hairline-shadow);
}

.object-hero-kpis small,
.object-hero-kpis em {
  color: rgba(255, 255, 255, 0.70);
  font-style: normal;
  font-weight: 700;
}

.object-hero-kpis strong {
  color: #fff;
  font-size: 22px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.object-setup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.object-status-card,
.object-next-card,
.object-card {
  position: relative;
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(29, 36, 48, 0.10);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--soft-shadow), var(--hairline-shadow);
  backdrop-filter: blur(16px) saturate(1.08);
  animation: panelIn var(--motion-slow) both;
}

.object-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.object-card-head > div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.object-status-card .object-card-head > div,
.object-next-card .object-card-head > div {
  display: block;
}

.object-card-head h2,
.object-check-columns h3 {
  margin: 0;
  color: #11140f;
  line-height: 1.16;
  letter-spacing: 0;
}

.object-card-head h2 {
  font-size: 19px;
  overflow-wrap: anywhere;
}

.object-card-head .eyebrow {
  margin: 0 0 3px;
}

.object-status-legend,
.object-card-actions,
.object-mini-checks,
.object-chip-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.object-card-actions {
  margin-top: 16px;
}

.object-card-actions .btn {
  gap: 8px;
}

.object-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 9px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 820;
  line-height: 1;
  white-space: nowrap;
  box-shadow: var(--hairline-shadow);
}

.object-badge.info,
.object-mini-checks span.info {
  color: #1f6f4d;
  background: rgba(232, 242, 222, 0.94);
}

.object-badge.warning,
.object-mini-checks span.warning {
  color: #79560b;
  background: rgba(245, 236, 217, 0.96);
}

.object-badge.critical,
.object-mini-checks span.critical {
  color: #9c3333;
  background: rgba(245, 229, 229, 0.98);
}

.object-progress {
  height: 12px;
  margin-bottom: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(29, 36, 48, 0.08);
}

.object-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1d6f4a 0%, #2f66bd 74%, #9a7417 100%);
  animation: meterIn 900ms cubic-bezier(.16, 1, .3, 1) both;
}

.object-check-columns {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
}

.object-check-columns h3 {
  margin-bottom: 8px;
  color: #59615b;
  font-size: 13px;
}

.object-check-list,
.object-status-list,
.object-document-list,
.object-year-list,
.object-step-list {
  display: grid;
  gap: 8px;
}

.object-check-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 42px;
  padding: 8px 0;
  color: #151815;
  text-decoration: none;
  border-bottom: 1px solid rgba(29, 36, 48, 0.08);
}

.object-check-row:last-child {
  border-bottom: 0;
}

.object-check-row.done {
  grid-template-columns: 22px minmax(0, 1fr);
  color: #1f6f4d;
}

.object-check-row small {
  display: block;
  margin-top: 2px;
  color: #667066;
  line-height: 1.25;
}

.object-check-row.warning .object-icon-svg {
  color: #79560b;
}

.object-check-row.critical .object-icon-svg {
  color: #9c3333;
}

.object-step-list {
  padding: 0;
  margin: 0;
  list-style: none;
  counter-reset: object-steps;
}

.object-step-list li {
  min-width: 0;
}

.object-step-list a {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 8px 0;
  color: #151815;
  text-decoration: none;
  border-bottom: 1px solid rgba(29, 36, 48, 0.08);
}

.object-step-list a:hover,
.object-check-row:hover {
  transform: translateX(3px);
}

.object-step-list span:first-child {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: #fff;
  background: #171a16;
  font-size: 12px;
  font-weight: 850;
}

.object-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.object-card {
  min-height: 100%;
}

.object-fact-list,
.object-metric-grid {
  display: grid;
  gap: 10px;
}

.object-fact-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.object-fact-list span,
.object-metric-grid span,
.object-status-list > span,
.object-document-list > span {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 0;
  border-bottom: 1px solid rgba(29, 36, 48, 0.08);
}

.object-fact-list span:nth-last-child(-n + 2),
.object-metric-grid span:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.object-fact-list.technical span {
  border-left: 3px solid rgba(31, 111, 77, 0.36);
  padding-left: 10px;
}

.object-fact-list.technical span.warning {
  border-left-color: #c49333;
}

.object-fact-list small,
.object-metric-grid small,
.object-status-list small,
.object-document-list small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.object-fact-list strong,
.object-metric-grid strong,
.object-status-list strong,
.object-document-list strong {
  color: #151815;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.object-metric-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.object-metric-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.object-metric-grid strong {
  font-size: 23px;
}

.object-alert {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 8px;
  box-shadow: var(--hairline-shadow);
}

.object-alert.info {
  color: #1f6f4d;
  background: rgba(232, 242, 222, 0.58);
}

.object-alert.warning {
  color: #79560b;
  background: rgba(245, 236, 217, 0.72);
}

.object-alert.critical {
  color: #9c3333;
  background: rgba(245, 229, 229, 0.78);
}

.object-alert strong,
.object-alert small {
  display: block;
}

.object-alert small {
  margin-top: 3px;
  color: #5f665f;
}

.object-year-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, auto);
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(29, 36, 48, 0.08);
}

.object-year-row.active {
  padding: 12px;
  border: 1px solid rgba(47, 102, 189, 0.16);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(232, 240, 251, 0.86), rgba(255, 255, 255, 0.72));
}

.object-year-row strong,
.object-year-row small {
  display: block;
}

.object-year-row small {
  margin-top: 2px;
  color: var(--muted);
}

.object-mini-checks {
  justify-content: flex-end;
}

.object-mini-checks span,
.object-chip-cloud span {
  min-height: 25px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.object-chip-cloud span {
  color: #263241;
  background: rgba(248, 251, 255, 0.86);
  border: 1px solid rgba(29, 36, 48, 0.08);
  box-shadow: var(--hairline-shadow);
}

.object-status-list > span {
  grid-template-columns: minmax(150px, 0.9fr) auto minmax(180px, 1.2fr);
  align-items: center;
}

.object-document-list > span {
  grid-template-columns: minmax(150px, 0.85fr) minmax(0, 1fr) auto;
  align-items: center;
  border-left: 3px solid rgba(31, 111, 77, 0.38);
  padding-left: 10px;
}

.object-document-list > span.warning {
  border-left-color: #c49333;
}

.object-document-list > span.critical {
  border-left-color: #9c3333;
}

.object-empty {
  margin: 0;
  padding: 12px 0;
  color: var(--muted);
}

.address-fieldset {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(29, 36, 48, 0.10);
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.58);
  box-shadow: var(--hairline-shadow);
}

.person-edit-form {
  align-items: start;
}

.form-section-title {
  display: grid;
  gap: 2px;
  margin-top: 4px;
  padding-top: 4px;
}

.form-section-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.form-section-title strong {
  color: #16202c;
  font-size: 18px;
  font-weight: 500;
}

.address-fieldset.subtle {
  background: #fbfcfe;
  border-color: rgba(29, 36, 48, 0.07);
}

.address-fieldset.subtle legend {
  color: #657084;
}

.address-derived-card {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: .5px solid rgba(14, 143, 131, 0.22);
  border-radius: 8px;
  background: #edf8f5;
  color: #176256;
}

.address-derived-card.subtle {
  border-color: rgba(29, 36, 48, 0.08);
  background: #fbfcfe;
  color: #657084;
}

.address-derived-card span,
.address-derived-card small {
  font-size: 12px;
  font-weight: 400;
}

.address-derived-card strong {
  color: currentColor;
  font-size: 15px;
  font-weight: 500;
}

.address-fieldset legend {
  padding: 0 6px;
  color: #404842;
  font-size: 13px;
  font-weight: 820;
}

.address-fieldset legend small {
  color: var(--muted);
  font-weight: 680;
}

.address-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.45fr) minmax(90px, 0.55fr) minmax(90px, 0.55fr) minmax(160px, 1fr);
  gap: 10px;
}

@container (max-width: 1040px) {
  .object-hero,
  .object-setup-layout,
  .object-card-grid {
    grid-template-columns: 1fr;
  }

  .object-hero-actions {
    justify-content: flex-start;
    max-width: none;
  }

  .object-hero-kpis,
  .object-metric-grid,
  .object-metric-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .object-hero,
  .object-status-card,
  .object-next-card,
  .object-card {
    padding: 14px;
  }

  .object-hero-main,
  .object-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .object-hero-actions .btn {
    flex: 1 1 220px;
    white-space: normal;
  }

  .object-hero-kpis,
  .object-check-columns,
  .object-fact-list,
  .object-metric-grid,
  .object-metric-grid.compact,
  .object-year-row,
  .object-status-list > span,
  .object-document-list > span,
  .object-step-list a,
  .object-check-row,
  .address-grid {
    grid-template-columns: 1fr;
  }

  .object-status-legend,
  .object-mini-checks {
    justify-content: flex-start;
  }
}

/* Login scene */
.login-page {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  grid-template-columns: minmax(420px, 1fr) minmax(360px, 460px);
  align-items: center;
  gap: clamp(28px, 5vw, 76px);
  padding: clamp(22px, 4vw, 54px);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(10, 23, 37, 0.22) 0%, rgba(11, 30, 44, 0.05) 46%, rgba(245, 249, 247, 0.78) 78%, rgba(255, 255, 255, 0.92) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(12, 35, 52, 0.30)),
    url("/assets/login-building.png") center / cover no-repeat;
}

.login-page::before,
.login-page::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: -1;
}

.login-page::before {
  inset: -18% -12%;
  background:
    linear-gradient(108deg, transparent 0 43%, rgba(255, 255, 255, 0.38) 48%, rgba(255, 255, 255, 0.10) 56%, transparent 64%),
    radial-gradient(ellipse at 76% 24%, rgba(255, 244, 205, 0.62), transparent 34%),
    linear-gradient(180deg, rgba(77, 161, 216, 0.18), rgba(26, 86, 91, 0.10));
  mix-blend-mode: screen;
  transform: translate3d(-3%, 0, 0);
  animation: loginLightDrift 12s ease-in-out infinite alternate;
}

.login-page::after {
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.00) 0%, rgba(12, 31, 45, 0.10) 100%),
    linear-gradient(90deg, rgba(5, 18, 30, 0.34) 0%, rgba(5, 18, 30, 0.04) 52%, rgba(255, 255, 255, 0.30) 100%);
}

.login-visual {
  position: relative;
  display: block;
  min-height: min(620px, 72vh);
}

.login-light-lines {
  position: absolute;
  inset: 8% 4% auto auto;
  width: min(520px, 46vw);
  height: 360px;
  overflow: hidden;
  opacity: 0.86;
}

.login-light-lines span {
  position: absolute;
  left: 8%;
  right: -18%;
  height: 1px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.62), rgba(113, 186, 224, 0.18), transparent);
  transform: rotate(-28deg) translateX(-24%);
  animation: loginRaySweep 8s ease-in-out infinite;
}

.login-light-lines span:nth-child(1) {
  top: 26%;
}

.login-light-lines span:nth-child(2) {
  top: 48%;
  animation-delay: 1.4s;
  opacity: 0.72;
}

.login-light-lines span:nth-child(3) {
  top: 70%;
  animation-delay: 2.8s;
  opacity: 0.55;
}

.login-ambient-card {
  position: absolute;
  left: clamp(14px, 6vw, 88px);
  bottom: clamp(24px, 7vh, 82px);
  display: grid;
  gap: 3px;
  max-width: 320px;
  padding: 14px 16px;
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(9, 26, 42, 0.34), rgba(255, 255, 255, 0.08));
  box-shadow: 0 22px 60px rgba(6, 23, 36, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(16px) saturate(1.2);
  animation: loginFloatIn 900ms cubic-bezier(.16, 1, .3, 1) 160ms both, loginFloat 8s ease-in-out 1.2s infinite;
}

.login-ambient-card strong {
  font-size: 16px;
  line-height: 1.1;
}

.login-ambient-card span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 720;
}

.login-box.glass-card {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  justify-self: end;
  padding: clamp(24px, 3.2vw, 34px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.62);
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.66)),
    linear-gradient(180deg, rgba(232, 240, 251, 0.54), rgba(232, 242, 222, 0.22));
  box-shadow:
    0 34px 90px rgba(8, 30, 45, 0.23),
    0 1px 0 rgba(255, 255, 255, 0.82) inset;
  backdrop-filter: blur(24px) saturate(1.18);
  animation: loginPanelIn 780ms cubic-bezier(.16, 1, .3, 1) both;
}

.login-box.glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.64), transparent 34%),
    linear-gradient(270deg, rgba(47, 102, 189, 0.12), transparent 44%);
  opacity: 0.85;
}

.login-box.glass-card::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #f6d36a 0%, #5abfa8 46%, #2f66bd 100%);
  opacity: 0.88;
}

.login-box > * {
  position: relative;
  z-index: 1;
}

.login-brand-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 18px;
  color: #fff;
  border-radius: 8px;
  background: linear-gradient(145deg, #102338 0%, #1d6f4a 52%, #2f66bd 100%);
  box-shadow: 0 16px 34px rgba(47, 102, 189, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.30);
  font-weight: 900;
}

.login-box .eyebrow {
  display: block;
  color: #3d6b62;
}

.login-box .page-title {
  margin: 6px 0 8px;
  color: #121915;
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 850;
  line-height: 1;
}

.login-box .muted {
  margin: 0 0 22px;
  color: #4d5a57;
}

.login-box form.grid {
  gap: 13px;
}

.login-box label {
  color: #28342f;
}

.login-box input {
  min-height: 44px;
  border-color: rgba(29, 36, 48, 0.14);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.login-box input:focus {
  border-color: rgba(47, 102, 189, 0.36);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 4px rgba(47, 102, 189, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.login-button {
  min-height: 46px;
  margin-top: 4px;
  background: linear-gradient(145deg, #101914 0%, #1d6f4a 48%, #2f66bd 100%);
  box-shadow: 0 18px 36px rgba(47, 102, 189, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.20);
}

.login-button:hover {
  transform: translateY(-2px);
}

@keyframes loginPanelIn {
  from {
    opacity: 0;
    transform: translate3d(26px, 14px, 0) scale(.985);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes loginFloatIn {
  from {
    opacity: 0;
    transform: translate3d(-18px, 18px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes loginFloat {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -8px, 0);
  }
}

@keyframes loginLightDrift {
  from {
    transform: translate3d(-3%, 0, 0) scale(1);
    opacity: .82;
  }
  to {
    transform: translate3d(3%, -1%, 0) scale(1.03);
    opacity: 1;
  }
}

@keyframes loginRaySweep {
  0% {
    transform: rotate(-28deg) translateX(-34%);
    opacity: 0;
  }
  28%,
  62% {
    opacity: 1;
  }
  100% {
    transform: rotate(-28deg) translateX(18%);
    opacity: 0;
  }
}

@media (max-width: 900px) {
  .login-page {
    grid-template-columns: 1fr;
    align-items: end;
    min-height: 100vh;
    padding: 18px;
    background-position: 38% center;
  }

  .login-visual {
    display: block;
    position: absolute;
    inset: 0;
    min-height: auto;
  }

  .login-light-lines,
  .login-ambient-card {
    display: none;
  }

  .login-box.glass-card {
    justify-self: center;
    width: min(100%, 440px);
    margin-top: min(26vh, 180px);
  }
}

/* People register */
.people-register-page,
.person-detail-page {
  position: relative;
  isolation: isolate;
}

.people-register-page::before,
.person-detail-page::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 260px;
  height: 360px;
  pointer-events: none;
  z-index: -1;
  background:
    linear-gradient(118deg, rgba(255, 255, 255, 0) 0%, rgba(86, 173, 211, 0.16) 32%, rgba(255, 255, 255, 0.44) 48%, rgba(55, 138, 125, 0.12) 68%, rgba(255, 255, 255, 0) 100%),
    linear-gradient(180deg, rgba(240, 249, 252, 0.90), rgba(243, 247, 251, 0));
  animation: personLightSweep 16s ease-in-out infinite alternate;
}

.person-register-hero,
.person-detail-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding: 28px;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(244, 250, 252, 0.76) 44%, rgba(232, 244, 249, 0.84)),
    linear-gradient(90deg, rgba(14, 143, 131, 0.10), rgba(39, 100, 216, 0.10));
  box-shadow: 0 26px 60px rgba(31, 45, 61, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px) saturate(1.12);
}

.person-register-hero::after,
.person-detail-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0) 18%, rgba(255, 255, 255, 0.58) 44%, rgba(255, 255, 255, 0) 62%);
  transform: translateX(-56%);
  animation: personPanelSheen 8s ease-in-out infinite;
  pointer-events: none;
}

.person-register-hero > *,
.person-detail-hero > * {
  position: relative;
  z-index: 1;
}

.person-register-hero h1,
.person-detail-hero h1 {
  margin: 4px 0 6px;
  font-size: 36px;
  line-height: 1.06;
  letter-spacing: 0;
}

.person-register-hero p,
.person-detail-hero p {
  max-width: 700px;
  margin: 0;
  color: #526174;
  font-size: 16px;
}

.btn-glyph {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.22);
  color: currentColor;
  font-size: 12px;
  line-height: 1;
}

.person-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.person-stat-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 132px;
  padding: 18px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 16px 36px rgba(31, 45, 61, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.80);
  backdrop-filter: blur(14px) saturate(1.08);
}

.person-stat-card.primary {
  background: linear-gradient(145deg, rgba(231, 247, 244, 0.94), rgba(255, 255, 255, 0.78));
  box-shadow: inset 4px 0 0 rgba(14, 143, 131, 0.78), 0 16px 36px rgba(31, 45, 61, 0.08);
}

.person-stat-card.warn {
  background: linear-gradient(145deg, rgba(255, 248, 231, 0.95), rgba(255, 255, 255, 0.78));
  box-shadow: inset 4px 0 0 rgba(245, 158, 11, 0.76), 0 16px 36px rgba(31, 45, 61, 0.08);
}

.person-stat-card span,
.person-overview-grid small,
.payment-row small,
.document-chip-list small {
  color: #657084;
  font-size: 12px;
  font-weight: 780;
}

.person-stat-card strong {
  color: #16202c;
  font-size: 30px;
  line-height: 1;
}

.person-stat-card small {
  color: #6a7687;
  font-size: 12px;
}

.person-control-panel,
.person-directory-shell,
.person-quality-card,
.person-next-steps,
.person-create-board,
.person-detail-card {
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 18px 44px rgba(31, 45, 61, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(16px) saturate(1.10);
}

.person-control-panel,
.person-directory-shell,
.person-quality-card,
.person-next-steps,
.person-create-board,
.person-detail-card {
  padding: 18px;
  margin-bottom: 18px;
}

.person-search {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.person-search label,
.create-field-grid label {
  display: grid;
  gap: 6px;
  margin: 0;
  color: #3c4655;
  font-size: 12px;
  font-weight: 800;
}

.person-search input,
.create-field-grid input,
.create-field-grid select {
  width: 100%;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid rgba(29, 36, 48, 0.12);
  background: rgba(248, 251, 255, 0.92);
  color: #16202c;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.person-search input:focus,
.create-field-grid input:focus,
.create-field-grid select:focus {
  outline: 0;
  border-color: rgba(39, 100, 216, 0.42);
  box-shadow: 0 0 0 4px rgba(39, 100, 216, 0.12);
}

.person-filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.person-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.person-filter-pills a {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.76);
  color: #354052;
  font-size: 13px;
  font-weight: 820;
  text-decoration: none;
}

.person-filter-pills a.active {
  color: #0f1722;
  background: #fff;
  border-color: rgba(14, 143, 131, 0.26);
  box-shadow: inset 0 -2px 0 rgba(14, 143, 131, 0.74), 0 10px 22px rgba(31, 45, 61, 0.08);
}

.person-insight-grid,
.person-detail-grid,
.person-create-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.person-create-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(280px, .85fr);
}

.section-title .quality-score,
.directory-count {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.92);
  color: #354052;
  font-size: 12px;
  font-weight: 860;
}

.quality-score.info {
  color: #1f4f38;
  background: rgba(222, 246, 233, 0.86);
}

.quality-score.warning {
  color: #80510d;
  background: rgba(255, 244, 221, 0.92);
}

.quality-score.critical {
  color: #8a2e2e;
  background: rgba(255, 230, 230, 0.92);
}

.quality-list,
.duplicate-list,
.payment-list,
.role-assignment-list,
.person-audit-timeline {
  display: grid;
  gap: 10px;
}

.quality-row,
.duplicate-row,
.payment-row,
.role-assignment-row,
.person-audit-event {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.82);
  color: #1d2430;
  text-decoration: none;
}

.quality-row strong,
.duplicate-row strong,
.payment-row strong,
.role-assignment-row strong,
.person-audit-event strong {
  display: block;
  color: #16202c;
  overflow-wrap: anywhere;
}

.quality-row small,
.duplicate-row small,
.role-assignment-row small,
.person-audit-event small {
  display: block;
  color: #657084;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.quality-row b,
.payment-row b {
  color: #1d2430;
  font-size: 12px;
  white-space: nowrap;
}

.quality-row.warning,
.payment-row.warning,
.document-chip-list .warning,
.person-audit-event.warning {
  border-color: rgba(245, 158, 11, 0.24);
  background: linear-gradient(135deg, rgba(255, 247, 230, 0.94), rgba(255, 255, 255, 0.74));
}

.quality-row.critical,
.document-chip-list .critical {
  border-color: rgba(163, 59, 59, 0.22);
  background: linear-gradient(135deg, rgba(255, 235, 235, 0.94), rgba(255, 255, 255, 0.74));
}

.quality-row.info,
.payment-row.ok,
.document-chip-list .ok,
.person-audit-event.info {
  border-color: rgba(14, 143, 131, 0.18);
  background: linear-gradient(135deg, rgba(229, 247, 243, 0.90), rgba(255, 255, 255, 0.74));
}

.duplicate-row {
  grid-template-columns: 1fr;
}

.duplicate-row span,
.duplicate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.people-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.people-register-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
}

.people-register-table th,
.people-register-table td {
  padding: 14px;
  border-bottom: 1px solid rgba(29, 36, 48, 0.08);
  text-align: left;
  vertical-align: middle;
}

.people-register-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(248, 251, 255, 0.94);
  color: #657084;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.people-register-table tr:last-child td {
  border-bottom: 0;
}

.people-register-table tr {
  transition: background .18s ease, opacity .18s ease;
}

.people-register-table tbody tr:hover {
  background: rgba(239, 247, 252, 0.78);
}

.people-register-table tr.is-historical,
.person-mobile-card.is-historical {
  opacity: .64;
}

.person-name-cell,
.person-mobile-card,
.person-detail-identity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  color: #1d2430;
  text-decoration: none;
}

.person-avatar {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  color: #102338;
  background: linear-gradient(145deg, rgba(229, 247, 243, 0.95), rgba(226, 239, 255, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 10px 20px rgba(31, 45, 61, 0.08);
  font-weight: 900;
  overflow: hidden;
}

.person-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.person-avatar.has-image {
  background: #eef2f7;
  color: transparent;
}

.person-avatar.tenant {
  background: linear-gradient(145deg, rgba(225, 238, 255, 0.95), rgba(255, 255, 255, 0.88));
  color: #234f9f;
}

.person-avatar.vendor {
  background: linear-gradient(145deg, rgba(255, 244, 221, 0.95), rgba(255, 255, 255, 0.88));
  color: #8a570c;
}

.person-avatar.large {
  width: 72px;
  height: 72px;
  font-size: 22px;
}

.person-name-cell strong,
.person-mobile-card strong {
  display: block;
  color: #16202c;
  font-size: 14px;
}

.person-title-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
}

.role-badge-row.inline,
.role-badge-row.detail-inline {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  vertical-align: middle;
}

.role-badge-row.detail-inline {
  gap: 10px;
}

.person-name-cell small,
.person-mobile-card small,
.assignment-cell,
.contact-cell small {
  display: block;
  color: #657084;
  font-size: 12px;
}

.assignment-cell,
.contact-cell small {
  max-width: 260px;
  overflow-wrap: anywhere;
}

.role-badge-row,
.person-hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.role-badge-row i,
.role-badge-row a:not(.role-chip),
.person-state,
.person-alert {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 8px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  background: rgba(248, 251, 255, 0.92);
  color: #324052;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}

.role-chip {
  display: inline-grid;
  gap: 3px;
  align-content: center;
  min-height: 50px;
  min-width: 88px;
  padding: 9px 13px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.92);
  color: #324052;
  font-style: normal;
  text-decoration: none;
  white-space: nowrap;
}

.role-chip strong {
  display: block;
  color: currentColor;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.08;
}

.role-chip small {
  display: block;
  color: currentColor;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
  opacity: .82;
}

.role-badge-row i.owner,
.role-badge-row a.owner,
.role-chip.owner {
  border-color: rgba(14, 143, 131, 0.18);
  background: rgba(228, 247, 242, 0.95);
  color: #176256;
}

.role-badge-row i.tenant,
.role-badge-row a.tenant,
.role-chip.tenant {
  border-color: rgba(39, 100, 216, 0.18);
  background: rgba(226, 239, 255, 0.95);
  color: #244f9b;
}

.role-badge-row i.vendor,
.role-badge-row a.vendor,
.role-chip.vendor {
  border-color: rgba(245, 158, 11, 0.22);
  background: rgba(255, 244, 221, 0.95);
  color: #80510d;
}

.role-badge-row i.advisory,
.role-badge-row a.advisory,
.role-chip.advisory {
  border-color: rgba(122, 88, 184, 0.20);
  background: rgba(240, 234, 255, 0.95);
  color: #5b3d91;
}

.role-badge-row .muted {
  color: #778293;
  background: rgba(242, 245, 249, 0.9);
}

.person-state.active {
  color: #176256;
  background: rgba(228, 247, 242, 0.95);
}

.person-state.historical {
  color: #6c7380;
  background: rgba(239, 242, 246, 0.96);
}

.person-alert.warning {
  color: #80510d;
  background: rgba(255, 244, 221, 0.94);
}

.person-alert.critical {
  color: #8a2e2e;
  background: rgba(255, 231, 231, 0.94);
}

.people-card-list {
  display: none;
  gap: 10px;
}

.person-mobile-card {
  padding: 12px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.88);
}

.person-mobile-card b {
  display: block;
  margin: 5px 0;
  color: #354052;
  font-size: 12px;
  font-weight: 760;
}

.person-next-steps ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
}

.person-next-steps li {
  padding: 10px 0 10px 4px;
}

.person-next-steps a {
  display: block;
  color: #16202c;
  font-weight: 860;
  text-decoration: none;
}

.person-next-steps small {
  color: #657084;
}

.person-create-step {
  min-width: 0;
}

.person-create-step > b {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(145deg, #111827, #2764d8);
  color: #fff;
}

.person-create-step h3 {
  margin: 10px 0 12px;
  color: #16202c;
}

.create-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.role-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.role-choice-grid span {
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.82);
  color: #354052;
  font-size: 12px;
  font-weight: 840;
}

.role-choice-grid span.selected {
  color: #135d51;
  border-color: rgba(14, 143, 131, 0.24);
  background: rgba(229, 247, 243, 0.96);
  box-shadow: inset 0 -2px 0 rgba(14, 143, 131, 0.72);
}

.duplicate-preview {
  display: grid;
  align-content: start;
}

.duplicate-hint {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(245, 158, 11, 0.24);
  border-radius: 8px;
  background: rgba(255, 247, 230, 0.90);
}

.duplicate-hint.clear {
  border-color: rgba(14, 143, 131, 0.18);
  background: rgba(230, 248, 243, 0.9);
}

.duplicate-hint span {
  color: #657084;
  font-size: 12px;
}

.duplicate-actions {
  margin-top: 12px;
}

.person-detail-hero {
  align-items: center;
}

.person-detail-identity {
  align-items: start;
}

.person-contact-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 12px 0;
  color: #526174;
  font-size: 13px;
}

.person-detail-tabs {
  position: sticky;
  top: 71px;
  z-index: 15;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 0 18px;
  padding: 8px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 28px rgba(31, 45, 61, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.80);
  backdrop-filter: blur(18px) saturate(1.10);
  scrollbar-width: none;
}

.person-detail-tabs::-webkit-scrollbar {
  display: none;
}

.person-detail-tabs a {
  flex: 0 0 auto;
  padding: 9px 12px;
  border-radius: 8px;
  color: #354052;
  font-size: 13px;
  font-weight: 840;
  text-decoration: none;
}

.person-detail-tabs a:hover {
  background: rgba(29, 36, 48, 0.05);
}

.person-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.person-overview-grid.contact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.person-overview-grid span {
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 72px;
  padding: 12px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.84);
}

.person-overview-grid strong {
  color: #16202c;
  overflow-wrap: anywhere;
}

.role-assignment-row {
  grid-template-columns: minmax(0, 1fr) minmax(150px, auto);
}

.role-assignment-row.owner {
  border-color: rgba(14, 143, 131, 0.18);
  background: linear-gradient(135deg, rgba(229, 247, 243, 0.92), rgba(255, 255, 255, 0.78));
}

.role-assignment-row.tenant {
  border-color: rgba(39, 100, 216, 0.18);
  background: linear-gradient(135deg, rgba(226, 239, 255, 0.92), rgba(255, 255, 255, 0.78));
}

.role-assignment-row.vendor,
.role-assignment-row.advisory {
  border-color: rgba(245, 158, 11, 0.20);
  background: linear-gradient(135deg, rgba(255, 246, 224, 0.92), rgba(255, 255, 255, 0.78));
}

.role-assignment-row.historical,
.role-assignment-list.muted {
  opacity: .72;
}

.historical-roles {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(29, 36, 48, 0.08);
}

.historical-roles summary {
  cursor: pointer;
  color: #354052;
  font-weight: 850;
}

.historical-roles .role-assignment-list {
  margin-top: 10px;
}

.document-chip-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.document-chip-list span {
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 12px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.84);
}

.person-audit-event {
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: start;
}

.person-audit-event time {
  color: #657084;
  font-size: 12px;
  font-weight: 840;
}

.person-audit-event.muted {
  opacity: .68;
}

@keyframes personLightSweep {
  0% {
    transform: translateX(-2%);
    opacity: .72;
  }
  100% {
    transform: translateX(4%);
    opacity: 1;
  }
}

@keyframes personPanelSheen {
  0%,
  28% {
    transform: translateX(-64%);
    opacity: 0;
  }
  48% {
    opacity: .8;
  }
  72%,
  100% {
    transform: translateX(48%);
    opacity: 0;
  }
}

@media (max-width: 1180px) {
  .person-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .person-create-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .people-register-page::before,
  .person-detail-page::before {
    left: 0;
  }

  .person-register-hero,
  .person-detail-hero {
    display: grid;
    padding: 20px;
  }

  .person-register-hero h1,
  .person-detail-hero h1 {
    font-size: 30px;
  }

  .person-stat-grid,
  .person-insight-grid,
  .person-detail-grid {
    grid-template-columns: 1fr;
  }

  .person-search {
    grid-template-columns: 1fr;
  }

  .people-table-wrap {
    display: none;
  }

  .people-card-list {
    display: grid;
  }

  .person-overview-grid,
  .person-overview-grid.contact,
  .document-chip-list,
  .create-field-grid {
    grid-template-columns: 1fr;
  }

  .role-assignment-row,
  .quality-row,
  .payment-row,
  .person-audit-event {
    grid-template-columns: 1fr;
  }
}

/* Radiant product design layer */
:root {
  --bg: #f5f9fc;
  --panel: rgba(255, 255, 255, 0.88);
  --line: rgba(61, 88, 118, 0.13);
  --text: #172231;
  --muted: #66758a;
  --brand: #129b8e;
  --brand-2: #2e72dc;
  --brand-3: #f5b447;
  --danger: #a33b3b;
  --warning: #a86913;
  --ok: #22714f;
  --shadow: 0 24px 64px rgba(35, 54, 78, 0.13);
  --soft-shadow: 0 16px 42px rgba(35, 54, 78, 0.09);
  --glow-line: rgba(255, 255, 255, 0.78);
  --surface-glass: rgba(255, 255, 255, 0.76);
  --surface-veil: rgba(245, 250, 253, 0.70);
  --focus-ring: rgba(46, 114, 220, 0.16);
}

html {
  scroll-behavior: smooth;
  accent-color: var(--brand);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(245, 180, 71, 0.10) 0%, rgba(255, 255, 255, 0) 28%),
    linear-gradient(145deg, rgba(18, 155, 142, 0.10) 0%, rgba(255, 255, 255, 0) 38%),
    linear-gradient(210deg, rgba(46, 114, 220, 0.10) 0%, rgba(255, 255, 255, 0) 42%),
    linear-gradient(180deg, #f7fcff 0%, #f6fafc 44%, #edf5f8 100%);
  color: var(--text);
  cursor: default;
}

body::selection,
::selection {
  color: #0d1724;
  background: rgba(245, 180, 71, 0.34);
}

.app-shell {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  background:
    linear-gradient(118deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.64) 43%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.60), rgba(238, 247, 250, 0.58));
}

.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(104deg, rgba(255, 255, 255, 0) 12%, rgba(255, 255, 255, 0.50) 42%, rgba(255, 255, 255, 0) 63%),
    linear-gradient(156deg, rgba(245, 180, 71, 0.12), rgba(255, 255, 255, 0) 34%),
    linear-gradient(24deg, rgba(18, 155, 142, 0.10), rgba(255, 255, 255, 0) 46%),
    linear-gradient(305deg, rgba(46, 114, 220, 0.11), rgba(255, 255, 255, 0) 48%);
  animation: appAmbientLight 22s ease-in-out infinite alternate;
}

.app-shell::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.14) 0 1px, rgba(255, 255, 255, 0) 1px 96px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0));
  opacity: .62;
  animation: appLightThreads 28s linear infinite;
}

.sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(242, 249, 252, 0.74)),
    linear-gradient(155deg, rgba(18, 155, 142, 0.12), rgba(46, 114, 220, 0.07));
  color: #172231;
  box-shadow: 16px 0 44px rgba(35, 54, 78, 0.08), inset -1px 0 0 rgba(255, 255, 255, 0.66);
  backdrop-filter: blur(22px) saturate(1.16);
}

.brand,
.brand-lockup,
.brand small {
  color: #162232;
}

.brand-mark,
.login-brand-mark {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(232, 248, 245, 0.82)),
    linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #0d7269;
  box-shadow:
    0 18px 38px rgba(18, 155, 142, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    inset 0 -2px 0 rgba(46, 114, 220, 0.10);
}

.nav-group {
  color: rgba(68, 82, 101, 0.62);
}

.nav-list a,
.secondary-nav summary {
  position: relative;
  overflow: hidden;
  color: #435168;
  border: 1px solid transparent;
  background: transparent;
  transition: color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}

.nav-list a::after,
.secondary-nav summary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(112deg, rgba(255, 255, 255, 0) 12%, rgba(255, 255, 255, 0.72) 46%, rgba(255, 255, 255, 0) 70%);
  transform: translateX(-110%);
  opacity: 0;
  pointer-events: none;
}

.nav-list a:hover,
.secondary-nav summary:hover {
  color: #162232;
  border-color: rgba(18, 155, 142, 0.12);
  background: rgba(255, 255, 255, 0.66);
  transform: translateX(2px);
}

.nav-list a:hover::after,
.secondary-nav summary:hover::after {
  opacity: 1;
  animation: controlSheen 900ms ease;
}

.nav-list a.active {
  color: #102033;
  border-color: rgba(255, 255, 255, 0.74);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(231, 247, 244, 0.82)),
    linear-gradient(90deg, rgba(18, 155, 142, 0.16), rgba(46, 114, 220, 0.10));
  box-shadow: 0 14px 30px rgba(35, 54, 78, 0.10), inset 3px 0 0 rgba(18, 155, 142, 0.78);
}

.main {
  position: relative;
  padding: 32px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: -10px -10px 22px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 12px 34px rgba(35, 54, 78, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px) saturate(1.12);
}

.page-title {
  color: #142033;
  font-weight: 880;
  letter-spacing: 0;
}

:where(.panel, .metric-card, .triage-card, .lease-work-card, .object-card, .person-stat-card, .person-quality-card, .person-directory-shell, .person-create-board, .person-detail-card, .detail-hero, .workbench-head, .person-register-hero, .person-detail-hero, .object-hero, .accounting-year-card, .rule-card, .bank-card, .settings-card) {
  position: relative;
  overflow: hidden;
  border-color: rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(247, 251, 253, 0.76)),
    linear-gradient(120deg, rgba(18, 155, 142, 0.06), rgba(46, 114, 220, 0.05) 58%, rgba(245, 180, 71, 0.08));
  box-shadow:
    0 22px 54px rgba(35, 54, 78, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.90),
    inset 0 -1px 0 rgba(255, 255, 255, 0.44);
  backdrop-filter: blur(18px) saturate(1.12);
}

:where(.panel, .metric-card, .triage-card, .lease-work-card, .object-card, .person-stat-card, .person-quality-card, .person-directory-shell, .person-create-board, .person-detail-card, .detail-hero, .person-register-hero, .person-detail-hero)::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(112deg, rgba(255, 255, 255, 0) 18%, rgba(255, 255, 255, 0.48) 44%, rgba(255, 255, 255, 0) 62%);
  transform: translateX(-120%);
  opacity: 0;
  pointer-events: none;
}

:where(.panel, .metric-card, .triage-card, .lease-work-card, .object-card, .person-stat-card, .person-quality-card, .person-directory-shell, .person-create-board, .person-detail-card, .detail-hero, .person-register-hero, .person-detail-hero):hover::before {
  opacity: 1;
  animation: cardLightPass 1250ms ease;
}

:where(.panel, .metric-card, .triage-card, .lease-work-card, .object-card, .person-stat-card, .person-quality-card, .person-directory-shell, .person-create-board, .person-detail-card, .detail-hero, .person-register-hero, .person-detail-hero):hover {
  box-shadow:
    0 26px 66px rgba(35, 54, 78, 0.13),
    0 0 0 1px rgba(255, 255, 255, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.section-title h2,
.workbench-head h1,
.triage-head h1,
.split-heading h1,
.person-register-hero h1,
.person-detail-hero h1 {
  color: #142033;
  font-weight: 900;
  letter-spacing: 0;
}

.eyebrow {
  color: #0d887d;
  letter-spacing: .09em;
}

p,
small,
.muted {
  color: var(--muted);
}

:where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  min-height: 44px;
  border: 1px solid rgba(67, 83, 105, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 252, 253, 0.88)),
    linear-gradient(110deg, rgba(18, 155, 142, 0.05), rgba(46, 114, 220, 0.05));
  color: #172231;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 10px 24px rgba(35, 54, 78, 0.05);
  caret-color: var(--brand);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease, transform .16s ease;
}

:where(input:not([type="checkbox"]):not([type="radio"]), select, textarea):hover {
  border-color: rgba(18, 155, 142, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(248, 253, 254, 0.94)),
    linear-gradient(110deg, rgba(18, 155, 142, 0.08), rgba(46, 114, 220, 0.06));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 14px 28px rgba(35, 54, 78, 0.08);
}

:where(input:not([type="checkbox"]):not([type="radio"]), select, textarea):focus {
  outline: 0;
  border-color: rgba(46, 114, 220, 0.50);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(250, 253, 255, 0.96)),
    linear-gradient(115deg, rgba(255, 255, 255, 0) 0%, rgba(245, 180, 71, 0.10) 48%, rgba(255, 255, 255, 0) 100%);
  box-shadow:
    0 0 0 4px var(--focus-ring),
    0 18px 34px rgba(46, 114, 220, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.98);
  transform: translateY(-1px);
}

:where(input, textarea)::placeholder {
  color: rgba(102, 117, 138, 0.68);
}

textarea {
  line-height: 1.55;
}

label:has(:where(input, select, textarea):focus) {
  color: #0d887d;
}

label:has(:where(input, select, textarea):focus) > span:first-child,
label:has(:where(input, select, textarea):focus)::first-line {
  color: #0d887d;
}

:where(input[type="checkbox"], input[type="radio"]) {
  cursor: pointer;
}

.btn,
button {
  position: relative;
  overflow: hidden;
  min-height: 42px;
  border: 1px solid rgba(67, 83, 105, 0.13);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 251, 253, 0.86)),
    linear-gradient(135deg, rgba(18, 155, 142, 0.06), rgba(46, 114, 220, 0.05));
  color: #172231;
  box-shadow:
    0 13px 28px rgba(35, 54, 78, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
  cursor: pointer;
}

.btn::after,
button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(112deg, rgba(255, 255, 255, 0) 16%, rgba(255, 255, 255, 0.72) 45%, rgba(255, 255, 255, 0) 68%);
  transform: translateX(-118%);
  opacity: 0;
  pointer-events: none;
}

.btn:hover,
button:hover {
  transform: translateY(-2px);
  border-color: rgba(18, 155, 142, 0.24);
  box-shadow:
    0 18px 38px rgba(35, 54, 78, 0.12),
    0 0 0 1px rgba(255, 255, 255, 0.56),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.btn:hover::after,
button:hover::after {
  opacity: 1;
  animation: controlSheen 850ms ease;
}

.btn.primary,
button.primary {
  border-color: rgba(18, 155, 142, 0.20);
  color: #fff;
  background:
    linear-gradient(135deg, #0e8479 0%, #1867c9 64%, #3443a8 100%),
    linear-gradient(115deg, rgba(255, 255, 255, 0.30), rgba(255, 255, 255, 0));
  box-shadow:
    0 18px 38px rgba(46, 114, 220, 0.20),
    0 10px 22px rgba(18, 155, 142, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.62);
}

:where(.status-chip, .person-state, .person-alert, .role-badge-row i, .role-badge-row a, .role-chip, .badge-row i, .party-role, .quality-score, .directory-count, .check-pill, .term-pill) {
  border-radius: 8px;
  border-color: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 8px 18px rgba(35, 54, 78, 0.05);
}

:where(table, .people-table-wrap) {
  border-color: rgba(255, 255, 255, 0.70);
  background: rgba(255, 255, 255, 0.66);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

th {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(244, 250, 253, 0.90)),
    linear-gradient(90deg, rgba(18, 155, 142, 0.05), rgba(46, 114, 220, 0.05));
  color: #536176;
}

tr,
.compact-row,
.person-mobile-card,
.owner-account-row,
.party-person-row,
.lease-row-wide,
.quality-row,
.payment-row,
.role-assignment-row {
  transition: background .18s ease, box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}

tbody tr:hover,
.compact-row:hover,
.person-mobile-card:hover,
.owner-account-row:hover,
.party-person-row:hover,
.lease-row-wide:hover,
.quality-row:hover,
.payment-row:hover,
.role-assignment-row:hover {
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 30px rgba(35, 54, 78, 0.08);
  transform: translateY(-1px);
}

.flash {
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  box-shadow: 0 18px 34px rgba(35, 54, 78, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.login-page {
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0) 4%, rgba(255, 255, 255, 0.28) 37%, rgba(255, 255, 255, 0) 58%),
    linear-gradient(157deg, rgba(255, 224, 156, 0.40) 0%, rgba(255, 255, 255, 0) 32%),
    linear-gradient(86deg, rgba(9, 27, 44, 0.24), rgba(9, 27, 44, 0.06) 42%, rgba(255, 255, 255, 0.08)),
    url("/assets/login-building.png") center / cover no-repeat;
}

.login-page::before {
  background:
    linear-gradient(116deg, rgba(255, 255, 255, 0) 12%, rgba(255, 253, 230, 0.54) 42%, rgba(255, 255, 255, 0) 62%),
    repeating-linear-gradient(111deg, rgba(255, 255, 255, 0.16) 0 1px, rgba(255, 255, 255, 0) 1px 118px),
    linear-gradient(28deg, rgba(255, 220, 144, 0.32), rgba(255, 255, 255, 0) 44%),
    linear-gradient(180deg, rgba(76, 166, 218, 0.16), rgba(255, 255, 255, 0));
  mix-blend-mode: screen;
  animation: loginSunBreath 18s ease-in-out infinite alternate, loginSunDrift 28s linear infinite;
}

.login-page::after {
  background:
    linear-gradient(90deg, rgba(15, 42, 58, 0.42), rgba(15, 42, 58, 0.10) 38%, rgba(255, 255, 255, 0.20)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(9, 31, 45, 0.10));
}

.login-box.glass-card {
  border-color: rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(245, 251, 253, 0.54)),
    linear-gradient(125deg, rgba(255, 245, 213, 0.16), rgba(255, 255, 255, 0) 48%, rgba(114, 190, 227, 0.13));
  box-shadow:
    0 30px 90px rgba(6, 27, 44, 0.24),
    0 0 0 1px rgba(255, 255, 255, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.login-box.glass-card::before {
  animation: loginGlassGlint 7s ease-in-out infinite;
}

.login-ambient-card {
  border-color: rgba(255, 255, 255, 0.76);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.70), rgba(236, 249, 251, 0.46)),
    linear-gradient(115deg, rgba(255, 230, 166, 0.22), rgba(255, 255, 255, 0));
  box-shadow: 0 24px 64px rgba(8, 39, 57, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.login-light-lines span {
  background: linear-gradient(90deg, transparent, rgba(255, 248, 216, 0.92), rgba(255, 255, 255, 0.28), transparent);
  filter: blur(.5px);
}

.login-box input {
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(247, 252, 253, 0.60)),
    linear-gradient(110deg, rgba(255, 236, 185, 0.12), rgba(99, 181, 222, 0.10));
}

.login-box button.primary {
  min-height: 48px;
  background:
    linear-gradient(135deg, #0e8479 0%, #1d6ed0 58%, #3946ad 100%),
    linear-gradient(105deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0));
}

@keyframes appAmbientLight {
  0% {
    transform: translateX(-1.5%) translateY(-.5%);
    opacity: .72;
  }
  100% {
    transform: translateX(2.5%) translateY(.75%);
    opacity: 1;
  }
}

@keyframes appLightThreads {
  0% {
    background-position: 0 0, 0 0;
  }
  100% {
    background-position: 220px 0, 0 0;
  }
}

@keyframes cardLightPass {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(120%);
  }
}

@keyframes controlSheen {
  0% {
    transform: translateX(-118%);
  }
  100% {
    transform: translateX(118%);
  }
}

@keyframes loginSunBreath {
  0% {
    opacity: .44;
  }
  48% {
    opacity: .72;
  }
  100% {
    opacity: .58;
  }
}

@keyframes loginSunDrift {
  0% {
    background-position: -140px 0, 0 0, 0 0, 0 0;
  }
  100% {
    background-position: 180px 0, 220px 0, 0 0, 0 0;
  }
}

@keyframes loginGlassGlint {
  0%,
  32% {
    transform: translateX(-130%) rotate(8deg);
    opacity: 0;
  }
  48% {
    opacity: .70;
  }
  72%,
  100% {
    transform: translateX(130%) rotate(8deg);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.70);
  }

  .main {
    padding: 18px;
  }

  .topbar {
    margin: 0 0 18px;
  }
}

/* Simplified people views */
.people-simple-page,
.person-detail-simple-page {
  display: grid;
  gap: 16px;
}

.people-simple-header,
.person-detail-simple-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(29, 36, 48, 0.10);
}

.people-simple-header h1,
.person-detail-simple-header h1 {
  margin: 4px 0 5px;
  color: #16202c;
  font-size: 32px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: 0;
}

.people-simple-page .eyebrow {
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.people-simple-header p,
.person-detail-simple-header p {
  margin: 0;
  color: #657084;
}

.people-simple-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.people-simple-toolbar,
.people-simple-list-panel,
.person-primary-roles,
.person-simple-info-panel,
.simple-history {
  border: .5px solid rgba(29, 36, 48, 0.16);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}

.people-simple-toolbar,
.people-simple-list-panel,
.person-primary-roles,
.person-simple-info-panel {
  padding: 16px;
}

.people-simple-search {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}

.people-simple-search label {
  display: grid;
  gap: 6px;
  margin: 0;
  color: #3c4655;
  font-size: 12px;
  font-weight: 500;
}

.people-simple-search input {
  width: 100%;
  min-height: 44px;
  border-radius: 8px;
}

.people-simple-search button.primary {
  border-color: #16202c;
  background: #16202c;
  box-shadow: none;
}

.people-simple-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin-top: 12px;
}

.people-simple-filters .person-filter-pills a {
  min-height: 34px;
  padding: 7px 11px;
  border: .5px solid rgba(29, 36, 48, 0.16);
  background: #f8fafc;
  font-weight: 500;
  box-shadow: none;
}

.people-simple-filters .person-filter-pills a.active {
  border-color: rgba(14, 143, 131, 0.28);
  background: #fff;
  box-shadow: none;
}

.people-simple-list-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.people-simple-list-head strong {
  color: #16202c;
  font-size: 16px;
  font-weight: 500;
}

.people-simple-list-head span {
  color: #657084;
  font-size: 13px;
}

.people-simple-table-wrap {
  overflow-x: auto;
  border: .5px solid rgba(29, 36, 48, 0.16);
  border-radius: 8px;
  background: #fff;
}

.people-simple-table {
  width: 100%;
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0;
}

.people-simple-table th,
.people-simple-table td {
  padding: 8px 12px;
  border-bottom: .5px solid rgba(29, 36, 48, 0.16);
  text-align: left;
  vertical-align: middle;
}

.people-simple-table th {
  background: #fff;
  color: #657084;
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
}

.people-simple-table th:nth-child(2),
.people-simple-table td:nth-child(2) {
  text-align: right;
  width: 158px;
}

.people-simple-table th:nth-child(3),
.people-simple-table td:nth-child(3) {
  width: 250px;
}

.people-simple-table th:nth-child(4),
.people-simple-table td:nth-child(4) {
  width: 88px;
  text-align: right;
}

.people-simple-table tr:last-child td {
  border-bottom: 0;
}

.people-simple-table tbody tr:hover {
  background: #f7fafc;
  box-shadow: none;
  transform: none;
}

.people-simple-table tbody tr td:first-child,
.person-mobile-card {
  border-left: 4px solid #d8dee7;
}

.people-simple-table tbody tr.person-row-tone-owner td:first-child,
.person-mobile-card.person-row-tone-owner {
  border-left-color: #0e8f83;
}

.people-simple-table tbody tr.person-row-tone-tenant td:first-child,
.person-mobile-card.person-row-tone-tenant {
  border-left-color: #2764d8;
}

.people-simple-table tbody tr.person-row-tone-vendor td:first-child,
.person-mobile-card.person-row-tone-vendor {
  border-left-color: #f59e0b;
}

.people-simple-table tbody tr.person-row-tone-advisory td:first-child,
.person-mobile-card.person-row-tone-advisory {
  border-left-color: #7a58b8;
}

.people-simple-table tr.is-historical,
.person-mobile-card.is-historical {
  opacity: .66;
}

.person-unit-cell {
  min-width: 0;
}

.person-compact-person,
.person-mobile-card {
  color: inherit;
  text-decoration: none;
}

.person-compact-person {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 40px;
}

.person-initials-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: .5px solid rgba(29, 36, 48, 0.12);
  border-radius: 999px;
  background: #f6f8fb;
  color: #3d4858;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}

.person-name-and-units {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
  min-width: 0;
}

.person-name-and-units > strong,
.person-mobile-card > span > strong {
  color: #16202c;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
}

.unit-chip-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  min-width: 0;
}

.unit-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-height: 24px;
  padding: 3px 7px;
  border: .5px solid rgba(29, 36, 48, 0.10);
  border-radius: 6px;
  background: #f8fafc;
  color: #344055;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.unit-chip small {
  color: #657084;
  font-size: 11px;
  font-weight: 400;
}

.unit-chip.owner {
  border-color: rgba(14, 143, 131, 0.22);
  background: #edf8f5;
  color: #176256;
}

.unit-chip.tenant {
  border-color: rgba(39, 100, 216, 0.20);
  background: #eef5ff;
  color: #244f9b;
}

.unit-chip.vendor {
  border-color: rgba(245, 158, 11, 0.24);
  background: #fff7e8;
  color: #80510d;
}

.unit-chip.advisory {
  border-color: rgba(122, 88, 184, 0.20);
  background: #f5f1ff;
  color: #5b3d91;
}

.unit-chip.muted {
  color: #657084;
  background: #f6f8fb;
}

.unit-empty {
  color: #657084;
  font-size: 12px;
  font-weight: 400;
}

.person-balance-cell {
  white-space: nowrap;
}

.person-balance-cell strong,
.person-mobile-meta b {
  display: block;
  color: #657084;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
}

.person-balance-cell small,
.person-mobile-meta small,
.person-contact-stack small {
  display: block;
  color: #657084;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.25;
}

.person-balance-cell.balance-arrears strong,
.person-mobile-meta .balance-arrears {
  color: #a33b3b;
}

.person-balance-cell.balance-credit strong,
.person-mobile-meta .balance-credit {
  color: #276749;
}

.person-contact-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 8px;
  align-items: center;
  min-width: 0;
}

.person-contact-stack a {
  color: #2764d8;
  font-size: 13px;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.person-warning-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 2px 7px;
  border: .5px solid rgba(245, 158, 11, 0.28);
  border-radius: 999px;
  background: #fff7e8;
  color: #80510d;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.person-warning-pill span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #f59e0b;
  color: #fff;
  font-size: 10px;
  line-height: 1;
}

.person-mobile-card {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border: .5px solid rgba(29, 36, 48, 0.16);
  border-left-width: 4px;
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
  transition: background .12s ease, border-color .12s ease;
}

.people-simple-page .person-mobile-card:hover {
  background: #f7fafc;
  box-shadow: none;
  transform: none;
}

.person-mobile-card > span:last-child {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.person-mobile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: baseline;
}

.person-mobile-meta b {
  margin: 0;
}

.person-open-link {
  white-space: nowrap;
}

.person-detail-simple-header {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.back-link {
  grid-column: 1 / -1;
  justify-self: start;
  color: #4b5a6d;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.back-link:hover {
  color: #16202c;
}

.person-detail-simple-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.person-photo-link {
  display: grid;
  gap: 6px;
  justify-items: center;
  color: #657084;
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.person-photo-link:hover {
  color: #16202c;
}

.person-photo-link .person-avatar {
  outline: 3px solid rgba(255, 255, 255, 0.86);
  outline-offset: -3px;
}

.person-name-with-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}

.person-name-with-roles h1 {
  margin: 0;
}

.person-simple-info-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.person-fact-list {
  display: grid;
  gap: 9px;
  margin: 0;
}

.person-fact-list div {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 8px;
  background: #f8fafc;
}

.person-fact-list dt {
  margin: 0 0 3px;
  color: #657084;
  font-size: 12px;
  font-weight: 850;
}

.person-fact-list dd {
  margin: 0;
  color: #16202c;
  overflow-wrap: anywhere;
}

.simple-history {
  padding: 14px 16px;
}

.simple-history summary {
  cursor: pointer;
  color: #354052;
  font-weight: 850;
}

.simple-history .role-assignment-list {
  margin-top: 12px;
}

@media (max-width: 1100px) {
  .person-simple-info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .people-simple-header,
  .person-detail-simple-header,
  .people-simple-search {
    grid-template-columns: 1fr;
  }

  .people-simple-actions {
    justify-content: flex-start;
  }

  .people-simple-table-wrap {
    display: none;
  }

  .people-card-list {
    display: grid;
  }

  .person-detail-simple-main {
    align-items: start;
  }

  .role-assignment-row,
  .payment-row,
  .quality-row {
    grid-template-columns: 1fr;
  }
}

/* Klarhaus application layer */
.app-shell {
  grid-template-columns: 232px minmax(0, 1fr);
  background: #f6f7f4;
}

.app-shell .sidebar {
  padding: 18px 14px;
  background: #fbfbf8;
  border-right: 1px solid rgba(31, 41, 55, 0.10);
}

.app-shell .brand-lockup {
  padding: 6px 8px 16px;
  border-bottom: 1px solid rgba(31, 41, 55, 0.08);
  margin-bottom: 12px;
}

.app-shell .brand-mark {
  background: linear-gradient(145deg, #1e6c55 0%, #2d65b8 100%);
}

.app-shell .brand {
  color: #151a16;
  font-size: 15px;
}

.app-shell .primary-nav {
  display: grid;
  gap: 5px;
}

.app-shell .primary-nav a {
  min-height: 38px;
  gap: 10px;
  padding: 9px 10px;
  color: #3f4743;
  border: 1px solid transparent;
}

.app-shell .primary-nav a > span {
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 13px;
  line-height: 1.15;
}

.app-shell .primary-nav a.active {
  color: #111827;
  border-color: rgba(45, 101, 184, 0.16);
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(31, 41, 55, 0.08);
}

.app-shell .primary-nav a.active .kh-icon {
  color: #1e6c55;
}

.kh-icon,
.status-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.kh-icon.small,
.status-icon.small {
  width: 15px;
  height: 15px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-topbar {
  display: grid;
  grid-template-columns: minmax(190px, .72fr) minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 62px;
  background: rgba(246, 247, 244, 0.88);
}

.topbar-context {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.topbar-context strong,
.topbar-context span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-context strong {
  color: #111827;
  font-size: 14px;
}

.topbar-context span {
  color: #6b7280;
  font-size: 12px;
  font-weight: 700;
}

.global-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.global-search .kh-icon {
  position: absolute;
  left: 11px;
  color: #6b7280;
}

.global-search input {
  min-height: 38px;
  padding-left: 38px;
  background: #fff;
  border-color: rgba(31, 41, 55, 0.12);
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.btn,
button {
  gap: 7px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #374151;
  border: 1px solid rgba(31, 41, 55, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--soft-shadow), var(--hairline-shadow);
  text-decoration: none;
}

.icon-button:hover {
  color: #111827;
  transform: translateY(-1px);
}

.dropdown {
  position: relative;
}

.dropdown > summary,
.user-trigger {
  list-style: none;
  cursor: pointer;
}

.dropdown > summary::-webkit-details-marker,
.user-trigger::-webkit-details-marker {
  display: none;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 60;
  display: grid;
  gap: 3px;
  min-width: 230px;
  padding: 7px;
  border: 1px solid rgba(31, 41, 55, 0.12);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 48px rgba(31, 41, 55, 0.14);
}

.dropdown:not([open]) .dropdown-menu {
  display: none;
}

.dropdown-menu.align-right {
  right: 0;
  left: auto;
  min-width: 180px;
}

.dropdown-menu a,
.dropdown-menu button {
  display: flex;
  justify-content: flex-start;
  gap: 9px;
  width: 100%;
  min-height: 34px;
  padding: 8px 9px;
  color: #1f2937;
  border: 0;
  border-radius: 7px;
  background: transparent;
  box-shadow: none;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.dropdown-menu form {
  margin: 0;
}

.dropdown-menu a:hover,
.dropdown-menu button:hover {
  background: #f3f6f2;
  box-shadow: none;
  transform: none;
}

.user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 4px 0 0;
  color: #374151;
  border: 1px solid rgba(31, 41, 55, 0.12);
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--soft-shadow), var(--hairline-shadow);
}

.user-avatar {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: #111827;
  font-size: 12px;
  font-weight: 850;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin: 0 0 16px;
}

.page-header h1 {
  margin: 3px 0 5px;
  color: #111827;
  font-size: 28px;
  line-height: 1.12;
}

.page-header p {
  margin: 0;
  max-width: 720px;
  color: #667085;
}

.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.briefing-line {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.briefing-line span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 9px;
  border: 1px solid rgba(31, 41, 55, 0.08);
  border-radius: 999px;
  background: #fff;
  color: #3f4743;
  font-size: 12px;
  font-weight: 760;
}

.list-panel {
  padding: 0;
  overflow: hidden;
}

.list-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border-bottom: 1px solid rgba(31, 41, 55, 0.08);
  background: rgba(255, 255, 255, 0.78);
}

.list-search {
  position: relative;
}

.list-search .kh-icon {
  position: absolute;
  left: 11px;
  bottom: 9px;
  color: #667085;
}

.list-search input {
  padding-left: 38px;
}

.filter-row,
.sort-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  min-height: 31px;
  padding: 7px 10px;
  color: #3f4743;
  border: 1px solid rgba(31, 41, 55, 0.10);
  border-radius: 999px;
  background: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 760;
}

.filter-pill.active,
.filter-pill:hover {
  color: #fff;
  background: #111827;
  border-color: #111827;
}

.table-card {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table-card thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7f8f5;
}

.table-card th a {
  color: inherit;
  text-decoration: none;
}

.table-card tbody tr {
  background: #fff;
}

.table-card tbody tr[data-href] {
  cursor: pointer;
}

.table-card tbody tr[data-href]:hover {
  background: #f7faf7;
}

.table-card td,
.table-card th {
  height: 44px;
}

.row-action-cell {
  width: 54px;
  text-align: right;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
}

.row-actions .dropdown-menu {
  left: auto;
  right: 0;
  min-width: 190px;
}

.row-check {
  width: 42px;
  text-align: center;
}

.row-check input {
  width: 16px;
  min-height: 16px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 5px 9px;
  border: 1px solid rgba(31, 41, 55, 0.08);
  border-radius: 999px;
  background: #eef2f6;
  color: #344054;
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.status-badge.ok {
  color: #1f6f4d;
  background: #e8f3ec;
}

.status-badge.warn {
  color: #8a6116;
  background: #fff4da;
}

.status-badge.danger {
  color: #9f2f2f;
  background: #fbe8e8;
}

.status-badge.info {
  color: #245ba5;
  background: #e8f0fb;
}

.status-badge.archive,
.status-badge.neutral {
  color: #475467;
  background: #f0f1ed;
}

.bulk-toolbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(31, 41, 55, 0.08);
  background: #fff7e6;
}

.bulk-toolbar.is-visible {
  display: flex;
}

.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.pagination-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid rgba(31, 41, 55, 0.08);
  background: #fff;
}

.pagination-pages,
.pagination-size {
  display: flex;
  align-items: center;
  gap: 7px;
}

.pagination-size select {
  width: auto;
}

.empty-state.actionable {
  display: grid;
  gap: 10px;
  justify-items: start;
  color: #475467;
  background: #f7f8f5;
}

.form-error-list {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(159, 47, 47, 0.22);
  border-radius: 8px;
  background: #fff1f1;
  color: #7f1d1d;
}

.field-error {
  color: #9f2f2f;
  font-size: 12px;
  font-weight: 720;
}

.has-error input,
.has-error select,
.has-error textarea,
input.has-error,
select.has-error,
textarea.has-error {
  border-color: #bf3f3f;
  box-shadow: 0 0 0 3px rgba(191, 63, 63, 0.10);
}

.field-hint {
  color: #667085;
  font-size: 12px;
  font-weight: 650;
}

.field-hint.ok {
  color: #1f6f4d;
}

.field-hint.warn {
  color: #8a6116;
}

.field-hint.danger {
  color: #9f2f2f;
}

abbr[title] {
  cursor: help;
  text-decoration: underline dotted rgba(31, 41, 55, 0.42);
  text-underline-offset: 3px;
}

.sticky-form-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.form-section-nav {
  position: sticky;
  top: 78px;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(31, 41, 55, 0.10);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--soft-shadow), var(--hairline-shadow);
}

.form-section-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  padding: 7px 8px;
  color: #475467;
  border-radius: 7px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 760;
}

.form-section-nav a.active,
.form-section-nav a:hover {
  color: #111827;
  background: #f3f6f2;
}

.section-state {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  color: #667085;
  background: #eef2f6;
}

.section-state.complete {
  color: #1f6f4d;
  background: #e8f3ec;
}

.section-state.missing {
  color: #9f2f2f;
  background: #fbe8e8;
}

.exclusive-note {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -2px 0 2px;
  color: #667085;
  font-size: 12px;
  font-weight: 720;
}

.adjustment-card.is-focused {
  outline: 3px solid rgba(45, 101, 184, 0.18);
  outline-offset: 3px;
}

.confirm-modal {
  width: min(520px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.24);
}

.confirm-modal::backdrop {
  background: rgba(17, 24, 39, 0.42);
}

.confirm-modal-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: #fff;
}

.confirm-modal-card h2 {
  margin: 0;
  font-size: 20px;
}

.confirm-modal-card p {
  margin: 0;
  color: #475467;
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn.danger,
button.danger {
  background: #b42318;
  border-color: #b42318;
}

.history-timeline {
  display: grid;
  gap: 10px;
}

.history-item {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border-left: 4px solid #2d65b8;
  border-radius: 8px;
  background: #fff;
}

.history-item strong {
  color: #111827;
}

.history-item small {
  color: #667085;
}

.settings-grid,
.communication-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.settings-card,
.communication-card {
  display: grid;
  gap: 9px;
  min-height: 148px;
  padding: 16px;
  color: #1f2937;
  border: 1px solid rgba(31, 41, 55, 0.10);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--soft-shadow), var(--hairline-shadow);
  text-decoration: none;
}

.settings-card:hover,
.communication-card:hover {
  transform: translateY(-2px);
  border-color: rgba(45, 101, 184, 0.20);
}

.settings-year-panel {
  display: grid;
  gap: 16px;
}

.settings-year-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(20, 82, 74, 0.16);
  border-radius: 8px;
  background: #eef8f3;
}

.settings-year-summary span {
  color: #27615a;
  font-weight: 600;
}

.settings-year-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-year-form {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(31, 41, 55, 0.10);
  border-radius: 8px;
  background: #fbfcf8;
}

.settings-year-form label {
  display: grid;
  gap: 6px;
  color: #475467;
  font-size: 13px;
  font-weight: 700;
}

.settings-year-form select,
.settings-year-form input {
  width: 100%;
}

.app-shell [hidden] {
  display: none !important;
}

.lease-card-list {
  display: grid;
  gap: 12px;
}

.lease-card-list .lease-work-card {
  cursor: pointer;
}

.lease-row-wide .lease-tags i {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.lease-row-wide .lease-tags i .kh-icon,
.lease-row-wide .lease-status .kh-icon {
  width: 14px;
  height: 14px;
}

.lease-row-wide .lease-tags i.info {
  color: #1e4f95;
  background: rgba(232, 240, 251, 0.96);
}

.lease-row-wide .lease-tags i.archive {
  color: #596170;
  background: rgba(238, 242, 246, 0.96);
}

.lease-row-wide .lease-status {
  display: grid;
  gap: 8px;
  justify-items: end;
  min-width: 156px;
  align-content: start;
  text-align: right;
}

.lease-row-wide .lease-status small {
  color: #667085;
  font-size: 12px;
  line-height: 1.35;
}

.lease-row-wide .lease-status .dropdown {
  justify-self: end;
}

.lease-row-wide .dropdown-menu {
  text-align: left;
}

.lease-row-wide:focus-visible {
  outline: 3px solid rgba(45, 101, 184, 0.20);
  outline-offset: 3px;
}

@media (max-width: 1040px) {
  .app-topbar,
  .list-toolbar,
  .sticky-form-layout,
  .settings-year-layout,
  .settings-grid,
  .communication-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions,
  .page-header-actions,
  .bulk-actions {
    justify-content: flex-start;
  }

  .form-section-nav {
    position: static;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell .sidebar {
    position: static;
    height: auto;
  }

  .app-shell .primary-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-header,
  .pagination-bar,
  .bulk-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .lease-row-wide .lease-status {
    justify-items: start;
    min-width: 0;
    text-align: left;
  }
}

/* ============================================================ */
/* User management + inline object cards + shared helpers       */
/* ============================================================ */

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.panel-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.panel-sub {
  margin: 4px 0 0;
  color: var(--muted, #66738a);
  font-size: 14px;
}

.empty-hint {
  padding: 20px;
  border: 1px dashed var(--line, #e3e7ed);
  border-radius: 12px;
  text-align: center;
  color: var(--muted, #66738a);
  margin: 12px 0;
}

.badge.muted {
  background: #e8edf2;
  color: #293544;
}

.badge.info {
  background: #dfe9f7;
  color: #1f4682;
}

.badge.warning {
  background: #fff0cf;
  color: var(--warning, #8a5a00);
}

.muted.small,
.small.muted {
  font-size: 12px;
  color: var(--muted, #66738a);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.stat-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.stat-card {
  background: #f6f8fb;
  border: 1px solid var(--line, #e3e7ed);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #66738a);
}

.stat-value {
  font-size: 22px;
  font-weight: 600;
}

.kh-table {
  width: 100%;
  border-collapse: collapse;
}

.kh-table thead th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #66738a);
  padding: 8px 12px;
  border-bottom: 1px solid var(--line, #e3e7ed);
}

.kh-table tbody td {
  padding: 12px;
  border-bottom: 1px solid #f0f3f7;
  vertical-align: middle;
}

.kh-table tbody tr:last-child td {
  border-bottom: none;
}

.kh-table.compact thead th,
.kh-table.compact tbody td {
  padding: 8px 10px;
}

.kh-table td.actions {
  text-align: right;
  white-space: nowrap;
}

.kh-table td.actions .btn {
  margin-left: 4px;
}

.btn.danger-ghost {
  border-color: #f0c8c8;
  color: var(--danger, #b53939);
  background: transparent;
}

.btn.danger-ghost:hover {
  background: #fdf1f1;
}

.hint-card {
  border: 1px solid #dfe9f7;
  background: #f4f8fd;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hint-card strong {
  color: #1f4682;
}

.hint-card p {
  margin: 0;
  color: #3a4b66;
  font-size: 14px;
}

.object-units-inline {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin: 18px 0;
}

@media (min-width: 1280px) {
  .object-units-inline {
    grid-template-columns: 2fr 1fr;
  }
}

.object-card--wide {
  padding: 22px 24px;
}

.object-card--wide .object-card-head {
  margin-bottom: 12px;
}

.inline-quick-add {
  margin-top: 14px;
  border-top: 1px dashed var(--line, #e3e7ed);
  padding-top: 14px;
}

.inline-quick-add > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.inline-quick-add > summary::-webkit-details-marker {
  display: none;
}

.inline-quick-add[open] > summary {
  margin-bottom: 12px;
}

.quick-add-form {
  background: #f6f8fb;
  border: 1px solid var(--line, #e3e7ed);
  border-radius: 12px;
  padding: 16px;
}

.user-form .hint-card {
  grid-column: 1 / -1;
}

.report-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.report-card {
  border: 1px solid var(--line, #e3e7ed);
  border-radius: 14px;
  background: #fff;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.report-card .report-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.report-card .report-card-head strong {
  font-size: 15px;
}

.report-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.report-card .actions {
  margin-top: auto;
}

.stored-documents-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stored-document-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line, #e3e7ed);
  border-radius: 10px;
  background: #fafbfd;
}

.stored-document-row.is-final {
  background: #f0f8f3;
  border-color: #c2e1ce;
}

.stored-document-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.stored-document-meta strong {
  font-size: 14px;
}

.stored-document-meta small {
  font-size: 12px;
  color: var(--muted, #66738a);
}

.stored-document-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* ============================================================ */
/* Klarhaus v3 — Personen-Redesign                              */
/* Scope: alles unter .kh — vermeidet Konflikte mit Bestand     */
/* ============================================================ */

/* Klarhaus-Seiten nutzen die volle Breite und ignorieren das .main-Cap */
.main:has(.kh) {
  width: 100%;
  max-width: none;
  padding: 0;
}
.main:has(.kh) .topbar {
  margin-left: 0;
  margin-right: 0;
  padding-left: 28px;
  padding-right: 28px;
}

/* Auf der Personen-Listenseite: Liste und Vorschau scrollen intern, der
   äußere Mainframe bleibt statisch. */
.main:has(.kh .kh-split) {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.main:has(.kh .kh-split) .topbar { flex: 0 0 auto; }
.main:has(.kh .kh-split) .kh {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
}
.main:has(.kh .kh-split) .kh-page-header { flex: 0 0 auto; }
.main:has(.kh .kh-split) .kh-split {
  flex: 1;
  min-height: 0;
  padding-bottom: 28px;
}

/* Auf der Mietverträge-Liste: Dashboard bleibt oben fix, nur die Tabelle scrollt. */
.main:has(.kh .mv-table-card) {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.main:has(.kh .mv-table-card) .topbar { flex: 0 0 auto; }
.main:has(.kh .mv-table-card) .kh {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
}
.main:has(.kh .mv-table-card) .kh-page-header,
.main:has(.kh .mv-table-card) .mv-dashboard-strip { flex: 0 0 auto; }
.main:has(.kh .mv-table-card) .mv-table-card {
  flex: 1;
  min-height: 0;
  margin-bottom: 28px;
}
.main:has(.kh .mv-table-card) .mv-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.kh {
  --kh-bg:        #f7f6f2;
  --kh-bg-2:      #f0eee8;
  --kh-card:      #ffffff;
  --kh-card-soft: #fbfaf6;
  --kh-stroke:    #e7e5df;
  --kh-stroke-2:  #efede7;

  --kh-ink:       #18181b;
  --kh-ink-2:     #3f3f46;
  --kh-mute:      #6b7280;
  --kh-faint:     #a1a1aa;

  --kh-teal:      #0d9488;
  --kh-teal-2:    #14b8a6;
  --kh-teal-soft: #d1fae5;
  --kh-teal-ink:  #065f46;

  --kh-owner:   #10b981;
  --kh-tenant:  #3b82f6;
  --kh-firm:    #8b5cf6;
  --kh-vendor:  #f59e0b;

  --kh-ok:        #047857;
  --kh-ok-soft:   #d1fae5;
  --kh-warn:      #92400e;
  --kh-warn-soft: #fef3c7;
  --kh-bad:       #b91c1c;
  --kh-bad-soft:  #fee2e2;
  --kh-info:      #1d4ed8;
  --kh-info-soft: #dbeafe;
  --kh-link:      #2563eb;

  --kh-r-sm: 8px;
  --kh-r-md: 12px;
  --kh-r-lg: 16px;
  --kh-r-xl: 20px;

  --kh-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --kh-ease:   cubic-bezier(0.22, 1, 0.36, 1);

  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color: var(--kh-ink);
  font-size: 14px;
  line-height: 1.5;
  background:
    radial-gradient(ellipse 1200px 600px at 80% -10%, #fbf9f3 0%, transparent 60%),
    radial-gradient(ellipse 800px 500px at 10% 100%, #f7f5ee 0%, transparent 55%),
    #ffffff;
  margin: 0;
  /* Bei großen Viewports wächst das seitliche Padding mit, damit der Inhalt
     nicht über die ganze Breite läuft. Bei kleinen Screens bleibt es bei 28 px. */
  padding: 24px clamp(28px, calc((100vw - 1400px) / 2 + 28px), 160px) 32px;
  min-height: calc(100vh - 80px);
}

.kh * { box-sizing: border-box; }
.kh .mono { font-family: "IBM Plex Mono", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace; font-feature-settings: "tnum"; }
.kh .tnum { font-variant-numeric: tabular-nums; }

/* Cards — opak fürs Lesen, leichte Schattierung statt Glas */
.kh .kh-card {
  background: #ffffff;
  border: 1px solid var(--kh-stroke);
  border-radius: var(--kh-r-lg);
  box-shadow:
    0 1px 2px rgba(20, 20, 15, 0.03),
    0 6px 20px -12px rgba(20, 20, 15, 0.08);
  overflow: hidden;
}

.kh .kh-card__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px 12px;
  border-bottom: 1px solid rgba(20, 20, 15, 0.08);
}
.kh .kh-card__title {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--kh-mute);
}
.kh .kh-card__body { padding: 16px 20px; }

/* Inputs */
.kh .kh-input {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px;
  background: var(--kh-card);
  border: 1px solid var(--kh-stroke);
  border-radius: 999px;
  font: inherit; color: var(--kh-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.kh .kh-input:focus-within {
  border-color: var(--kh-teal);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.12);
}
.kh .kh-input input {
  border: 0; outline: 0; background: transparent;
  font: inherit; color: inherit; width: 100%;
  font-size: 13.5px;
}
.kh .kh-input input::placeholder { color: var(--kh-faint); }

/* Buttons */
.kh .kh-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px;
  background: var(--kh-card);
  color: var(--kh-ink);
  border: 1px solid var(--kh-stroke);
  border-radius: 10px;
  font: inherit; font-weight: 500; font-size: 13.5px;
  cursor: pointer; white-space: nowrap;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(20, 20, 15, 0.04);
  transition: transform 0.15s var(--kh-ease), box-shadow 0.15s, background 0.12s;
}
.kh .kh-btn:hover { background: var(--kh-card-soft); box-shadow: 0 3px 8px rgba(20, 20, 15, 0.08); transform: translateY(-0.5px); }
.kh .kh-btn:active { transform: translateY(0); }
.kh .kh-btn--sm   { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.kh .kh-btn--icon { width: 36px; padding: 0; justify-content: center; }
.kh .kh-btn--icon.kh-btn--sm { width: 30px; }
.kh .kh-btn--dark { background: var(--kh-ink); color: #fdfdfb; border-color: var(--kh-ink); }
.kh .kh-btn--dark:hover { background: #2a2a30; }
.kh .kh-btn--teal {
  background: linear-gradient(180deg, var(--kh-teal-2) 0%, var(--kh-teal) 100%);
  color: #fdfdfb; border-color: var(--kh-teal);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 4px 12px -2px rgba(13, 148, 136, 0.4);
}
.kh .kh-btn--teal:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 6px 18px -2px rgba(13, 148, 136, 0.55); }
.kh .kh-btn--ghost {
  background: transparent; border-color: transparent; box-shadow: none; color: var(--kh-ink-2);
}
.kh .kh-btn--ghost:hover { background: rgba(20, 20, 15, 0.05); box-shadow: none; }

/* Pills */
.kh .kh-pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px;
  font-size: 11.5px; font-weight: 500;
  border-radius: 999px;
  background: rgba(20, 20, 15, 0.06); color: var(--kh-ink-2);
  white-space: nowrap; border: 1px solid transparent;
  transition: background 0.12s;
  text-decoration: none;
}
.kh .kh-pill--ok    { background: var(--kh-ok-soft);   color: var(--kh-ok); }
.kh .kh-pill--warn  { background: var(--kh-warn-soft); color: var(--kh-warn); }
.kh .kh-pill--bad   { background: var(--kh-bad-soft);  color: var(--kh-bad); }
.kh .kh-pill--info  { background: var(--kh-info-soft); color: var(--kh-info); }
.kh .kh-pill--teal  { background: var(--kh-teal-soft); color: var(--kh-teal-ink); }
.kh .kh-pill--whg   { background: var(--kh-teal-soft); color: var(--kh-teal-ink); font-weight: 500; }
.kh .kh-pill--whg:hover { background: #b3edd3; }
.kh .kh-pill--whg strong { font-weight: 600; }

/* Avatars */
.kh .kh-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  color: var(--kh-ink-2); font-weight: 600; font-size: 12.5px;
  background: #ecebe5; border: 1px solid var(--kh-stroke-2);
  flex: 0 0 auto;
  overflow: hidden;
}
.kh .kh-avatar img { width: 100%; height: 100%; object-fit: cover; }
.kh .kh-avatar--sm { width: 26px; height: 26px; font-size: 10.5px; }
.kh .kh-avatar--lg { width: 56px; height: 56px; font-size: 18px; }
.kh .kh-avatar--xl { width: 80px; height: 80px; font-size: 26px; }
.kh .kh-avatar--owner  { background: #e6f7ed; color: #065f46; }
.kh .kh-avatar--tenant { background: #e1ecfd; color: #1e3a8a; }
.kh .kh-avatar--firm   { background: #ece5fb; color: #4c1d95; }
.kh .kh-avatar--vendor { background: #fef3d6; color: #78350f; }

/* Segmented */
.kh .kh-seg {
  display: inline-flex; padding: 3px;
  background: rgba(20, 20, 15, 0.06);
  border-radius: 999px;
  gap: 2px;
}
.kh .kh-seg__item {
  padding: 5px 12px;
  font-size: 12.5px; font-weight: 500;
  color: var(--kh-mute);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  border: 0;
  background: transparent;
  font-family: inherit;
  text-decoration: none;
}
.kh .kh-seg__item--active {
  color: var(--kh-ink);
  background: var(--kh-card);
  box-shadow: 0 1px 3px rgba(20, 20, 15, 0.10);
}

/* Listenzeile mit Rollen-Stripe */
.kh .kh-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 130px;
  align-items: center; gap: 12px;
  padding: 13px 14px 13px 18px;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: background 0.18s var(--kh-ease);
  margin: 2px 8px;
  text-decoration: none;
  color: inherit;
  border: 0;
  background: transparent;
  width: calc(100% - 16px);
  text-align: left;
  font-family: inherit;
  font-size: inherit;
}
.kh .kh-row::before {
  content: '';
  position: absolute; left: 4px; top: 14px; bottom: 14px; width: 3px;
  border-radius: 3px;
  background: var(--kh-owner);
  opacity: 0;
  transition: opacity 0.15s, left 0.15s, width 0.15s;
}
.kh .kh-row[data-kind="owner"]::before   { background: var(--kh-owner);  opacity: 0.85; }
.kh .kh-row[data-kind="tenant"]::before  { background: var(--kh-tenant); opacity: 0.85; }
.kh .kh-row[data-kind="firm"]::before    { background: var(--kh-firm);   opacity: 0.85; }
.kh .kh-row[data-kind="vendor"]::before  { background: var(--kh-vendor); opacity: 0.85; }
/* Doppelrolle: Verlauf Owner→Tenant */
.kh .kh-row[data-kinds~="owner"][data-kinds~="tenant"]::before {
  background: linear-gradient(180deg, var(--kh-owner) 0%, var(--kh-tenant) 100%);
  opacity: 1;
  width: 4px;
}
.kh .kh-row[data-kinds~="owner"][data-kinds~="vendor"]::before {
  background: linear-gradient(180deg, var(--kh-owner) 0%, var(--kh-vendor) 100%);
  opacity: 1;
  width: 4px;
}
.kh .kh-row[data-kinds~="tenant"][data-kinds~="vendor"]::before {
  background: linear-gradient(180deg, var(--kh-tenant) 0%, var(--kh-vendor) 100%);
  opacity: 1;
  width: 4px;
}

.kh .kh-row:hover { background: #f6f5f0; }
.kh .kh-row--active {
  background: #f1efe6;
  box-shadow: inset 0 0 0 1px var(--kh-stroke);
}
.kh .kh-row--active::before { opacity: 1; left: 0; width: 4px; top: 8px; bottom: 8px; }

.kh .kh-row__main { min-width: 0; }
.kh .kh-row__name {
  font-size: 14px; font-weight: 600; color: var(--kh-ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kh .kh-row__sub {
  display: flex; gap: 4px; align-items: center; flex-wrap: wrap;
  margin-top: 4px;
}
.kh .kh-row__right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 5px;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}
.kh .kh-row__lease {
  font-size: 12px;
  color: var(--kh-ink-2);
  white-space: nowrap;
}
.kh .kh-row__lease strong { font-weight: 600; }
.kh .kh-row__lease--muted { color: var(--kh-mute); }
.kh .kh-row__lease--warn  { color: var(--kh-warn); font-weight: 600; }

/* Whg-Pills in der Liste kompakter */
.kh .kh-row .kh-pill--whg {
  height: 20px;
  padding: 0 7px;
  font-size: 11px;
}

/* Stats */
.kh .kh-stat {
  position: relative;
  padding: 14px 16px 13px;
  border-radius: var(--kh-r-md);
  background: #fbfaf6;
  border: 1px solid var(--kh-stroke-2);
}
.kh .kh-stat__label {
  font-size: 11px; color: var(--kh-mute);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.kh .kh-stat__value {
  font-size: 24px; font-weight: 600; letter-spacing: -0.4px;
  margin-top: 4px; font-variant-numeric: tabular-nums;
}
.kh .kh-stat__sub { font-size: 11.5px; color: var(--kh-mute); margin-top: 3px; }
.kh .kh-stat--bad  .kh-stat__value { color: var(--kh-bad); }
.kh .kh-stat--ok   .kh-stat__value { color: var(--kh-ok); }
.kh .kh-stat--teal .kh-stat__value { color: var(--kh-teal); }

/* Unit-Chip */
.kh .kh-unit-chip {
  display: flex; flex-direction: column; gap: 5px;
  padding: 11px 14px; min-width: 200px;
  border-radius: var(--kh-r-md);
  background: #ffffff;
  border: 1px solid var(--kh-stroke);
  cursor: pointer;
  transition: transform 0.2s var(--kh-spring), box-shadow 0.2s var(--kh-ease), background 0.15s;
  text-decoration: none;
  color: inherit;
}
.kh .kh-unit-chip:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 6px 16px -6px rgba(20, 20, 15, 0.10);
}
.kh .kh-unit-chip--active {
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 60%);
  border-color: var(--kh-owner);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.10), 0 6px 16px -4px rgba(20, 20, 15, 0.10);
}
.kh .kh-unit-chip--placeholder {
  background: transparent;
  border: 1px dashed rgba(20, 20, 15, 0.25);
  color: var(--kh-mute);
  justify-content: center;
  align-items: center;
}

/* Timeline-Row */
.kh .kh-tl-row {
  display: flex; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--kh-stroke-2);
}
.kh .kh-tl-row:last-child { border-bottom: none; }
.kh .kh-tl-icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.kh .kh-tl-icon--ok   { background: var(--kh-ok-soft);   color: var(--kh-ok); }
.kh .kh-tl-icon--info { background: var(--kh-info-soft); color: var(--kh-info); }
.kh .kh-tl-icon--warn { background: var(--kh-warn-soft); color: var(--kh-warn); }
.kh .kh-tl-icon--teal { background: var(--kh-teal-soft); color: var(--kh-teal-ink); }
.kh .kh-tl-icon--firm { background: #ece5fb;             color: #4c1d95; }
.kh .kh-tl-body { min-width: 0; flex: 1; }
.kh .kh-tl-title { font-weight: 500; font-size: 13px; }
.kh .kh-tl-sub { color: var(--kh-mute); font-size: 12px; margin-top: 2px; }
.kh .kh-tl-date { color: var(--kh-mute); font-size: 11.5px; margin-top: 2px; }

/* Key-Value-Liste */
.kh .kh-kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; font-size: 13px; margin: 0; }
.kh .kh-kv dt { color: var(--kh-mute); font-weight: 400; }
.kh .kh-kv dd { margin: 0; color: var(--kh-ink); }

/* Tabs */
.kh .kh-tabs {
  display: flex; gap: 0; flex-wrap: wrap;
  border-top: 1px solid rgba(20,20,15,.08);
}
.kh .kh-tab {
  padding: 12px 4px;
  margin-right: 22px;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--kh-mute);
  border: 0;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: color 0.15s, border-color 0.15s;
  text-decoration: none;
  font-family: inherit;
}
.kh .kh-tab--active { color: var(--kh-ink); font-weight: 600; border-bottom-color: var(--kh-teal); }
.kh .kh-tab__badge {
  font-size: 10.5px; font-weight: 500;
  padding: 1px 6px; border-radius: 999px;
  background: var(--kh-teal-soft); color: var(--kh-teal-ink);
}
.kh .kh-tab__badge--warn { background: var(--kh-warn-soft); color: var(--kh-warn); }

/* Fade-In */
@keyframes kh-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.kh .kh-fade { animation: kh-fade-up 0.36s var(--kh-ease) both; }

/* Page-Header */
.kh .kh-page-header {
  display: flex; align-items: flex-start; gap: 18px;
  padding: 8px 0 18px;
  flex-wrap: wrap;
}
.kh .kh-page-header__main { flex: 1; min-width: 0; }
.kh .kh-page-header__eyebrow {
  font-size: 13px; font-weight: 500; color: var(--kh-teal); margin-bottom: 4px;
}
.kh .kh-page-header__title {
  margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.6px; color: var(--kh-ink);
}
.kh .kh-page-header__sub {
  font-size: 13px; color: var(--kh-mute); margin-top: 6px;
}
.kh .kh-page-header__sub b { font-weight: 500; color: var(--kh-warn); }
.kh .kh-page-header__actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }

/* Donut (für MEA) */
.kh .kh-donut { width: 64px; height: 64px; flex: 0 0 auto; position: relative; }
.kh .kh-donut__label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--kh-ink);
  font-variant-numeric: tabular-nums;
}

/* Split-Layout für die Liste */
.kh .kh-split {
  display: flex; gap: 16px;
  align-items: stretch;
  min-height: 0;
}
.kh .kh-split__list {
  flex: 0 0 520px;
  display: flex; flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.kh .kh-split__list .kh-card__body { padding: 0; }
.kh .kh-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0 10px;
  scrollbar-width: thin;
  min-height: 0;
}
.kh .kh-split__preview {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-right: 4px;
}

@media (max-width: 1100px) {
  .main:has(.kh .kh-split) { height: auto; overflow: visible; }
  .main:has(.kh .kh-split) .kh { overflow: visible; }
  .kh .kh-split { flex-direction: column; min-height: 0; }
  .kh .kh-split__list { flex: 0 0 auto; max-height: 50vh; }
  .kh .kh-split__preview { max-height: none; overflow: visible; }
}

/* Detail-Layout */
.kh .kh-detail-hero {
  border-radius: 18px;
  margin-bottom: 18px;
  padding: 18px 24px 0;
}
.kh .kh-detail-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
}
.kh .kh-detail-col {
  display: flex; flex-direction: column; gap: 14px;
  min-width: 0;
}
@media (max-width: 1100px) {
  .kh .kh-detail-grid { grid-template-columns: 1fr; }
}

/* Helpers */
.kh .kh-row-strip { background: rgba(13,148,136,.04); border-top: 1px solid rgba(20,20,15,.08); }
.kh .kh-icon-tile {
  width: 30px; height: 30px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.kh .kh-icon-tile--mail { background: var(--kh-info-soft); color: var(--kh-info); }
.kh .kh-icon-tile--phone { background: var(--kh-teal-soft); color: var(--kh-teal-ink); }
.kh .kh-icon-tile--bank { background: #f5f3ec; color: var(--kh-ink-2); }

/* ============================================================ */
/* Mietverträge — Klarhaus v3 Tabelle                           */
/* ============================================================ */

.kh .mv-dashboard-header {
  margin-bottom: 14px;
  align-items: center;
}
.kh .mv-dashboard-header .kh-page-header__actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.kh .mv-legende {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11.5px;
  color: var(--kh-mute);
  flex-wrap: wrap;
  padding-right: 6px;
}
.kh .mv-legende__item { display: inline-flex; align-items: center; gap: 6px; }
.kh .mv-legende__chip {
  width: 14px; height: 14px;
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
}

.kh .mv-dashboard-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.kh .mv-metric {
  padding: 16px 18px;
  border-radius: var(--kh-r-md);
  background: #ffffff;
  border: 1px solid var(--kh-stroke);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}
.kh .mv-metric::before {
  content: '';
  position: absolute;
  left: 0; top: 14px; bottom: 14px; width: 3px;
  border-radius: 3px;
  background: var(--kh-mute);
  opacity: 0.4;
}
.kh .mv-metric--primary::before { background: var(--kh-teal); opacity: 1; }
.kh .mv-metric--warn::before    { background: var(--kh-warn); opacity: 1; }
.kh .mv-metric--info::before    { background: var(--kh-info); opacity: 1; }
.kh .mv-metric__label {
  font-size: 11px;
  color: var(--kh-mute);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.kh .mv-metric__value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--kh-ink);
  font-variant-numeric: tabular-nums;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}
.kh .mv-metric__sub {
  font-size: 11.5px;
  color: var(--kh-mute);
}

@media (max-width: 1100px) {
  .kh .mv-dashboard-strip { grid-template-columns: repeat(2, 1fr); }
}

.kh .mv-table-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.kh .mv-toolbar {
  padding: 14px 22px 12px;
  border-bottom: 1px solid rgba(20, 20, 15, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.kh .mv-counter {
  font-size: 12px;
  color: var(--kh-mute);
  font-variant-numeric: tabular-nums;
}

.kh .mv-header {
  display: grid;
  grid-template-columns: 100px 140px 2fr 1.15fr 1.15fr 130px;
  column-gap: 20px;
  padding: 10px 22px;
  border-bottom: 1px solid rgba(20, 20, 15, 0.06);
  font-size: 10.5px;
  color: var(--kh-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #fafaf6;
}

.kh .mv-list {
  display: flex;
  flex-direction: column;
}
.kh .mv-row {
  display: grid;
  grid-template-columns: 100px 140px 2fr 1.15fr 1.15fr 130px;
  column-gap: 20px;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(20, 20, 15, 0.06);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background 0.15s var(--kh-ease);
}
.kh .mv-row:last-child { border-bottom: none; }
.kh .mv-row:hover { background: rgba(20, 20, 15, 0.03); }

.kh .mv-cell { min-width: 0; }

/* Spalte 1: Chip + Status */
.kh .mv-cell--chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.kh .mv-chip {
  width: 44px; height: 44px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.2px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), inset 0 -1px 0 rgba(0,0,0,.04);
}
.kh .mv-status-label {
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.kh .mv-status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}

/* Spalte 2: Wohnungsdetails */
.kh .mv-unit-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--kh-ink);
  letter-spacing: -0.2px;
}
.kh .mv-unit-sub {
  font-size: 12.5px;
  color: var(--kh-mute);
  margin-top: 3px;
}
.kh .mv-unit-date {
  margin-top: 8px;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  flex-wrap: wrap;
}
.kh .mv-date__prefix {
  font-size: 11px;
  color: var(--kh-mute);
  letter-spacing: 0.02em;
}
.kh .mv-date__value {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--kh-ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.1px;
}
.kh .mv-date__value--warn { color: var(--kh-bad); }
.kh .mv-date--beendet .mv-date__value { color: var(--kh-ink-2); font-weight: 500; }

/* Spalte 3: Parteien */
.kh .mv-parties {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.kh .mv-tenants {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  row-gap: 4px;
  min-width: 0;
}
.kh .mv-tenant-name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--kh-ink);
  letter-spacing: -0.15px;
  line-height: 1.2;
  min-width: 0;
}
.kh .mv-tenant-name .mv-party__bullet {
  width: 7px; height: 7px;
}
.kh .mv-tenant-empty {
  font-size: 14px;
  color: var(--kh-faint);
  font-style: italic;
}

.kh .mv-owner-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--kh-mute);
  flex-wrap: wrap;
  row-gap: 2px;
  min-width: 0;
}
.kh .mv-owner-line__label {
  color: var(--kh-mute);
  letter-spacing: 0.01em;
}
.kh .mv-owner-line__name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--kh-ink-2);
  font-weight: 500;
}
.kh .mv-owner-line__sep { color: var(--kh-faint); }
.kh .mv-owner-line__empty { color: var(--kh-faint); font-style: italic; }

.kh .mv-party__bullet {
  width: 6px; height: 6px;
  border-radius: 2px;
  flex: 0 0 auto;
}

/* Spalte 4: Miete */
.kh .mv-rent {
  font-size: 18px;
  font-weight: 700;
  color: var(--kh-ink);
  letter-spacing: -0.3px;
  line-height: 1.1;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.kh .mv-rent__period {
  font-size: 11px;
  font-weight: 500;
  color: var(--kh-mute);
  margin-left: 5px;
  font-family: "IBM Plex Sans", sans-serif;
}
.kh .mv-rent__sqm-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--kh-teal-soft);
  color: var(--kh-teal-ink);
  font-size: 11px;
  font-weight: 600;
  font-family: "IBM Plex Sans", sans-serif;
  letter-spacing: 0.01em;
  align-self: center;
}
.kh .mv-rent__sqm-pill .mono { font-size: 11.5px; }
.kh .mv-rent__sqm-line {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--kh-teal-soft);
  color: var(--kh-teal-ink);
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.kh .mv-rent__sqm-unit {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.kh .mv-rent__breakdown {
  font-size: 11.5px;
  color: var(--kh-mute);
  margin-top: 4px;
}
.kh .mv-rent__plus { opacity: 0.5; margin: 0 1px; }
.kh .mv-rent__parking {
  font-size: 11px;
  color: var(--kh-mute);
  margin-top: 3px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.kh .mv-rent__parking-cost {
  color: var(--kh-ink-2);
  font-weight: 500;
  margin-left: 4px;
}

/* Spalte 5: Art & Anpassung */
.kh .mv-art {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-start;
}
.kh .mv-uplift {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--kh-ok-soft);
  color: var(--kh-ok);
  font-size: 11.5px;
  font-weight: 600;
}
.kh .mv-art__dash {
  font-size: 11.5px;
  color: var(--kh-faint);
}
.kh .mv-art__date {
  font-size: 11px;
  color: var(--kh-mute);
  line-height: 1.3;
}

/* Spalte 6: Saldo */
.kh .mv-saldo {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kh .mv-saldo--bad { color: var(--kh-bad); }
.kh .mv-saldo--ok  { color: var(--kh-ok); }
.kh .mv-saldo__sub {
  font-size: 11px;
  margin-top: 3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.kh .mv-empty {
  padding: 48px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--kh-mute);
}
.kh .mv-empty strong { color: var(--kh-ink); font-size: 15px; }

/* Bei sehr schmalen Viewports zusammenfalten */
@media (max-width: 1240px) {
  .kh .mv-header,
  .kh .mv-row {
    grid-template-columns: 80px 130px 1.7fr 1fr 1fr 110px;
    column-gap: 14px;
  }
  .kh .mv-chip { width: 38px; height: 38px; font-size: 13px; }
}

/* ============================================================ */
/* Mietvertrag-Detail (kh mv-detail)                            */
/* ============================================================ */

.kh .mv-detail .kh-detail-hero {
  padding: 16px 22px 0;
}
.kh .mv-detail-crumbs {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--kh-mute);
  padding: 2px 0 14px;
}
.kh .mv-detail-crumbs a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  text-decoration: none;
}
.kh .mv-detail-crumbs a:hover { color: var(--kh-ink); }
.kh .mv-detail-id { color: var(--kh-faint); font-size: 11px; }

.kh .mv-detail-headline {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding-bottom: 16px;
  flex-wrap: wrap;
}
.kh .mv-chip--lg {
  width: 64px; height: 64px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.4px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), inset 0 -1px 0 rgba(0,0,0,.04);
  flex: 0 0 auto;
}
.kh .mv-detail-headline__main { flex: 1; min-width: 240px; }
.kh .mv-detail-title {
  margin: 4px 0 8px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--kh-ink);
}
.kh .mv-detail-title__loc {
  font-weight: 500;
  color: var(--kh-mute);
  margin-left: 4px;
}
.kh .mv-detail-headline__pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.kh .mv-detail-headline__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.kh .mv-detail-tabs {
  padding: 0;
  margin-top: 4px;
}

/* Sidebar */
.kh .mv-detail-person {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 6px 0;
  text-decoration: none;
  color: inherit;
}
.kh .mv-detail-person:hover .mv-detail-person__main strong { color: var(--kh-teal); }
.kh .mv-detail-person__bullet {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex: 0 0 auto;
}
.kh .mv-detail-person__main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.kh .mv-detail-person__main strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--kh-ink);
}
.kh .mv-detail-person__main small {
  font-size: 11.5px;
  color: var(--kh-mute);
}

.kh .mv-todo {
  border-left: 3px solid var(--kh-mute);
  padding: 6px 10px;
  background: #fafaf6;
  border-radius: 0 8px 8px 0;
}
.kh .mv-todo--danger { border-left-color: var(--kh-bad); background: #fef2f2; }
.kh .mv-todo--warn   { border-left-color: var(--kh-warn); background: #fffbeb; }
.kh .mv-todo strong { font-size: 13px; display: block; }
.kh .mv-todo small { font-size: 11.5px; color: var(--kh-mute); }

/* Mietkonditionen-Card */
.kh .mv-cond-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.kh .mv-cond-head .mv-rent {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--kh-ink);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  line-height: 1.1;
}
.kh .mv-cond-head .mv-rent__period {
  font-size: 12px;
  font-weight: 500;
  color: var(--kh-mute);
  margin-left: 6px;
  font-family: "IBM Plex Sans", sans-serif;
}
.kh .mv-cond-head__unit {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kh .mv-cond-head__unit small {
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: var(--kh-mute);
}
.kh .mv-cond-head__unit strong { font-size: 14px; font-weight: 600; }
.kh .mv-cond-head__unit .small { font-size: 12px; color: var(--kh-mute); }

.kh .mv-cond-table {
  width: 100%;
  border-collapse: collapse;
}
.kh .mv-cond-table td {
  padding: 8px 0;
  border-top: 1px solid var(--kh-stroke-2);
  font-size: 13px;
}
.kh .mv-cond-table td.right { text-align: right; }
.kh .mv-cond-table tr:first-child td { border-top: 0; }
.kh .mv-cond-table__sum td {
  font-weight: 700;
  font-size: 14px;
  border-top: 2px solid var(--kh-ink);
  padding-top: 10px;
}

.kh .mv-art-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Index-Kacheln */
.kh .mv-index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.kh .mv-index-tile {
  padding: 12px 14px;
  background: #fbfaf6;
  border: 1px solid var(--kh-stroke-2);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kh .mv-index-tile small {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--kh-mute);
  font-weight: 500;
}
.kh .mv-index-tile strong {
  font-size: 17px;
  font-weight: 700;
  color: var(--kh-ink);
  letter-spacing: -0.2px;
}
.kh .mv-index-tile em {
  font-style: normal;
  font-size: 11px;
  color: var(--kh-mute);
}
.kh .mv-index-tile--accent {
  background: var(--kh-ok-soft);
  border-color: rgba(16, 185, 129, 0.3);
}
.kh .mv-index-tile--accent strong { color: var(--kh-ok); }
.kh .mv-index-tile--accent small { color: var(--kh-ok); }

/* Staffel-Tabelle */
.kh .mv-step-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
}
.kh .mv-step-table th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--kh-mute);
  padding: 8px 6px;
  border-bottom: 1px solid var(--kh-stroke-2);
  font-weight: 500;
}
.kh .mv-step-table th.right { text-align: right; }
.kh .mv-step-table td {
  padding: 10px 6px;
  border-bottom: 1px solid var(--kh-stroke-2);
  font-size: 13px;
  vertical-align: middle;
}
.kh .mv-step-table td.right { text-align: right; }
.kh .mv-step-table tr:last-child td { border-bottom: 0; }
.kh .mv-step-table tr.mv-step--past { color: var(--kh-mute); }
.kh .mv-step-table tr.mv-step--past td { background: rgba(20,20,15,.02); }
.kh .mv-step-table tr.mv-step--future td { background: rgba(13,148,136,.03); }
.kh .mv-step-num {
  display: inline-flex;
  width: 22px; height: 22px;
  align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--kh-ink);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}
.kh .mv-step--past .mv-step-num { background: var(--kh-mute); }

/* Kontakt-Card */
.kh .mv-contact {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kh .mv-contact__head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.kh .mv-contact__bullet {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.kh .mv-contact__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--kh-ink);
  text-decoration: none;
  letter-spacing: -0.1px;
}
.kh .mv-contact__name:hover { color: var(--kh-teal); }
.kh .mv-contact__list {
  margin: 0;
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 4px 12px;
  font-size: 12.5px;
}
.kh .mv-contact__list dt {
  color: var(--kh-mute);
  font-weight: 400;
}
.kh .mv-contact__list dd {
  margin: 0;
  color: var(--kh-ink);
  word-break: break-word;
}
.kh .mv-contact-divider {
  height: 1px;
  background: var(--kh-stroke-2);
  margin: 4px -6px;
}
.kh .mv-contact-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--kh-mute);
  font-weight: 600;
}

/* Mietkonto */
.kh .mv-account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.kh .mv-account-tile {
  background: #fbfaf6;
  border: 1px solid var(--kh-stroke-2);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kh .mv-account-tile small {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--kh-mute);
  font-weight: 500;
}
.kh .mv-account-tile strong {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--kh-ink);
}
.kh .mv-account-tile em { font-size: 11px; color: var(--kh-mute); font-style: normal; }
.kh .mv-saldo--bad { color: var(--kh-bad); }
.kh .mv-saldo--ok  { color: var(--kh-ok); }
.kh .mv-saldo--muted { color: var(--kh-ink); }

/* Historie-Tabelle */
.kh .mv-history-table {
  width: 100%;
  border-collapse: collapse;
}
.kh .mv-history-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--kh-mute);
  padding: 10px 16px;
  border-bottom: 1px solid var(--kh-stroke-2);
}
.kh .mv-history-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--kh-stroke-2);
  font-size: 13px;
}
.kh .mv-history-table td.right, .kh .mv-history-table th.right { text-align: right; }
.kh .mv-history-table tr:last-child td { border-bottom: 0; }

/* Dokumente-Liste */
.kh .mv-doc-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--kh-stroke-2);
}
.kh .mv-doc-row:last-child { border-bottom: 0; }
.kh .mv-doc-row__icon {
  width: 30px; height: 36px;
  border-radius: 6px;
  background: linear-gradient(180deg, #ffffff 0%, #f5f3ec 100%);
  border: 1px solid var(--kh-stroke);
  display: flex; align-items: center; justify-content: center;
  font-size: 8.5px;
  font-weight: 700;
  color: var(--kh-ink-2);
  text-transform: uppercase;
}
.kh .mv-doc-row__main { flex: 1; min-width: 0; }
.kh .mv-doc-row__main strong { font-size: 13.5px; font-weight: 600; }
.kh .mv-doc-row__main small { display: block; font-size: 11.5px; color: var(--kh-mute); }
.kh .mv-doc-row__actions { display: flex; gap: 6px; }

.kh .mv-doc-upload {
  padding: 16px 22px;
  background: #fbfaf6;
  border-bottom: 1px solid var(--kh-stroke-2);
}
.kh .mv-doc-upload__grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px 14px;
}
.kh .mv-doc-upload__grid .full { grid-column: 1 / -1; }
.kh .mv-doc-upload label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--kh-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.kh .mv-doc-upload label > select,
.kh .mv-doc-upload label > input[type="text"],
.kh .mv-doc-upload label > input[type="file"] {
  font: inherit;
  font-size: 13px;
  text-transform: none;
  letter-spacing: normal;
  color: var(--kh-ink);
  font-weight: 400;
  padding: 7px 10px;
  border: 1px solid var(--kh-stroke);
  border-radius: 8px;
  background: #fff;
}
.kh .mv-doc-upload label > input[type="file"] { padding: 6px 8px; }
.kh .mv-doc-upload label .muted {
  font-size: 11px;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  margin-top: 2px;
}
.kh .mv-doc-upload__actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.kh .mv-notes {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.5;
  color: var(--kh-ink);
  padding: 10px 12px;
  background: #fbfaf6;
  border: 1px solid var(--kh-stroke-2);
  border-radius: 8px;
  margin-bottom: 10px;
}

/* ============================================================ */
/* Lease-Edit-Formular                                          */
/* ============================================================ */

.kh .mv-edit-headline__icon {
  width: 64px; height: 64px;
  border-radius: 14px;
  background: var(--kh-teal-soft);
  color: var(--kh-teal-ink);
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}

.kh .mv-edit-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11.5px;
  color: var(--kh-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.kh .mv-edit-label > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.kh .mv-edit-label > input,
.kh .mv-edit-label > select,
.kh .mv-edit-label > textarea {
  font: inherit;
  font-size: 13.5px;
  text-transform: none;
  letter-spacing: normal;
  color: var(--kh-ink);
  font-weight: 400;
  padding: 8px 12px;
  border: 1px solid var(--kh-stroke);
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
}
.kh .mv-edit-label > input:focus,
.kh .mv-edit-label > select:focus {
  outline: 0;
  border-color: var(--kh-teal);
  box-shadow: 0 0 0 3px rgba(13,148,136,.12);
}
.kh .mv-edit-label small.muted {
  font-size: 11px;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

.kh .mv-edit-bullet {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.kh .mv-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.kh .mv-edit-parking {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.kh .mv-edit-parking__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--kh-stroke);
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s, background 0.15s;
  min-height: 56px;
}
.kh .mv-edit-parking__item:hover:not(.is-occupied) {
  border-color: var(--kh-teal);
  background: var(--kh-teal-soft);
}
.kh .mv-edit-parking__item input {
  margin: 2px 0 0;
  flex: 0 0 auto;
}
.kh .mv-edit-parking__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.kh .mv-edit-parking__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--kh-ink);
  letter-spacing: 0;
}
.kh .mv-edit-parking__loc {
  font-size: 11px;
  color: var(--kh-mute);
}
.kh .mv-edit-parking__busy {
  display: inline-block;
  align-self: flex-start;
  font-size: 10px;
  font-weight: 600;
  color: var(--kh-warn);
  background: var(--kh-warn-soft);
  padding: 1px 6px;
  border-radius: 4px;
  margin-top: 2px;
  letter-spacing: 0.02em;
}
.kh .mv-edit-parking__item.is-occupied {
  opacity: 0.6;
  cursor: not-allowed;
  background: #fafaf6;
}
.kh .mv-edit-parking__item:has(input:checked) {
  border-color: var(--kh-teal);
  background: var(--kh-teal-soft);
}

.kh .mv-edit-art-choice {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.kh .mv-edit-art-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--kh-stroke);
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  overflow: hidden;
}
.kh .mv-edit-art-card input {
  margin: 3px 0 0;
  flex: 0 0 auto;
}
.kh .mv-edit-art-card__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.kh .mv-edit-art-card__text strong { font-size: 14px; font-weight: 600; color: var(--kh-ink); }
.kh .mv-edit-art-card__text small { font-size: 11.5px; color: var(--kh-mute); line-height: 1.4; }
.kh .mv-edit-art-card:has(input:checked) {
  border-color: var(--kh-teal);
  box-shadow: inset 3px 0 0 var(--kh-teal);
}
.kh .mv-edit-art-card:has(input:checked) .mv-edit-art-card__text strong { color: var(--kh-teal-ink); }

.kh .mv-edit-art-panel {
  padding: 14px 16px;
  border: 1px solid var(--kh-stroke-2);
  border-radius: 10px;
  background: #fbfaf6;
  margin-top: 4px;
}
.kh .mv-edit-art-panel h4 {
  margin: 0 0 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--kh-mute);
  font-weight: 600;
}
.kh .mv-edit-step-row {
  display: grid;
  grid-template-columns: 32px 1fr 1fr;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}
.kh .mv-edit-step-row .mv-step-num { align-self: center; }

.kh .mv-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.kh .muted { color: var(--kh-mute); }
.kh .small { font-size: 12px; }

/* ============================================================ */
/* Person detail v2                                              */
/* ============================================================ */

.person-detail-v2 {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.person-detail-v2 .person-detail-headline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.person-detail-v2 .person-detail-simple-main {
  align-items: center;
  gap: 22px;
}

.person-detail-v2 h1 {
  margin: 0;
  font-size: 28px;
}

.person-hero-pillrow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.hero-pill {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 14px;
  border-radius: 12px;
  background: #f3f6fa;
  border: 1px solid rgba(29, 36, 48, 0.08);
  min-width: 120px;
}

.hero-pill small {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  color: var(--muted, #66738a);
}

.hero-pill strong {
  font-size: 16px;
  font-weight: 700;
  color: #1a2330;
}

.hero-pill em {
  font-style: normal;
  font-size: 12px;
  color: var(--muted, #66738a);
}

.hero-pill.ok {
  background: #e2f1ea;
  border-color: rgba(14, 122, 92, 0.18);
}

.hero-pill.ok strong { color: #0e7a5c; }

.hero-pill.warning {
  background: #fff1d4;
  border-color: rgba(160, 102, 0, 0.18);
}

.hero-pill.warning strong { color: #8a5a00; }

.hero-pill.critical {
  background: #fcdede;
  border-color: rgba(167, 56, 56, 0.2);
}

.hero-pill.critical strong { color: #a73838; }

.hero-pill.muted {
  background: #eef1f5;
}

.person-detail-v2 .person-detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.person-detail-card > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.person-detail-card > header strong {
  font-size: 15px;
}

.address-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 4px 0 0;
  line-height: 1.4;
}

.address-block strong {
  font-size: 16px;
}

.balance-spotlight {
  padding: 14px 16px;
  border-radius: 12px;
  background: #f3f6fa;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.balance-spotlight strong {
  font-size: 22px;
}

.balance-spotlight small {
  color: var(--muted, #66738a);
  font-size: 12px;
}

.balance-spotlight.ok {
  background: #e2f1ea;
  color: #0e7a5c;
}

.balance-spotlight.warning {
  background: #fff1d4;
  color: #8a5a00;
}

.balance-spotlight.muted {
  background: #f3f6fa;
}

.person-fact-list.compact {
  margin: 0 0 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.person-fact-list.compact > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed #eaedf2;
  padding: 6px 0;
}

.person-fact-list.compact dt {
  color: var(--muted, #66738a);
  font-size: 12px;
}

.person-fact-list.compact dd {
  margin: 0;
  font-weight: 600;
  font-size: 14px;
}

.person-activity-stream-section {
  background: #fff;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 14px;
  padding: 18px 22px;
}

.stream-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.person-activity-stream {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stream-item {
  display: grid;
  grid-template-columns: 80px 1fr;
  align-items: start;
  gap: 14px;
  padding: 10px 12px;
  border-left: 3px solid #c7d3e1;
  background: #fafbfd;
  border-radius: 0 10px 10px 0;
}

.stream-item.tone-warning { border-left-color: #d99500; background: #fff8e8; }
.stream-item.tone-critical { border-left-color: #a73838; background: #fde9e9; }
.stream-item.tone-muted { border-left-color: #b2bbc8; }

.stream-date {
  font-size: 12px;
  color: var(--muted, #66738a);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 2px;
}

.stream-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.stream-content strong {
  font-size: 14px;
}

.stream-content small {
  color: var(--muted, #66738a);
  font-size: 13px;
}

.person-detail-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.person-card-detail {
  background: #fff;
  border: 1px solid rgba(29, 36, 48, 0.08);
  border-radius: 14px;
  overflow: hidden;
}

.person-card-detail > summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 22px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.person-card-detail > summary::-webkit-details-marker {
  display: none;
}

.person-card-detail > summary::after {
  content: '▾';
  font-size: 12px;
  color: var(--muted, #66738a);
  transform: rotate(-90deg);
  transition: transform 0.18s ease;
}

.person-card-detail[open] > summary::after {
  transform: rotate(0);
}

.person-card-detail[open] > summary {
  border-bottom: 1px solid #f0f3f7;
}

.person-card-detail > *:not(summary) {
  padding: 14px 22px 22px;
}

.lease-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lease-history-row {
  border: 1px solid #eef1f5;
  border-radius: 10px;
}

.lease-history-row.active {
  background: #f0f8f3;
  border-color: #c2e1ce;
}

.lease-history-row.historical {
  background: #fafbfd;
}

.lease-history-link {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  text-decoration: none;
  color: inherit;
}

.lease-history-link:hover {
  background: rgba(39, 100, 216, 0.04);
}

.lease-history-meta strong {
  font-size: 15px;
}

.lease-history-period {
  font-size: 13px;
  color: #3a4658;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lease-history-period em {
  font-style: normal;
  color: var(--muted, #66738a);
  font-size: 12px;
}

.lease-history-rent {
  text-align: right;
}

.lease-history-rent small {
  display: block;
  color: var(--muted, #66738a);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lease-history-rent strong {
  font-size: 15px;
}

.history-item.tone-warning {
  border-left-color: #d99500;
}

.history-item.tone-critical {
  border-left-color: #a73838;
}

@media (max-width: 900px) {
  .lease-history-link {
    grid-template-columns: 1fr auto;
  }
  .lease-history-period,
  .lease-history-rent {
    grid-column: 1 / -1;
    text-align: left;
  }
}



/* ===== Einheiten-Übersicht (Klarhaus) ===== */
/* Pane-Wrapper muss flex-stretchen, sonst kollabiert die .mv-list-Scroll-Kette */
.main:has(.kh .mv-table-card) [data-kh-pane]:not([hidden]) {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.kh .kh-units-header.kh-units-header--wohnungen,
.kh .kh-units-row.kh-units-row--wohnungen {
  grid-template-columns: 110px 1.7fr 110px 90px 1.3fr 1.5fr 28px;
}
.kh .kh-units-header.kh-units-header--stellplaetze,
.kh .kh-units-row.kh-units-row--stellplaetze {
  grid-template-columns: 140px 1.7fr 1.2fr 1.5fr 28px;
}
.kh .kh-units-row .mv-chip {
  width: auto;
  min-width: 44px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.kh .kh-units-row--wohnungen .mv-chip {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  font-size: 14px;
  padding: 0;
}
.kh-units .mv-header {
  background: #fafaf6;
}
@media (max-width: 1100px) {
  .kh .kh-units-header,
  .kh .kh-units-row {
    grid-template-columns: 1fr !important;
    column-gap: 8px;
    padding: 14px 18px;
  }
  .kh .kh-units-header { display: none; }
  .kh .kh-units-row .mv-cell--chip { flex-direction: row; align-items: center; gap: 12px; }
}

/* ===== Dashboard (Klarhaus) ===== */
.kh.kh-dash {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: 28px;
}
.kh-dash-meter {
  margin-top: 8px;
  height: 6px;
  border-radius: 999px;
  background: rgba(20, 20, 15, 0.08);
  overflow: hidden;
}
.kh-dash-meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--kh-teal, #0d9488) 0%, #34d399 100%);
  transition: width 0.4s var(--kh-ease, ease);
}

.kh .kh-dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 18px;
}
@media (max-width: 1100px) {
  .kh .kh-dash-grid { grid-template-columns: 1fr; }
}

/* List-style card body: keine inneren padding, items haben eigenes padding */
.kh .kh-card__body--list {
  padding: 4px 0 6px;
  display: flex;
  flex-direction: column;
}

.kh-task {
  display: grid;
  grid-template-columns: 6px 110px 1fr 16px;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  text-decoration: none;
  color: inherit;
  border-top: 1px solid rgba(20, 20, 15, 0.04);
  transition: background 0.15s var(--kh-ease, ease);
}
.kh-task:first-child { border-top: 0; }
.kh-task:hover { background: rgba(20, 20, 15, 0.03); }
.kh-task__rail {
  align-self: stretch;
  border-radius: 4px;
  background: var(--kh-info, #2563eb);
}
.kh-task--bad .kh-task__rail  { background: var(--kh-bad, #b91c1c); }
.kh-task--warn .kh-task__rail { background: var(--kh-warn, #b45309); }
.kh-task--info .kh-task__rail { background: var(--kh-info, #2563eb); }
.kh-task__chip {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  text-align: center;
}
.kh-task--bad .kh-task__chip  { background: #fee2e2; color: #991b1b; }
.kh-task--warn .kh-task__chip { background: #fef3c7; color: #854d0e; }
.kh-task--info .kh-task__chip { background: #dbeafe; color: #1e40af; }
.kh-task__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kh-task__main strong { font-size: 14px; }
.kh-task__main small { font-size: 12px; }
.kh-task__arrow { color: var(--kh-mute, #6b7280); }

/* Wohnungsraster */
.kh-dash-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.kh-dash-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 12px;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid rgba(20, 20, 15, 0.06);
  transition: transform 0.15s var(--kh-ease, ease), box-shadow 0.15s var(--kh-ease, ease);
  min-height: 0;
}
.kh-dash-tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(20, 20, 15, 0.08);
}
.kh-dash-tile strong { font-size: 17px; letter-spacing: 0.01em; }
.kh-dash-tile__label { font-size: 12px; font-weight: 600; opacity: 0.85; }
.kh-dash-tile__owner { font-size: 11px; opacity: 0.7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kh-dash-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 12px;
  color: var(--kh-mute, #6b7280);
}
.kh-dash-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  vertical-align: middle;
  margin-right: 6px;
}

/* Empty-state in Cards */
.kh-dash-empty {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 28px 22px;
  text-align: left;
}

/* Owner rows */
.kh-owner-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1.6fr) minmax(180px, 1.2fr) 110px;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  text-decoration: none;
  color: inherit;
  border-top: 1px solid rgba(20, 20, 15, 0.04);
  transition: background 0.15s var(--kh-ease, ease);
}
.kh-owner-row:first-child { border-top: 0; }
.kh-owner-row:hover { background: rgba(20, 20, 15, 0.03); }
.kh-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, #e0e7ff, #f5d0fe);
  color: #4338ca;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
}
.kh-owner-row__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kh-owner-row__main strong { font-size: 14px; }
.kh-owner-row__main small { font-size: 12px; }
.kh-owner-row__progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  font-variant-numeric: tabular-nums;
}
.kh-owner-row__amounts { font-size: 13px; }
.kh-progress {
  width: 140px;
  height: 6px;
  border-radius: 999px;
  background: rgba(20, 20, 15, 0.08);
  overflow: hidden;
}
.kh-progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--kh-teal, #0d9488) 0%, #34d399 100%);
  transition: width 0.4s var(--kh-ease, ease);
}
@media (max-width: 900px) {
  .kh-owner-row {
    grid-template-columns: 40px 1fr;
    row-gap: 6px;
  }
  .kh-owner-row__progress, .kh-owner-row .kh-pill { grid-column: 2 / -1; align-items: flex-start; }
  .kh-progress { width: 100%; }
}

/* Liquidität (Sparkline) */
.kh-spark {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  align-items: end;
  height: 110px;
  padding: 6px 0;
}
.kh-spark > span {
  display: block;
  height: var(--h, 50%);
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--kh-teal, #0d9488) 0%, #5eead4 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.kh-spark-axis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--kh-mute, #6b7280);
  text-align: center;
}
.kh-spark-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  font-size: 13px;
}

/* ============================================================
   Buchungsfinanzen (/finances)
   ============================================================ */
.kh .kh-finances { display: flex; flex-direction: column; gap: 16px; }
.kh .kh-finances__card { padding: 0; overflow: hidden; }
.kh .kh-finances__card > .kh-card__hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(20, 20, 15, 0.06);
}
.kh .kh-card__title { font-size: 16px; font-weight: 600; margin: 0; }
.kh .kh-card__sub { font-size: 13px; color: var(--kh-mute, #6b7280); margin: 4px 0 0; }
.kh .kh-card__foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid rgba(20,20,15,.06); background: var(--kh-card-soft, #fbfaf6); }

/* Tabs */
.kh .kh-finance-tabs {
  display: flex;
  gap: 4px;
  background: var(--kh-card, #fff);
  border-radius: 12px;
  padding: 6px;
  border: 1px solid rgba(20, 20, 15, 0.06);
  box-shadow: 0 1px 2px rgba(20, 20, 15, 0.03);
}
.kh .kh-finance-tabs__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--kh-mute, #6b7280);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.kh .kh-finance-tabs__item:hover { background: rgba(20,20,15,.04); color: var(--kh-ink, #1d1d1f); }
.kh .kh-finance-tabs__item--active { background: var(--kh-ink, #1d1d1f); color: #fafaf6; }
.kh .kh-finance-tabs__item--active:hover { background: var(--kh-ink, #1d1d1f); color: #fafaf6; }
.kh .kh-finance-tabs__count {
  background: rgba(0,0,0,.08);
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 1px 7px;
}
.kh .kh-finance-tabs__item--active .kh-finance-tabs__count { background: rgba(255,255,255,.18); color: #fafaf6; }

/* Year pill */
.kh .kh-pill--open { background: rgba(13,148,136,.12); color: var(--kh-teal, #0d9488); }
.kh .kh-pill--locked { background: rgba(146,64,14,.12); color: #92400e; }

/* Wirtschaftsjahr anlegen (Inline-Form als Popover) */
.kh .kh-year-create { position: relative; }
.kh .kh-year-create > summary {
  list-style: none;
  cursor: pointer;
}
.kh .kh-year-create > summary::-webkit-details-marker { display: none; }
.kh .kh-year-create__form {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  background: var(--kh-card, #fff);
  border: 1px solid rgba(20, 20, 15, 0.08);
  border-radius: 12px;
  box-shadow: 0 10px 32px rgba(20, 20, 15, 0.12);
  padding: 14px 16px;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kh .kh-year-create__form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--kh-mute, #6b7280); }
.kh .kh-year-create__form label > span { font-weight: 500; }
.kh .kh-year-create__form input[type="number"] {
  height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(20, 20, 15, 0.12);
  border-radius: 8px;
  background: var(--kh-card, #fff);
  font-family: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.kh .kh-year-create__hint { font-size: 11.5px; color: var(--kh-mute, #6b7280); font-style: italic; }
.kh .kh-year-create__hint code { background: rgba(20,20,15,.05); padding: 1px 4px; border-radius: 3px; font-family: 'IBM Plex Mono', monospace; }
.kh .kh-input {
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(20, 20, 15, 0.12);
  border-radius: 8px;
  background: var(--kh-card, #fff);
  font-size: 13.5px;
  font-family: inherit;
}

/* Filterbar */
.kh .kh-finances__filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(20,20,15,.06);
  align-items: end;
}
.kh .kh-finances__filterbar label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--kh-mute, #6b7280); }
.kh .kh-finances__filterbar label > span { font-weight: 500; }
.kh .kh-finances__filterbar select,
.kh .kh-finances__filterbar input {
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(20,20,15,.12);
  border-radius: 8px;
  background: var(--kh-card, #fff);
  font-size: 13.5px;
  font-family: inherit;
  min-width: 140px;
}
.kh .kh-finances__filterbar-search { flex: 1 1 220px; }
.kh .kh-finances__filterbar-search input { width: 100%; }

/* Bulk bar */
.kh .kh-bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  background: linear-gradient(180deg, #f0fdfa, #ecfdf5);
  border-bottom: 1px solid rgba(13,148,136,.18);
  font-size: 13.5px;
  font-weight: 500;
}
.kh .kh-bulk-bar__form { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.kh .kh-bulk-bar select { height: 32px; padding: 0 10px; border: 1px solid rgba(20,20,15,.12); border-radius: 8px; font-family: inherit; background: #fff; }

/* Transactions table */
.kh .kh-fin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.kh .kh-fin-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--kh-mute, #6b7280);
  padding: 12px 16px;
  border-bottom: 1px solid rgba(20, 20, 15, 0.06);
  background: var(--kh-card-soft, #fbfaf6);
}
.kh .kh-fin-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(20, 20, 15, 0.04);
  vertical-align: top;
}
.kh .kh-fin-table tbody tr:hover { background: rgba(20,20,15,.02); }
.kh .kh-fin-table__cb { width: 36px; text-align: center; }
.kh .kh-fin-table__date { font-variant-numeric: tabular-nums; white-space: nowrap; display: flex; flex-direction: column; gap: 2px; }
.kh .kh-fin-table__amount { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.kh .kh-amount--pos { color: var(--kh-teal, #0d9488); }
.kh .kh-amount--neg { color: #b91c1c; }
.kh .kh-fin-row__main { font-weight: 600; color: var(--kh-ink, #1d1d1f); }
.kh .kh-fin-row__sub { font-size: 12px; color: var(--kh-mute, #6b7280); margin-top: 2px; }
.kh .kh-fin-row__category small { display: block; font-size: 11px; color: var(--kh-mute, #6b7280); }
.kh .kh-fin-row__open { width: 60px; text-align: right; }
.kh .kh-fin-row__btn {
  background: transparent;
  border: 1px solid rgba(20, 20, 15, 0.08);
  border-radius: 8px;
  width: 28px;
  height: 28px;
  font-size: 16px;
  font-weight: 500;
  color: var(--kh-mute, #6b7280);
  cursor: pointer;
}
.kh .kh-fin-row__btn:hover { background: rgba(20, 20, 15, 0.04); color: var(--kh-ink, #1d1d1f); }
.kh .kh-fin-split-flag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  background: rgba(13, 148, 136, 0.12);
  color: var(--kh-teal, #0d9488);
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.06em;
}
.kh .kh-fin-row--muted { opacity: .5; }
.kh .kh-fin-empty td { padding: 32px; text-align: center; color: var(--kh-mute, #6b7280); }
.kh .kh-fin-empty strong { display: block; font-size: 14px; color: var(--kh-ink, #1d1d1f); margin-bottom: 4px; }
.kh .kh-import-workbench {
  display: grid;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(20,20,15,.06);
  background: #f8fafc;
}
.kh .kh-import-filters,
.kh .kh-import-bulk,
.kh .kh-import-bulk__assign {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}
.kh .kh-import-filters label,
.kh .kh-import-bulk__assign label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kh .kh-import-filters label > span {
  font-size: 11px;
  font-weight: 600;
  color: var(--kh-mute, #6b7280);
}
.kh .kh-import-filters input,
.kh .kh-import-filters select,
.kh .kh-import-bulk select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(20,20,15,.12);
  border-radius: 8px;
  background: var(--kh-card, #fff);
  font-size: 13px;
  font-family: inherit;
}
.kh .kh-import-filters label { flex: 1 1 150px; }
.kh .kh-import-filters__wide { flex: 2 1 260px; }
.kh .kh-import-bulk {
  min-height: 42px;
  padding: 10px;
  border: 1px solid rgba(13,148,136,.16);
  border-radius: 8px;
  background: #ecfdf5;
}
.kh .kh-import-bulk__summary {
  display: flex;
  flex-direction: column;
  min-width: 96px;
  font-size: 12px;
  color: var(--kh-mute, #6b7280);
}
.kh .kh-import-bulk__summary strong {
  color: var(--kh-ink, #1d1d1f);
  font-size: 13px;
}
.kh .kh-import-bulk__assign {
  margin-left: auto;
}
.kh .kh-import-bulk__assign select {
  min-width: 160px;
}
.kh .kh-import-bulk__fixed {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  background: rgba(13,148,136,.12);
  color: var(--kh-teal, #0d9488);
  font-size: 12.5px;
  font-weight: 600;
}
.kh .kh-import-action {
  min-width: 210px;
  max-width: 260px;
}
.kh .kh-import-preview-table .kh-fin-table {
  min-width: 1220px;
}
.kh .kh-import-target {
  min-width: 230px;
}
.kh .kh-import-target__group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.kh .kh-import-target__group[hidden] {
  display: none;
}
.kh .kh-import-target__group + .kh-import-target__group.is-active {
  margin-top: 6px;
}
.kh .kh-import-target__group label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kh .kh-import-target__group label > span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--kh-mute, #6b7280);
}
.kh .kh-import-target select,
.kh .kh-import-action {
  width: 100%;
  height: 34px;
  padding: 0 9px;
  border: 1px solid rgba(20,20,15,.12);
  border-radius: 8px;
  background: var(--kh-card, #fff);
  font-family: inherit;
  font-size: 12.5px;
}
.kh .kh-import-target__fixed,
.kh .kh-import-target__empty {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 12.5px;
}
.kh .kh-import-target__fixed {
  background: rgba(13,148,136,.12);
  color: var(--kh-teal, #0d9488);
  font-weight: 600;
}
.kh .kh-import-target__empty {
  background: rgba(115,115,115,.12);
  color: var(--kh-mute, #6b7280);
}

.kh .kh-manual-booking__form {
  background: #f8fafc;
}
.kh .kh-manual-booking__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 22px;
}
.kh .kh-manual-booking__grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.kh .kh-manual-booking__grid label > span {
  font-size: 12px;
  font-weight: 700;
  color: var(--kh-mute, #6b7280);
}
.kh .kh-manual-booking__grid input,
.kh .kh-manual-booking__grid select,
.kh .kh-manual-booking__grid textarea {
  width: 100%;
  border: 1px solid rgba(20,20,15,.12);
  border-radius: 8px;
  background: var(--kh-card, #fff);
  color: var(--kh-ink, #1d1d1f);
  font-family: inherit;
  font-size: 13.5px;
}
.kh .kh-manual-booking__grid input,
.kh .kh-manual-booking__grid select {
  height: 38px;
  padding: 0 10px;
}
.kh .kh-manual-booking__grid textarea {
  padding: 10px;
  resize: vertical;
}
.kh .kh-manual-booking__wide {
  grid-column: 1 / -1;
}

/* Status badges */
.kh .kh-fin-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.kh .kh-fin-badge--ok { background: rgba(4, 120, 87, 0.12); color: #047857; }
.kh .kh-fin-badge--warn { background: rgba(146, 64, 14, 0.12); color: #92400e; }
.kh .kh-fin-badge--neu { background: rgba(99, 102, 241, 0.12); color: #4338ca; }
.kh .kh-fin-badge--mute { background: rgba(115, 115, 115, 0.16); color: #525252; }
.kh .kh-fin-badge--info { background: rgba(56, 123, 199, 0.16); color: #1e40af; }

/* Account grid */
.kh .kh-account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  padding: 20px;
}
.kh .kh-account-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(20, 20, 15, 0.08);
  border-radius: 14px;
  padding: 16px;
  background: var(--kh-card, #fff);
  transition: transform .12s, box-shadow .15s;
}
.kh .kh-account-card:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(20,20,15,.06); }
.kh .kh-account-card--alloc { border-color: rgba(13, 148, 136, .25); }
.kh .kh-account-card--non { background: var(--kh-card-soft, #fbfaf6); }
.kh .kh-account-card__head { display: flex; justify-content: space-between; gap: 12px; align-items: start; margin-bottom: 8px; }
.kh .kh-account-card__head strong { font-size: 14px; }
.kh .kh-account-card__desc { font-size: 12px; color: var(--kh-mute, #6b7280); margin: 0 0 12px; }
.kh .kh-account-card__stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kh .kh-account-card__stats > div { display: flex; flex-direction: column; gap: 2px; }
.kh .kh-account-card__stats span { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--kh-mute, #6b7280); }
.kh .kh-account-card__stats strong { font-size: 14px; font-variant-numeric: tabular-nums; }

/* Ledger accounts */
.kh .kh-ledger-shell { background: #f6f8f7; }
.kh .kh-ledger-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 20px;
  background: #eef4f3;
  border-bottom: 1px solid rgba(20,20,15,.07);
}
.kh .kh-ledger-summary__item {
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid rgba(20,20,15,.08);
  border-radius: 8px;
  background: #fffaf0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kh .kh-ledger-summary__item--cost { background: #fff1f0; border-color: rgba(185,28,28,.16); }
.kh .kh-ledger-summary__item--income { background: #ecfdf5; border-color: rgba(4,120,87,.16); }
.kh .kh-ledger-summary__item--expense { background: #fff7ed; border-color: rgba(194,65,12,.16); }
.kh .kh-ledger-summary__item span,
.kh .kh-ledger-summary__item small {
  font-size: 11px;
  font-weight: 600;
  color: var(--kh-mute, #6b7280);
}
.kh .kh-ledger-summary__item strong {
  font-size: 18px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.kh .kh-ledger-automation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(37, 99, 235, .14);
  background: #eff6ff;
  color: #1e3a8a;
}
.kh .kh-ledger-automation > div:first-child {
  display: grid;
  gap: 3px;
}
.kh .kh-ledger-automation strong {
  font-size: 13.5px;
}
.kh .kh-ledger-automation span {
  font-size: 12px;
}
.kh .kh-ledger-automation__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.kh .kh-ledger-automation__meta span {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(30,58,138,.12);
  font-weight: 700;
}
.kh .kh-ledger-kind-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid rgba(20,20,15,.07);
}
.kh .kh-ledger-kind-tab {
  min-height: 56px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(20,20,15,.08);
  border-radius: 8px;
  color: var(--kh-ink, #1d1d1f);
  text-decoration: none;
  background: #fff;
}
.kh .kh-ledger-kind-tab:nth-child(1) { background: #edfdf7; border-color: rgba(4,120,87,.18); }
.kh .kh-ledger-kind-tab:nth-child(2) { background: #eff6ff; border-color: rgba(37,99,235,.16); }
.kh .kh-ledger-kind-tab:nth-child(3) { background: #fff7ed; border-color: rgba(194,65,12,.16); }
.kh .kh-ledger-kind-tab.is-active {
  outline: 2px solid rgba(20,20,15,.75);
  outline-offset: -2px;
}
.kh .kh-ledger-kind-tab strong { font-size: 13.5px; }
.kh .kh-ledger-kind-tab span {
  min-width: 28px;
  text-align: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(20,20,15,.08);
  font-size: 12px;
  font-weight: 700;
}
.kh .kh-ledger-browser {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  min-height: 620px;
}
.kh .kh-ledger-account-list {
  border-right: 1px solid rgba(20,20,15,.08);
  background: #f1f5f4;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kh .kh-ledger-account-list__head {
  display: grid;
  gap: 3px;
  padding: 4px 2px 8px;
}
.kh .kh-ledger-account-list__head strong { font-size: 13px; }
.kh .kh-ledger-account-list__head span { font-size: 12px; color: var(--kh-mute, #6b7280); }
.kh .kh-ledger-account {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(20,20,15,.08);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  background: #fff;
}
.kh .kh-ledger-account--unit { background: #f0fdf4; border-color: rgba(22,101,52,.15); }
.kh .kh-ledger-account--owner { background: #eff6ff; border-color: rgba(37,99,235,.15); }
.kh .kh-ledger-account--ledger { background: #fff7ed; border-color: rgba(194,65,12,.15); }
.kh .kh-ledger-account--cost_allocatable { background: #ecfdf5; border-color: rgba(4,120,87,.18); }
.kh .kh-ledger-account--cost_non_allocatable { background: #fff1f2; border-color: rgba(190,18,60,.16); }
.kh .kh-ledger-account--reserve { background: #eef2ff; border-color: rgba(67,56,202,.15); }
.kh .kh-ledger-account--income_rent,
.kh .kh-ledger-account--income_other { background: #eff6ff; border-color: rgba(37,99,235,.15); }
.kh .kh-ledger-account:hover,
.kh .kh-ledger-account.is-active {
  border-color: rgba(20,20,15,.36);
  box-shadow: 0 2px 8px rgba(20,20,15,.06);
}
.kh .kh-ledger-account__main {
  display: grid;
  gap: 4px;
}
.kh .kh-ledger-account__main .kh-pill {
  justify-self: start;
}
.kh .kh-ledger-account__main strong {
  font-size: 13.5px;
  line-height: 1.25;
}
.kh .kh-ledger-account__main small,
.kh .kh-ledger-account__meta {
  font-size: 11.5px;
  color: var(--kh-mute, #6b7280);
}
.kh .kh-ledger-account__numbers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.kh .kh-ledger-account__numbers span,
.kh .kh-ledger-account__numbers strong {
  overflow-wrap: anywhere;
}
.kh .kh-ledger-account__meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.kh .kh-ledger-detail {
  min-width: 0;
  background: #fbfcfb;
}
.kh .kh-ledger-detail__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(20,20,15,.07);
  background: #fff;
}
.kh .kh-ledger-detail__head h3 {
  margin: 8px 0 2px;
  font-size: 18px;
}
.kh .kh-ledger-detail__head p {
  margin: 0;
  color: var(--kh-mute, #6b7280);
  font-size: 12.5px;
}
.kh .kh-ledger-detail__totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px;
  min-width: min(430px, 100%);
}
.kh .kh-ledger-detail__totals div {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid rgba(20,20,15,.07);
}
.kh .kh-ledger-detail__totals span {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--kh-mute, #6b7280);
  text-transform: uppercase;
}
.kh .kh-ledger-detail__totals strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.kh .kh-account-warning {
  display: grid;
  gap: 12px;
  margin: 16px 16px 0;
  padding: 14px;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  background: #fffbeb;
  color: #78350f;
}
.kh .kh-account-warning--info {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #1e3a8a;
}
.kh .kh-account-warning__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.kh .kh-account-warning__head > div {
  display: grid;
  gap: 3px;
}
.kh .kh-account-warning__head strong {
  font-size: 14px;
}
.kh .kh-account-warning__head span {
  font-size: 12px;
  color: inherit;
  opacity: .78;
}
.kh .kh-account-warning__stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.kh .kh-account-warning__stats span {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid rgba(120, 53, 15, .16);
  border-radius: 8px;
  background: rgba(255, 255, 255, .62);
}
.kh .kh-account-warning--info .kh-account-warning__stats span {
  border-color: rgba(30, 58, 138, .16);
}
.kh .kh-account-warning__stats small {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: inherit;
  opacity: .72;
}
.kh .kh-account-warning__stats strong {
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.kh .kh-account-warning__messages {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
  font-size: 12.8px;
  line-height: 1.4;
}
.kh .kh-ledger-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}
.kh .kh-ledger-column {
  min-width: 0;
  border: 1px solid rgba(20,20,15,.08);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.kh .kh-ledger-column > header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(20,20,15,.07);
}
.kh .kh-ledger-column--income > header { background: #dcfce7; }
.kh .kh-ledger-column--expense > header { background: #fee2e2; }
.kh .kh-ledger-column > header strong { font-size: 14px; }
.kh .kh-ledger-column > header span { font-size: 12px; color: var(--kh-mute, #6b7280); }
.kh .kh-ledger-lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.kh .kh-ledger-lines th {
  padding: 10px 12px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--kh-mute, #6b7280);
  background: #f8fafc;
  border-bottom: 1px solid rgba(20,20,15,.06);
}
.kh .kh-ledger-lines td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(20,20,15,.05);
  vertical-align: top;
}
.kh .kh-ledger-line--income { background: #f0fdf4; }
.kh .kh-ledger-line--expense { background: #fff7ed; }
.kh .kh-ledger-line:hover { filter: saturate(1.04); }
.kh .kh-ledger-line__date,
.kh .kh-ledger-line__tx {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.kh .kh-ledger-line strong {
  display: block;
  font-size: 12.8px;
  line-height: 1.25;
}
.kh .kh-ledger-line small {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--kh-mute, #6b7280);
  line-height: 1.3;
}
.kh .kh-ledger-line--empty td,
.kh .kh-ledger-empty {
  padding: 24px;
  color: var(--kh-mute, #6b7280);
  text-align: center;
  background: #f8fafc;
}

@media (max-width: 1100px) {
  .kh .kh-ledger-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kh .kh-ledger-browser { grid-template-columns: 1fr; }
  .kh .kh-ledger-account-list {
    border-right: 0;
    border-bottom: 1px solid rgba(20,20,15,.08);
  }
  .kh .kh-ledger-detail__head { flex-direction: column; }
}

@media (max-width: 760px) {
  .kh .kh-ledger-summary,
  .kh .kh-ledger-kind-tabs,
  .kh .kh-ledger-columns,
  .kh .kh-ledger-detail__totals,
  .kh .kh-account-warning__stats,
  .kh .kh-manual-booking__grid {
    grid-template-columns: 1fr;
  }
  .kh .kh-account-warning__head {
    flex-direction: column;
  }
  .kh .kh-ledger-summary,
  .kh .kh-ledger-kind-tabs {
    padding: 12px;
  }
  .kh .kh-ledger-automation {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px;
  }
  .kh .kh-ledger-automation__meta {
    justify-content: flex-start;
  }
  .kh .kh-ledger-account__numbers {
    grid-template-columns: 1fr;
  }
  .kh .kh-ledger-column {
    overflow-x: auto;
  }
  .kh .kh-ledger-lines {
    min-width: 0;
    table-layout: fixed;
    font-size: 12px;
  }
  .kh .kh-ledger-lines th,
  .kh .kh-ledger-lines td {
    padding: 8px 6px;
  }
  .kh .kh-ledger-lines th:nth-child(1),
  .kh .kh-ledger-lines td:nth-child(1) {
    width: 78px;
  }
  .kh .kh-ledger-lines th:nth-child(2),
  .kh .kh-ledger-lines td:nth-child(2) {
    width: 54px;
    padding-left: 10px;
  }
  .kh .kh-ledger-lines th:nth-child(3),
  .kh .kh-ledger-lines td:nth-child(3) {
    padding-left: 10px;
  }
  .kh .kh-ledger-lines th:nth-child(4),
  .kh .kh-ledger-lines td:nth-child(4) {
    width: 86px;
  }
  .kh .kh-ledger-line strong,
  .kh .kh-ledger-line small {
    overflow-wrap: anywhere;
  }
}

/* Drawer */
.kh-drawer { position: fixed; inset: 0; z-index: 1000; }
.kh-drawer__backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 15, 15, .35);
  backdrop-filter: blur(2px);
}
.kh-drawer__panel {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: min(640px, 100vw);
  background: var(--kh-card, #fff);
  display: flex; flex-direction: column;
  box-shadow: -8px 0 32px rgba(20, 20, 15, .12);
  animation: kh-drawer-slide .2s ease-out;
}
@keyframes kh-drawer-slide { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.kh-drawer__header {
  display: flex; justify-content: space-between; align-items: start;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid rgba(20, 20, 15, .06);
}
.kh-drawer__eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--kh-mute, #6b7280); margin-bottom: 4px; }
.kh-drawer__title { font-size: 18px; font-weight: 600; margin: 0; }
.kh-drawer__sub { font-size: 13px; color: var(--kh-mute, #6b7280); margin-top: 4px; }
.kh-drawer__close {
  background: transparent; border: 1px solid rgba(20, 20, 15, .08);
  border-radius: 8px; width: 32px; height: 32px;
  font-size: 18px; font-weight: 500; cursor: pointer;
  color: var(--kh-mute, #6b7280);
}
.kh-drawer__close:hover { background: rgba(20, 20, 15, .04); color: var(--kh-ink, #1d1d1f); }
.kh-drawer__body { flex: 1; overflow-y: auto; padding: 20px 24px 32px; }
.kh-drawer__h3 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--kh-mute, #6b7280); margin: 20px 0 10px; }
.kh-drawer__meta {
  background: var(--kh-card-soft, #fbfaf6);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  display: grid; gap: 4px;
}
.kh-drawer__meta b { color: var(--kh-ink, #1d1d1f); }
.kh-drawer__actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid rgba(20, 20, 15, .06);
}
.kh-drawer__advanced { margin-top: 24px; }
.kh-drawer__advanced summary { font-size: 13px; font-weight: 500; cursor: pointer; padding: 8px 0; color: var(--kh-teal, #0d9488); }

/* Drawer form fields */
.kh-drawer .kh-form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.kh-drawer .kh-form-row label { font-size: 12px; font-weight: 500; color: var(--kh-mute, #6b7280); }
.kh-drawer .kh-form-row--split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kh-drawer .kh-form-row--split > div { display: flex; flex-direction: column; gap: 4px; }
.kh-drawer select,
.kh-drawer input[type="text"],
.kh-drawer input[type="number"],
.kh-drawer textarea {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(20, 20, 15, .12);
  border-radius: 8px;
  background: var(--kh-card, #fff);
  font-family: inherit;
  font-size: 13.5px;
}
.kh-drawer textarea { height: auto; padding: 8px 10px; resize: vertical; }

/* Split table */
.kh-split-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; }
.kh-split-table th { text-align: left; padding: 8px 6px; font-weight: 600; color: var(--kh-mute, #6b7280); border-bottom: 1px solid rgba(20,20,15,.06); }
.kh-split-table td { padding: 6px; border-bottom: 1px solid rgba(20,20,15,.03); }
.kh-split-table input, .kh-split-table select { width: 100%; height: 32px; padding: 0 8px; border: 1px solid rgba(20,20,15,.1); border-radius: 6px; font-size: 12.5px; font-family: inherit; }
.kh-split-foot { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.kh-split-sum { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.kh-split-sum--match { color: var(--kh-teal, #0d9488); }
.kh-split-sum--mismatch { color: #b91c1c; }

/* Rule preview */
.kh-rule-preview {
  background: var(--kh-card-soft, #fbfaf6);
  border-radius: 10px;
  padding: 14px;
  margin-top: 16px;
}
.kh-rule-preview__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.kh-rule-preview__counter { font-size: 12px; color: var(--kh-mute, #6b7280); }
.kh-rule-preview__body { font-size: 12.5px; max-height: 220px; overflow-y: auto; }
.kh-rule-preview__body .kh-rule-preview__group { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--kh-mute, #6b7280); margin: 8px 0 4px; }
.kh-rule-preview__body .kh-rule-preview__item { padding: 4px 0; border-bottom: 1px dashed rgba(20,20,15,.06); display: flex; justify-content: space-between; gap: 12px; }
.kh-rule-preview__body .kh-rule-preview__item:last-child { border-bottom: 0; }
.kh-rule-preview__body em { color: var(--kh-mute, #6b7280); }

/* Import form */
.kh .kh-import-form { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; padding: 18px 22px; }
.kh .kh-import-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--kh-mute, #6b7280); }
.kh .kh-import-form label > span { font-weight: 500; }
.kh .kh-import-form input,
.kh .kh-import-form select { height: 36px; padding: 0 10px; border: 1px solid rgba(20,20,15,.12); border-radius: 8px; background: var(--kh-card, #fff); font-family: inherit; font-size: 13.5px; min-width: 200px; }
.kh .kh-import-form__file input[type="file"] { padding: 6px 10px; }

/* Normalisierte Werte im Drawer */
.kh-drawer__normalized,
.kh-rule-normalized {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 12px;
}
.kh-rule-normalized strong { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #92400e; margin-bottom: 6px; }
.kh-drawer__normalized-row,
.kh-rule-normalized__row { display: flex; gap: 8px; align-items: baseline; padding: 2px 0; }
.kh-drawer__normalized-row span,
.kh-rule-normalized__row span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: #92400e; min-width: 130px; }
.kh-drawer__normalized-row code,
.kh-rule-normalized__row code { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: #1d1d1f; background: rgba(255,255,255,.6); padding: 1px 5px; border-radius: 4px; }
.kh-rule-normalized__hint { font-size: 11px; color: #92400e; margin-top: 6px; font-style: italic; }

/* Schnellvorschläge */
.kh-rule-suggestions {
  background: linear-gradient(180deg, #f0fdfa, #ecfdf5);
  border: 1px solid rgba(13,148,136,.25);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.kh-rule-suggestions strong { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--kh-teal, #0d9488); margin-bottom: 8px; }
.kh-rule-suggestion {
  background: var(--kh-card, #fff);
  border: 1px solid rgba(13,148,136,.18);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  width: 100%;
  font-family: inherit;
  transition: background .12s, transform .08s;
}
.kh-rule-suggestion:hover { background: rgba(13,148,136,.05); transform: translateX(2px); }
.kh-rule-suggestion__label { font-weight: 600; color: var(--kh-ink, #1d1d1f); }
.kh-rule-suggestion__hint { font-size: 11px; color: var(--kh-mute, #6b7280); }

/* Regel-Edit-Seite (Two-Pane) */
.kh .kh-rule-edit__form { padding: 22px; }
.kh .kh-rule-edit__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  gap: 24px;
  align-items: start;
}
@media (max-width: 1100px) {
  .kh .kh-rule-edit__grid { grid-template-columns: 1fr; }
}
.kh .kh-rule-edit__col { display: flex; flex-direction: column; gap: 16px; }
.kh .kh-rule-edit__preview-sticky { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 14px; }
.kh .kh-rule-edit__preview h3 { font-size: 14px; font-weight: 600; margin: 0 0 4px; }
.kh .kh-rule-edit__preview .kh-rule-preview { background: var(--kh-card-soft, #fbfaf6); margin: 0; padding: 14px; border-radius: 12px; }
.kh .kh-rule-edit__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: var(--kh-card, #fff);
  border: 1px solid rgba(20,20,15,.06);
  border-radius: 12px;
}
.kh .kh-rule-edit__apply { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--kh-mute, #6b7280); margin-bottom: 4px; }
.kh .kh-rule-edit__danger { padding-top: 12px; border-top: 1px solid rgba(20,20,15,.06); }

/* Fieldset im Form */
.kh .kh-fieldset {
  border: 1px solid rgba(20,20,15,.08);
  border-radius: 12px;
  padding: 16px 18px 12px;
  background: var(--kh-card, #fff);
}
.kh .kh-fieldset legend {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--kh-teal, #0d9488);
  padding: 0 6px;
}
.kh .kh-form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.kh .kh-form-row label { font-size: 12px; font-weight: 500; color: var(--kh-mute, #6b7280); }
.kh .kh-form-row--split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.kh .kh-form-row--split > div { display: flex; flex-direction: column; gap: 4px; }
.kh .kh-form-row > input,
.kh .kh-form-row > select,
.kh .kh-form-row > textarea,
.kh .kh-form-row--split input,
.kh .kh-form-row--split select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(20,20,15,.12);
  border-radius: 8px;
  background: var(--kh-card, #fff);
  font-family: inherit;
  font-size: 13.5px;
}
.kh .kh-form-row > textarea { height: auto; padding: 8px 10px; resize: vertical; }
.kh .kh-form-hint { font-size: 11.5px; color: var(--kh-mute, #6b7280); margin-top: 2px; font-style: italic; }
.kh .kh-form-hint code { background: rgba(20,20,15,.05); padding: 1px 4px; border-radius: 3px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; }
.kh .kh-form-advanced { margin-top: 4px; }
.kh .kh-form-advanced summary { font-size: 12.5px; font-weight: 500; cursor: pointer; padding: 6px 0; color: var(--kh-teal, #0d9488); }

/* Ruhiger Login: solides Panel, klare Lesbarkeit, grossflaechiges Bild bleibt erhalten. */
.login-page {
  --login-ink: #18212f;
  --login-muted: #5f6b7a;
  --login-line: #d8e0e8;
  --login-panel: #ffffff;
  --login-accent: #0f766e;
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 4vw, 56px);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(15, 35, 52, 0.34) 0%, rgba(15, 35, 52, 0.14) 42%, rgba(247, 249, 251, 0.88) 68%, rgba(247, 249, 251, 0.98) 100%),
    url("/assets/login-building.png") center / cover no-repeat;
}

.login-page::before,
.login-page::after {
  display: none;
  animation: none;
}

.login-page > .flash {
  position: absolute;
  top: 20px;
  right: clamp(20px, 4vw, 56px);
  z-index: 3;
  width: min(430px, calc(100% - 40px));
  margin: 0;
  color: var(--login-ink);
  border-color: var(--login-line);
  background: var(--login-panel);
  box-shadow: 0 12px 26px rgba(23, 35, 51, 0.12);
}

.login-visual {
  min-height: min(650px, 76vh);
}

.login-light-lines {
  display: none;
}

.login-ambient-card {
  left: clamp(18px, 5vw, 72px);
  bottom: clamp(24px, 8vh, 88px);
  max-width: 260px;
  padding: 12px 14px;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(16, 32, 48, 0.78);
  box-shadow: 0 16px 36px rgba(8, 20, 34, 0.20);
  backdrop-filter: none;
  animation: none;
}

.login-ambient-card span {
  color: rgba(255, 255, 255, 0.76);
}

.login-box.glass-card {
  position: relative;
  z-index: 2;
  justify-self: end;
  width: min(430px, 100%);
  padding: clamp(28px, 3vw, 36px);
  overflow: visible;
  color: var(--login-ink);
  border: 1px solid var(--login-line);
  border-radius: 8px;
  background: var(--login-panel);
  box-shadow: 0 24px 56px rgba(23, 35, 51, 0.16);
  backdrop-filter: none;
  animation: none;
}

.login-box.glass-card::before,
.login-box.glass-card::after {
  display: none;
  animation: none;
}

.login-brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.login-brand-lockup div {
  display: grid;
  gap: 1px;
}

.login-brand-lockup strong {
  color: var(--login-ink);
  font-size: 17px;
  line-height: 1.15;
}

.login-brand-lockup span {
  color: var(--login-muted);
  font-size: 13px;
  font-weight: 500;
}

.login-brand-mark {
  width: 40px;
  height: 40px;
  margin: 0;
  color: #ffffff;
  border-radius: 8px;
  background: #102338;
  box-shadow: none;
  font-size: 17px;
  font-weight: 800;
}

.login-box .eyebrow {
  display: block;
  color: var(--login-accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.login-box .page-title {
  margin: 7px 0 10px;
  color: var(--login-ink);
  font-size: clamp(30px, 4vw, 38px);
  font-weight: 700;
  line-height: 1.1;
}

.login-box .muted {
  margin: 0 0 24px;
  color: var(--login-muted);
  font-size: 15px;
  line-height: 1.5;
}

.login-box form.grid {
  gap: 15px;
}

.login-box label {
  gap: 6px;
  color: #2b3645;
  font-size: 14px;
  font-weight: 600;
}

.login-box input {
  min-height: 44px;
  color: var(--login-ink);
  border: 1px solid #bfc9d4;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

.login-box input:focus {
  outline: none;
  border-color: #2764d8;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(39, 100, 216, 0.14);
}

.login-button,
.login-box button.primary {
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
  border-color: #0f766e;
  background: #0f766e;
  color: #ffffff;
  box-shadow: none;
  font-weight: 700;
}

.login-button:hover,
.login-box button.primary:hover {
  background: #0b665f;
  transform: none;
}

.login-button:focus-visible,
.login-box button.primary:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.25);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .login-page {
    grid-template-columns: 1fr;
    align-items: center;
    justify-items: center;
    padding: 22px;
    background:
      linear-gradient(180deg, rgba(247, 249, 251, 0.90) 0%, rgba(247, 249, 251, 0.96) 54%, rgba(247, 249, 251, 0.98) 100%),
      url("/assets/login-building.png") 34% center / cover no-repeat;
  }

  .login-page > .flash {
    position: static;
    width: min(100%, 430px);
    margin-bottom: 14px;
  }

  .login-visual,
  .login-ambient-card {
    display: none;
  }

  .login-box.glass-card {
    justify-self: center;
    width: min(100%, 430px);
    margin: 0;
  }
}

@media (max-width: 460px) {
  .login-page {
    padding: 16px;
  }

  .login-box.glass-card {
    padding: 24px 20px;
  }

  .login-brand-lockup {
    margin-bottom: 22px;
  }
}

/* Calm app theme: appweite Beruhigung ohne Eingriff in Views oder Ablaufe. */
:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #d8e0e8;
  --text: #1f2937;
  --muted: #667085;
  --brand: #0f766e;
  --brand-2: #2764d8;
  --brand-3: #b7791f;
  --danger: #a33b3b;
  --warning: #9a6700;
  --ok: #22714f;
  --shadow: 0 1px 2px rgba(22, 34, 51, 0.06);
  --soft-shadow: 0 1px 2px rgba(22, 34, 51, 0.05);
  --focus-ring: rgba(39, 100, 216, 0.16);
  --surface-glass: #ffffff;
  --surface-veil: #f8fafc;
}

body {
  background: #f4f6f8;
  color: var(--text);
}

.app-shell {
  background: #f4f6f8;
}

.app-shell::before,
.app-shell::after {
  display: none !important;
  animation: none !important;
}

.app-shell *,
.app-shell *::before,
.app-shell *::after {
  animation: none !important;
}

.main {
  background: #f4f6f8;
}

.sidebar,
.app-shell .sidebar {
  color: #253244;
  border-right: 1px solid #d8e0e8;
  background: #ffffff;
  box-shadow: none;
  backdrop-filter: none;
}

.brand,
.brand-lockup,
.brand small,
.app-shell .brand,
.app-shell .brand small {
  color: #18212f;
}

.brand small,
.app-shell .brand small {
  color: #667085;
}

.app-shell .brand-mark {
  color: #ffffff;
  background: #102338;
  box-shadow: none;
}

.nav-group {
  color: #7a8698;
}

.nav-list a,
.secondary-nav summary,
.app-shell .primary-nav a {
  color: #405066;
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.nav-list a::after,
.secondary-nav summary::after,
.app-shell .primary-nav a::after {
  display: none !important;
}

.nav-list a:hover,
.secondary-nav summary:hover,
.app-shell .primary-nav a:hover {
  color: #18212f;
  border-color: #d8e0e8;
  background: #f6f8fb;
  box-shadow: none;
  transform: none;
}

.nav-list a.active,
.app-shell .primary-nav a.active {
  color: #0f3f3b;
  border-color: #b9d8d4;
  background: #e9f5f3;
  box-shadow: inset 3px 0 0 #0f766e;
}

.app-topbar,
.topbar,
.main:has(.kh) .topbar {
  margin: 0 0 22px;
  padding: 12px 14px;
  border: 1px solid #d8e0e8;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
  backdrop-filter: none;
}

.topbar-context strong,
.topbar-context span {
  color: #253244;
}

.topbar-context span {
  color: #667085;
}

.global-search,
.dropdown-menu,
.user-trigger,
.icon-button {
  border-color: #d8e0e8;
  background: #ffffff;
  box-shadow: none;
  backdrop-filter: none;
}

.user-avatar {
  color: #0f3f3b;
  background: #e9f5f3;
}

:where(
  .panel,
  .glass-card,
  .metric-card,
  .assistant-card,
  .cost-overview,
  .focus-card,
  .calm-panel,
  .form-card,
  .rule-card,
  .category-card,
  .quick-action,
  .issue-card,
  .data-card,
  .triage-card,
  .lease-work-card,
  .person-panel,
  .object-card,
  .person-stat-card,
  .person-quality-card,
  .person-directory-shell,
  .person-create-board,
  .person-detail-card,
  .accounting-year-card,
  .bank-card,
  .settings-card,
  .report-card,
  .stat-card,
  .hint-card
) {
  border-color: #d8e0e8 !important;
  background: #ffffff !important;
  box-shadow: 0 1px 2px rgba(22, 34, 51, 0.06) !important;
  backdrop-filter: none !important;
}

:where(
  .panel,
  .metric-card,
  .triage-card,
  .lease-work-card,
  .object-card,
  .person-stat-card,
  .person-quality-card,
  .person-directory-shell,
  .person-create-board,
  .person-detail-card,
  .detail-hero,
  .person-register-hero,
  .person-detail-hero,
  .object-hero,
  .workbench-head,
  .triage-head,
  .dashboard-hero,
  .focus-hero
)::before,
:where(
  .panel,
  .metric-card,
  .triage-card,
  .lease-work-card,
  .object-card,
  .person-stat-card,
  .person-quality-card,
  .person-directory-shell,
  .person-create-board,
  .person-detail-card,
  .detail-hero,
  .person-register-hero,
  .person-detail-hero,
  .object-hero,
  .workbench-head,
  .triage-head,
  .dashboard-hero,
  .focus-hero
)::after {
  display: none !important;
}

:where(.dashboard-hero, .focus-hero, .detail-hero, .workbench-head, .triage-head, .object-hero, .person-register-hero, .person-detail-hero) {
  color: #18212f !important;
  border: 1px solid #d8e0e8 !important;
  background: #ffffff !important;
  box-shadow: 0 1px 2px rgba(22, 34, 51, 0.06) !important;
}

:where(.dashboard-hero, .focus-hero, .detail-hero, .workbench-head, .triage-head, .object-hero) .eyebrow,
:where(.dashboard-hero, .focus-hero, .detail-hero, .workbench-head, .triage-head, .object-hero) h1,
:where(.dashboard-hero, .focus-hero, .detail-hero, .workbench-head, .triage-head, .object-hero) p,
.hero-controls label {
  color: inherit;
}

.status-pill {
  color: #0f3f3b;
  border-color: #b9d8d4;
  background: #e9f5f3;
}

.btn,
button,
.kh .kh-btn {
  box-shadow: none;
  transform: none;
}

.btn.primary,
button.primary,
.kh .kh-btn--teal,
.quick-action span,
.step-number {
  border-color: #0f766e !important;
  background: #0f766e !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

.btn.primary:hover,
button.primary:hover,
.kh .kh-btn--teal:hover {
  background: #0b665f !important;
  box-shadow: none !important;
  transform: none;
}

.btn.ghost,
.kh .kh-btn--ghost {
  background: #f6f8fb;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
select,
textarea,
.kh .kh-input,
.kh .kh-form-row > input,
.kh .kh-form-row > select,
.kh .kh-form-row > textarea,
.kh .kh-form-row--split input,
.kh .kh-form-row--split select {
  color: #1f2937;
  border-color: #c7d0dc;
  background: #ffffff;
  box-shadow: none;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):focus,
select:focus,
textarea:focus,
.kh .kh-input:focus-within {
  outline: none;
  border-color: #2764d8;
  box-shadow: 0 0 0 3px rgba(39, 100, 216, 0.14);
}

table,
.kh-table {
  background: #ffffff;
}

th,
.kh-table thead th,
.kh .mv-header {
  color: #405066;
  background: #f6f8fb;
  border-bottom-color: #d8e0e8;
}

td,
.kh-table tbody td {
  border-bottom-color: #e7ebf0;
}

tbody tr:hover,
.kh .kh-row:hover,
.kh .mv-row:hover,
.category-card:hover,
.quick-action:hover,
.issue-card:hover,
.data-card:hover,
.triage-card:hover,
.lease-work-card:hover,
.metric-card:hover {
  background: #f8fafc;
  box-shadow: none;
  transform: none;
}

.progress-track span,
.mini-bar span,
.kh-dash-meter > span,
.kh .kh-progress > span,
.kh .kh-spark span {
  background: #0f766e !important;
}

.mini-bar.blue span,
.kh .mv-metric--info::before {
  background: #2764d8 !important;
}

.mini-bar.amber span,
.kh .mv-metric--warn::before {
  background: #b7791f !important;
}

.mini-bar.rose span {
  background: #a33b3b !important;
}

.kh {
  --kh-bg: #f4f6f8;
  --kh-bg-2: #eef2f6;
  --kh-card: #ffffff;
  --kh-card-soft: #f8fafc;
  --kh-stroke: #d8e0e8;
  --kh-stroke-2: #e7ebf0;
  --kh-ink: #1f2937;
  --kh-ink-2: #405066;
  --kh-mute: #667085;
  --kh-faint: #98a2b3;
  --kh-teal: #0f766e;
  --kh-teal-2: #0f766e;
  --kh-teal-soft: #e9f5f3;
  --kh-teal-ink: #0f3f3b;
  --kh-owner: #0f766e;
  --kh-tenant: #2764d8;
  --kh-firm: #667085;
  --kh-vendor: #b7791f;
  --kh-ok: #22714f;
  --kh-ok-soft: #e8f4ee;
  --kh-warn: #9a6700;
  --kh-warn-soft: #fff4d6;
  --kh-bad: #a33b3b;
  --kh-bad-soft: #fbe8e8;
  --kh-info: #2764d8;
  --kh-info-soft: #e8f0fb;
  --kh-link: #2764d8;
  --kh-r-sm: 6px;
  --kh-r-md: 8px;
  --kh-r-lg: 8px;
  --kh-r-xl: 8px;
  color: var(--kh-ink);
}

.kh .kh-card,
.kh .mv-table-card,
.kh .kh-finances__card,
.kh .kh-fieldset,
.kh .kh-rule-edit__actions,
.kh .kh-drawer__panel {
  border-color: var(--kh-stroke);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(22, 34, 51, 0.06);
  backdrop-filter: none;
}

.kh .kh-card__head,
.kh .kh-card__hdr,
.kh .mv-toolbar {
  border-bottom-color: var(--kh-stroke-2);
  background: #ffffff;
}

.kh .kh-card__body {
  max-width: 100%;
}

.kh .kh-card__body:has(table),
.kh .kh-card__body:has(.kh-table),
.table-wrap {
  overflow-x: auto;
}

.kh .kh-page-header {
  margin-bottom: 18px;
}

.kh .kh-page-header__eyebrow,
.eyebrow {
  color: #0f766e;
}

.kh .kh-page-header__title {
  color: #18212f;
  font-weight: 700;
  letter-spacing: 0;
}

.kh .kh-btn {
  border-radius: 8px;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}

.kh .kh-btn:hover {
  background: #f6f8fb;
  box-shadow: none;
  transform: none;
}

.kh .kh-seg {
  border-color: #d8e0e8;
  background: #f1f4f7;
}

.kh .kh-seg__item--active {
  background: #ffffff;
  box-shadow: none;
}

.kh .kh-pill {
  border: 1px solid rgba(102, 112, 133, 0.16);
  background: #f1f4f7;
  color: #405066;
}

.kh .kh-pill--ok {
  background: #e8f4ee;
  color: #22714f;
}

.kh .kh-pill--warn {
  background: #fff4d6;
  color: #9a6700;
}

.kh .kh-pill--bad {
  background: #fbe8e8;
  color: #a33b3b;
}

.kh .kh-pill--info {
  background: #e8f0fb;
  color: #2764d8;
}

.kh .kh-pill--teal,
.kh .kh-pill--whg {
  background: #e9f5f3;
  color: #0f3f3b;
}

.kh .kh-avatar {
  border-color: #d8e0e8;
  background: #eef2f6;
  color: #405066;
}

.kh .kh-avatar--owner {
  background: #e9f5f3;
  color: #0f3f3b;
}

.kh .kh-avatar--tenant {
  background: #e8f0fb;
  color: #1d4f92;
}

.kh .kh-avatar--firm,
.kh .kh-avatar--vendor {
  background: #f1f4f7;
  color: #405066;
}

.kh .mv-metric {
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(22, 34, 51, 0.06);
}

.kh .mv-metric::before {
  background: #98a2b3;
}

.kh .mv-metric--primary::before {
  background: #0f766e !important;
}

.kh .mv-metric__value {
  color: #18212f;
}

.kh .kh-task:hover,
.kh .kh-owner-row:hover,
.kh .kh-dash-tile:hover,
.kh .kh-unit-chip:hover {
  background: #f8fafc;
  box-shadow: none;
  transform: none;
}

.kh .kh-dash-tile {
  color: #1f2937 !important;
  border-color: #d8e0e8 !important;
  background: #ffffff !important;
  box-shadow: none !important;
}

.kh .kh-dash-tile__label {
  color: #405066;
}

.kh .kh-dash-tile__owner {
  color: #667085;
}

.kh .kh-drawer__backdrop {
  background: rgba(24, 33, 47, 0.28);
  backdrop-filter: none;
}

.flash {
  border-color: #d8e0e8;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(22, 34, 51, 0.06);
}

@media (max-width: 900px) {
  .app-topbar,
  .topbar,
  .main:has(.kh) .topbar {
    margin: 0 0 18px;
    border-radius: 8px;
    border: 1px solid #d8e0e8;
  }

  .app-topbar,
  .topbar {
    align-items: stretch;
  }

  .topbar-context,
  .global-search,
  .topbar-actions {
    width: 100%;
    min-width: 0;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .kh .kh-page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .kh .kh-page-header__main {
    width: 100%;
    min-width: 0;
  }

  .kh .kh-page-header__title {
    font-size: clamp(24px, 7vw, 30px);
    overflow-wrap: anywhere;
  }

  .kh .kh-page-header__actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* Lesbarkeits- und Signalebene: weniger Reinweiss, mehr Rollen- und Statusflaechen. */
:root {
  --bg: #edf2f4;
  --panel: #fbfcf8;
  --line: #cbd7df;
  --text: #17202d;
  --muted: #526173;
  --brand: #0b6f67;
  --brand-2: #225fb8;
  --brand-3: #a7630b;
  --role-owner: #0f766e;
  --role-owner-bg: #e1f2ed;
  --role-owner-bg-strong: #cae7df;
  --role-tenant: #2764d8;
  --role-tenant-bg: #e2ecfb;
  --role-tenant-bg-strong: #cbdcf7;
  --role-vendor: #b7791f;
  --role-vendor-bg: #f8edcf;
  --role-vendor-bg-strong: #efd99e;
  --role-advisory: #7357b8;
  --role-advisory-bg: #eee8f8;
  --state-ok-bg: #e3f1e8;
  --state-warn-bg: #fff0c9;
  --state-bad-bg: #f9dfdf;
  --state-info-bg: #e0e9f8;
}

html,
body,
button,
input,
select,
textarea {
  font-family: "Atkinson Hyperlegible", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background: #edf2f4;
  color: #17202d;
  font-size: 15.5px;
  line-height: 1.5;
}

.kh,
.kh button,
.kh input,
.kh select,
.kh textarea {
  font-family: "Atkinson Hyperlegible", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.mono,
.kh .mono,
.kh .mv-metric__value,
.kh .kh-owner-row__amounts,
.metric strong {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.app-shell,
.main {
  background: #edf2f4;
}

.sidebar,
.app-shell .sidebar {
  background: #f7faf8;
  border-right-color: #c5d4dc;
}

.app-topbar,
.topbar,
.main:has(.kh) .topbar,
.global-search,
.dropdown-menu,
.user-trigger,
.icon-button {
  background: #fbfcf8;
  border-color: #cbd7df;
}

.nav-list a.active,
.app-shell .primary-nav a.active {
  color: #073d38;
  border-color: #9accc4;
  background: #dcefea;
  box-shadow: inset 4px 0 0 var(--role-owner);
}

.nav-list a:hover,
.secondary-nav summary:hover,
.app-shell .primary-nav a:hover {
  background: #eef6f3;
  border-color: #bdd4d1;
}

:where(
  .panel,
  .glass-card,
  .metric-card,
  .assistant-card,
  .cost-overview,
  .focus-card,
  .calm-panel,
  .form-card,
  .rule-card,
  .category-card,
  .quick-action,
  .issue-card,
  .data-card,
  .triage-card,
  .lease-work-card,
  .person-panel,
  .object-card,
  .person-stat-card,
  .person-quality-card,
  .person-directory-shell,
  .person-create-board,
  .person-detail-card,
  .accounting-year-card,
  .bank-card,
  .settings-card,
  .report-card,
  .stat-card,
  .hint-card
) {
  background: #fbfcf8 !important;
  border-color: #cbd7df !important;
}

.kh {
  --kh-bg: #edf2f4;
  --kh-card: #fbfcf8;
  --kh-card-soft: #f3f7f6;
  --kh-stroke: #cbd7df;
  --kh-stroke-2: #dbe5ea;
  --kh-ink: #17202d;
  --kh-ink-2: #334155;
  --kh-mute: #526173;
  --kh-faint: #7b8794;
  --kh-teal: var(--role-owner);
  --kh-teal-soft: var(--role-owner-bg);
  --kh-teal-ink: #073d38;
  --kh-owner: var(--role-owner);
  --kh-tenant: var(--role-tenant);
  --kh-vendor: var(--role-vendor);
  --kh-ok-soft: var(--state-ok-bg);
  --kh-warn-soft: var(--state-warn-bg);
  --kh-bad-soft: var(--state-bad-bg);
  --kh-info-soft: var(--state-info-bg);
}

.kh .kh-card,
.kh .mv-table-card,
.kh .kh-finances__card,
.kh .kh-fieldset,
.kh .kh-rule-edit__actions,
.kh .kh-drawer__panel {
  background: #fbfcf8;
  border-color: #cbd7df;
}

.kh .kh-card__head,
.kh .kh-card__hdr,
.kh .mv-toolbar,
.kh .mv-header,
th,
.kh-table thead th {
  background: #eef4f5;
  border-bottom-color: #cbd7df;
}

.kh .mv-metric {
  border-color: #cbd7df !important;
  background: #fbfcf8 !important;
}

.kh .mv-metric--primary {
  background: var(--role-owner-bg) !important;
  border-color: #9accc4 !important;
}

.kh .mv-metric--warn {
  background: var(--state-warn-bg) !important;
  border-color: #e7ca7a !important;
}

.kh .mv-metric--info {
  background: var(--role-tenant-bg) !important;
  border-color: #a9c0ea !important;
}

.kh .mv-metric:not(.mv-metric--primary):not(.mv-metric--warn):not(.mv-metric--info) {
  background: #eef2f5 !important;
  border-color: #cbd7df !important;
}

.kh .kh-pill--ok,
.badge.ok {
  background: var(--state-ok-bg);
  color: #145a3a;
  border-color: #b8dac5;
}

.kh .kh-pill--warn,
.badge.warn,
.badge.warning {
  background: var(--state-warn-bg);
  color: #7a4d00;
  border-color: #e6c66f;
}

.kh .kh-pill--bad,
.badge.danger {
  background: var(--state-bad-bg);
  color: #8a2b2b;
  border-color: #e3b0b0;
}

.kh .kh-pill--info,
.badge.info {
  background: var(--state-info-bg);
  color: #174b9a;
  border-color: #b6caed;
}

.kh .kh-pill--teal,
.kh .kh-pill--whg {
  background: var(--role-owner-bg);
  color: #073d38;
  border-color: #a7d3cc;
}

.kh .kh-avatar--owner,
.person-avatar.owner,
.avatar.owner {
  background: var(--role-owner-bg-strong);
  color: #073d38;
  border-color: #93c8c0;
}

.kh .kh-avatar--tenant,
.person-avatar.tenant,
.avatar.tenant {
  background: var(--role-tenant-bg-strong);
  color: #123f82;
  border-color: #9db9eb;
}

.kh .kh-avatar--vendor,
.person-avatar.vendor,
.avatar.vendor {
  background: var(--role-vendor-bg-strong);
  color: #704100;
  border-color: #dfbf67;
}

.kh .kh-row {
  border-bottom-color: rgba(70, 89, 105, 0.16);
}

.kh .kh-row[data-kind="owner"] {
  background: linear-gradient(90deg, rgba(15, 118, 110, 0.16), rgba(225, 242, 237, 0.82) 42%, rgba(251, 252, 248, 0.92));
}

.kh .kh-row[data-kind="tenant"] {
  background: linear-gradient(90deg, rgba(39, 100, 216, 0.16), rgba(226, 236, 251, 0.84) 42%, rgba(251, 252, 248, 0.92));
}

.kh .kh-row[data-kind="vendor"],
.kh .kh-row[data-kind="firm"] {
  background: linear-gradient(90deg, rgba(183, 121, 31, 0.16), rgba(248, 237, 207, 0.84) 42%, rgba(251, 252, 248, 0.92));
}

.kh .kh-row[data-kinds~="owner"][data-kinds~="tenant"] {
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.18), rgba(39, 100, 216, 0.14) 44%, rgba(251, 252, 248, 0.92)),
    var(--role-owner-bg);
}

.kh .kh-row:hover {
  filter: saturate(1.08);
  background-color: transparent;
}

.kh .kh-row--active {
  outline: 2px solid rgba(15, 118, 110, 0.30);
  outline-offset: -2px;
}

.kh .kh-row[data-kind="tenant"].kh-row--active {
  outline-color: rgba(39, 100, 216, 0.32);
}

.kh-owner-row {
  background: linear-gradient(90deg, rgba(15, 118, 110, 0.14), rgba(225, 242, 237, 0.70) 40%, rgba(251, 252, 248, 0.92));
}

.kh-owner-row:hover {
  background: linear-gradient(90deg, rgba(15, 118, 110, 0.20), rgba(210, 235, 228, 0.86) 44%, rgba(251, 252, 248, 0.96)) !important;
}

.people-simple-table tbody tr.person-row-tone-owner,
.person-mobile-card.person-row-tone-owner,
.role-assignment-row.owner {
  background: linear-gradient(90deg, rgba(15, 118, 110, 0.16), rgba(225, 242, 237, 0.84) 42%, rgba(251, 252, 248, 0.94));
}

.people-simple-table tbody tr.person-row-tone-tenant,
.person-mobile-card.person-row-tone-tenant,
.role-assignment-row.tenant {
  background: linear-gradient(90deg, rgba(39, 100, 216, 0.16), rgba(226, 236, 251, 0.86) 42%, rgba(251, 252, 248, 0.94));
}

.people-simple-table tbody tr.person-row-tone-vendor,
.person-mobile-card.person-row-tone-vendor,
.role-assignment-row.vendor {
  background: linear-gradient(90deg, rgba(183, 121, 31, 0.18), rgba(248, 237, 207, 0.88) 42%, rgba(251, 252, 248, 0.94));
}

.people-simple-table tbody tr.person-row-tone-advisory,
.person-mobile-card.person-row-tone-advisory,
.role-assignment-row.advisory {
  background: linear-gradient(90deg, rgba(115, 87, 184, 0.16), rgba(238, 232, 248, 0.88) 42%, rgba(251, 252, 248, 0.94));
}

.kh .mv-row {
  background: #fbfcf8;
}

.kh .mv-row:nth-child(even) {
  background: #f1f6f7;
}

.kh .mv-row:has(.mv-tenants),
.kh .mv-row:has(.mv-tenant-name) {
  background:
    linear-gradient(90deg, rgba(39, 100, 216, 0.12), rgba(226, 236, 251, 0.74) 38%, rgba(251, 252, 248, 0.94));
}

.kh .mv-row:has(.mv-owner-line) {
  box-shadow: inset 4px 0 0 rgba(15, 118, 110, 0.72);
}

.kh .mv-owner-line__label,
.kh .mv-owner-line__name {
  color: #0b524c;
}

.kh .mv-tenant-name {
  color: #123f82;
}

.kh-dash-tile {
  background: #f3f7f6 !important;
}

.kh .kh-dash-tile {
  background: linear-gradient(180deg, rgba(251, 252, 248, 0.92), rgba(238, 246, 244, 0.94)) !important;
}

.kh-task--bad {
  background: linear-gradient(90deg, rgba(163, 59, 59, 0.14), rgba(249, 223, 223, 0.72), rgba(251, 252, 248, 0.92));
}

.kh-task--warn {
  background: linear-gradient(90deg, rgba(183, 121, 31, 0.16), rgba(255, 240, 201, 0.78), rgba(251, 252, 248, 0.92));
}

.kh-task--info {
  background: linear-gradient(90deg, rgba(39, 100, 216, 0.13), rgba(224, 233, 248, 0.78), rgba(251, 252, 248, 0.92));
}

tbody tr:hover,
.kh .kh-row:hover,
.kh .mv-row:hover,
.category-card:hover,
.quick-action:hover,
.issue-card:hover,
.data-card:hover,
.triage-card:hover,
.lease-work-card:hover,
.metric-card:hover {
  background-color: #eaf2f3;
}

@media (max-width: 900px) {
  .kh .kh-row,
  .kh-owner-row,
  .kh .mv-row {
    background-size: 100% 100%;
  }
}

/* Lesbarkeits- und Dichteebene v2: klare Statusfarben, weniger Leerflaeche. */
:root {
  --bg: #e8eef1;
  --panel: #fbfcf8;
  --line: #b9c8d2;
  --text: #101828;
  --muted: #3f4f63;
  --status-free-bg: #dff3e7;
  --status-free-border: #92d3aa;
  --status-free-ink: #0f5b3a;
  --status-free-rail: #208c53;
  --status-occupied-bg: #fff0c9;
  --status-occupied-border: #e1bd53;
  --status-occupied-ink: #765000;
  --status-occupied-rail: #b7791f;
  --status-action-bg: #f9dfdf;
  --status-action-border: #e4a2a2;
  --status-action-ink: #8a2b2b;
  --status-action-rail: #a33b3b;
}

html,
body,
button,
input,
select,
textarea,
.kh,
.kh button,
.kh input,
.kh select,
.kh textarea {
  font-family: Arial, "Helvetica Neue", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif !important;
}

body {
  background: var(--bg) !important;
  color: var(--text) !important;
  font-size: 16px;
  line-height: 1.42;
}

.muted,
.small,
small,
.kh .kh-page-header__sub,
.kh .mv-metric__sub,
.kh .mv-counter,
.kh .kh-card__title,
.kh .mv-unit-sub,
.kh .kh-tl-sub,
.kh .kh-tl-date,
.kh .kh-fin-table__meta,
.kh .kh-dash-legend {
  color: var(--muted) !important;
}

.app-shell {
  grid-template-columns: 232px minmax(0, 1fr) !important;
  background: var(--bg) !important;
}

.main,
.main:has(.kh) {
  padding: 14px 18px 24px !important;
}

.sidebar,
.app-shell .sidebar {
  padding: 12px 10px !important;
  background: #f7faf8 !important;
  border-right-color: var(--line) !important;
}

.brand,
.app-shell .brand-lockup {
  margin-bottom: 10px !important;
}

.nav-group {
  margin: 12px 0 5px !important;
  color: #5f6f80 !important;
}

.nav-list,
.app-shell .primary-nav {
  gap: 2px !important;
}

.nav-list a,
.app-shell .primary-nav a {
  min-height: 32px !important;
  padding: 7px 9px !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  line-height: 1.2 !important;
}

.app-topbar,
.topbar,
.main:has(.kh) .topbar {
  min-height: 46px !important;
  margin: 0 0 10px !important;
  padding: 7px 10px !important;
  background: #fbfcf8 !important;
  border-color: var(--line) !important;
}

.global-search input,
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
select,
textarea,
.kh .kh-input,
.kh .kh-form-row > input,
.kh .kh-form-row > select,
.kh .kh-form-row > textarea {
  color: var(--text) !important;
  border-color: var(--line) !important;
  background: #ffffff !important;
}

.kh {
  --kh-bg: #eef3f5;
  --kh-bg-2: #e8eef1;
  --kh-card: #fbfcf8;
  --kh-card-soft: #f1f5f6;
  --kh-stroke: #b9c8d2;
  --kh-stroke-2: #d8e1e7;
  --kh-ink: #101828;
  --kh-ink-2: #263444;
  --kh-mute: #3f4f63;
  --kh-faint: #758395;
  font-size: 15px;
  line-height: 1.42;
  color: var(--kh-ink) !important;
  background: transparent !important;
  padding: 12px clamp(14px, calc((100vw - 1420px) / 2 + 14px), 72px) 20px !important;
}

.kh.kh-dash {
  gap: 12px !important;
  padding-bottom: 18px !important;
}

.kh .kh-page-header {
  padding: 2px 0 10px !important;
  margin-bottom: 8px !important;
  gap: 12px !important;
}

.kh .kh-page-header__eyebrow {
  margin-bottom: 2px !important;
  font-size: 12px !important;
}

.kh .kh-page-header__title {
  font-size: 24px !important;
  letter-spacing: 0 !important;
  color: var(--text) !important;
}

.kh .kh-card,
.kh .mv-table-card,
.kh .kh-finances__card,
.kh .kh-fieldset,
.panel,
.metric-card,
.triage-card,
.lease-work-card,
.data-card,
.issue-card {
  background: var(--panel) !important;
  border-color: var(--line) !important;
  border-radius: 8px !important;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06) !important;
}

.kh .kh-card__head,
.kh .kh-card__hdr,
.kh .mv-toolbar,
.kh .mv-header,
th,
.kh-table thead th,
.kh .kh-fin-table thead th,
.kh .kh-ledger-lines th {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
  background: #eef4f5 !important;
  color: #263444 !important;
  border-bottom-color: var(--line) !important;
}

.kh .kh-card__head,
.kh .kh-card__hdr,
.kh .mv-toolbar {
  padding-left: 12px !important;
  padding-right: 12px !important;
}

.kh .kh-card__body {
  padding: 10px 12px !important;
}

.kh .kh-card__body--list {
  padding: 2px 0 4px !important;
}

.mv-dashboard-strip,
.kh .mv-dashboard-strip {
  gap: 10px !important;
  margin-bottom: 10px !important;
}

.kh .mv-metric,
.metric-card {
  min-height: 0 !important;
  padding: 10px 12px !important;
  gap: 3px !important;
  background: #fbfcf8 !important;
}

.kh .mv-metric__label,
.metric-card span,
.kh .mv-header,
th,
.kh-table thead th {
  font-size: 11px !important;
  letter-spacing: 0.03em !important;
}

.kh .mv-metric__value,
.metric-card strong,
.metric-value {
  font-family: inherit !important;
  font-variant-numeric: tabular-nums;
  font-size: clamp(19px, 1.8vw, 24px) !important;
  letter-spacing: 0 !important;
}

table,
.kh-table,
.kh .kh-fin-table,
.kh .kh-ledger-lines {
  font-size: 14px !important;
  background: #fbfcf8 !important;
}

th,
td,
.kh-table thead th,
.kh-table tbody td,
.kh .kh-fin-table thead th,
.kh .kh-fin-table tbody td,
.kh .kh-ledger-lines th,
.kh .kh-ledger-lines td,
.people-simple-table th,
.people-simple-table td {
  padding: 7px 8px !important;
  line-height: 1.32 !important;
}

tbody tr:nth-child(even),
.kh .mv-row:nth-child(even) {
  background-color: #f1f6f7 !important;
}

tbody tr:hover,
.kh .kh-row:hover,
.kh .mv-row:hover,
.kh .kh-task:hover,
.kh .kh-owner-row:hover,
.category-card:hover,
.quick-action:hover,
.issue-card:hover,
.data-card:hover,
.triage-card:hover,
.lease-work-card:hover,
.metric-card:hover {
  background-color: #eaf2f3 !important;
  box-shadow: none !important;
  transform: none !important;
}

.kh .mv-row {
  min-height: 0 !important;
  padding: 9px 12px !important;
  column-gap: 12px !important;
}

.kh .mv-header {
  padding-left: 12px !important;
  padding-right: 12px !important;
  column-gap: 12px !important;
}

.kh .kh-units-row .mv-chip,
.kh .kh-units-row--wohnungen .mv-chip,
.kh .mv-chip {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  box-shadow: inset 0 0 0 1px rgba(16, 24, 40, 0.08) !important;
}

.kh .kh-units-row--stellplaetze .mv-chip {
  width: auto !important;
  padding: 0 10px !important;
}

.kh-dash-grid,
.kh .kh-dash-grid {
  gap: 12px !important;
}

.kh-dash-tiles,
.kh .kh-dash-tiles {
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)) !important;
  gap: 8px !important;
}

.kh .kh-dash-tile {
  padding: 10px !important;
  min-height: 78px !important;
  border-radius: 8px !important;
  color: var(--text) !important;
  background: #fbfcf8 !important;
  border-color: var(--line) !important;
  box-shadow: inset 5px 0 0 #98a2b3 !important;
}

.kh .kh-dash-tile.kh-dash-tile--free {
  background: var(--status-free-bg) !important;
  border-color: var(--status-free-border) !important;
  color: var(--status-free-ink) !important;
  box-shadow: inset 5px 0 0 var(--status-free-rail) !important;
}

.kh .kh-dash-tile.kh-dash-tile--occupied {
  background: var(--status-occupied-bg) !important;
  border-color: var(--status-occupied-border) !important;
  color: var(--status-occupied-ink) !important;
  box-shadow: inset 5px 0 0 var(--status-occupied-rail) !important;
}

.kh .kh-dash-tile.kh-dash-tile--action {
  background: var(--status-action-bg) !important;
  border-color: var(--status-action-border) !important;
  color: var(--status-action-ink) !important;
  box-shadow: inset 5px 0 0 var(--status-action-rail) !important;
}

.kh .kh-dash-tile strong {
  font-size: 17px !important;
  color: inherit !important;
}

.kh .kh-dash-tile__label,
.kh .kh-dash-tile__owner {
  color: inherit !important;
  opacity: 0.88 !important;
}

.kh .kh-dash-tile__label {
  font-weight: 700 !important;
}

.kh .kh-dash-tile:hover {
  filter: brightness(0.98);
}

.kh-dash-legend,
.kh .kh-dash-legend {
  gap: 12px !important;
  margin-top: 10px !important;
  font-size: 12.5px !important;
}

.kh-dash-legend .kh-legend-free,
.kh .kh-dash-legend .kh-legend-free {
  background: var(--status-free-rail) !important;
}

.kh-dash-legend .kh-legend-occupied,
.kh .kh-dash-legend .kh-legend-occupied {
  background: var(--status-occupied-rail) !important;
}

.kh-dash-legend .kh-legend-action,
.kh .kh-dash-legend .kh-legend-action {
  background: var(--status-action-rail) !important;
}

.kh-task {
  padding: 10px 12px !important;
  gap: 10px !important;
  grid-template-columns: 5px 100px 1fr 14px !important;
}

.kh .kh-btn {
  min-height: 32px !important;
  height: auto !important;
  padding: 6px 10px !important;
  font-size: 13.5px !important;
}

.kh .kh-btn--sm {
  min-height: 28px !important;
  padding: 4px 8px !important;
  font-size: 12.5px !important;
}

@media (max-width: 900px) {
  .main,
  .main:has(.kh) {
    padding: 10px 10px 18px !important;
  }

  .kh {
    padding: 8px 0 16px !important;
  }

  .kh .kh-page-header__title {
    font-size: 22px !important;
  }

  .kh-dash-tiles,
  .kh .kh-dash-tiles {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)) !important;
  }
}

/* Dashboard Sammelkonten: Saldo als Hauptsignal, nicht als Kleingedrucktes. */
.kh .kh-owner-row {
  grid-template-columns: 40px minmax(180px, 1fr) minmax(260px, 360px) auto !important;
  gap: 12px !important;
  align-items: center !important;
  padding: 10px 12px !important;
  background: #fbfcf8 !important;
}

.kh .kh-owner-row:hover {
  background: #eaf2f3 !important;
}

.kh .kh-owner-row__main strong {
  font-size: 15px !important;
  color: #101828 !important;
}

.kh .kh-owner-row__money {
  justify-self: stretch;
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #b9c8d2;
  border-radius: 8px;
  background: #eef4f5;
}

.kh .kh-owner-row__money-label {
  color: #3f4f63;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1;
  text-transform: uppercase;
}

.kh .kh-owner-row__saldo {
  display: block;
  color: #101828;
  font-family: Arial, "Helvetica Neue", "Segoe UI", system-ui, sans-serif !important;
  font-size: clamp(24px, 2.2vw, 30px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.kh .kh-owner-row__saldo.is-positive {
  color: #0f5b3a;
}

.kh .kh-owner-row__saldo.is-negative {
  color: #8a2b2b;
}

.kh .kh-owner-row__saldo.is-neutral {
  color: #263444;
}

.kh .kh-owner-row__money-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.kh .kh-owner-row__money-split span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 5px 7px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #d8e1e7;
}

.kh .kh-owner-row__money-split small {
  color: #3f4f63 !important;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.kh .kh-owner-row__money-split b {
  color: #101828;
  font-size: 13px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.kh .kh-owner-row__meta {
  color: #3f4f63 !important;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.15;
}

.kh .kh-owner-row > .kh-pill {
  justify-self: end;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .sidebar,
  .app-shell .sidebar {
    position: static !important;
    width: auto !important;
    min-height: 0 !important;
    padding: 8px 10px !important;
    border-right: 0 !important;
    border-bottom: 1px solid #b9c8d2 !important;
  }

  .app-shell .brand-lockup {
    padding: 4px 6px 8px !important;
    margin-bottom: 8px !important;
  }

  .app-shell .primary-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .app-topbar,
  .topbar,
  .main:has(.kh) .topbar {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .kh .kh-owner-row {
    grid-template-columns: 36px minmax(0, 1fr) !important;
    gap: 8px 10px !important;
  }

  .kh .kh-owner-row__money {
    grid-column: 1 / -1;
  }

  .kh .kh-owner-row > .kh-pill {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 380px) {
  .kh .kh-owner-row__money-split {
    grid-template-columns: 1fr;
  }

  .kh .kh-owner-row__saldo {
    font-size: 22px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* Dashboard Sammelkonten kompakt: Saldo sichtbar, aber keine wuchtige Box. */
.kh .kh-owner-row {
  grid-template-columns: 40px minmax(0, 1fr) minmax(180px, 250px) auto !important;
  min-height: 0 !important;
  padding: 9px 12px !important;
}

.kh .kh-owner-row__money {
  align-self: center;
  justify-self: end;
  gap: 3px;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  text-align: right;
}

.kh .kh-owner-row__money-label {
  font-size: 10px;
  color: #526173 !important;
}

.kh .kh-owner-row__saldo {
  font-size: clamp(21px, 1.8vw, 25px);
  line-height: 1.05;
}

.kh .kh-owner-row__money-split {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.kh .kh-owner-row__money-split span {
  display: inline-flex;
  gap: 4px;
  align-items: baseline;
  padding: 0;
  border: 0;
  background: transparent;
}

.kh .kh-owner-row__money-split small,
.kh .kh-owner-row__money-split b,
.kh .kh-owner-row__meta {
  font-size: 11.5px;
}

@media (max-width: 900px) {
  .kh .kh-owner-row__money {
    grid-column: 2 / -1;
    justify-self: stretch;
    text-align: left;
  }

  .kh .kh-owner-row__money-split {
    justify-content: flex-start;
  }

  .kh .kh-owner-row__saldo {
    font-size: 22px;
  }
}

@media (max-width: 900px) {
  .kh .kh-owner-row {
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: start !important;
    row-gap: 4px !important;
    padding: 9px 10px !important;
  }

  .kh .kh-owner-row .kh-avatar {
    display: none;
  }

  .kh .kh-owner-row__main {
    grid-column: 1 / 2;
    grid-row: 1;
  }

  .kh .kh-owner-row__money {
    grid-column: 2 / 3;
    grid-row: 1;
    justify-self: end;
    max-width: 190px;
    text-align: right;
  }

  .kh .kh-owner-row__money-label,
  .kh .kh-owner-row__money-split,
  .kh .kh-owner-row__meta {
    display: none;
  }

  .kh .kh-owner-row__saldo {
    font-size: 20px;
    white-space: nowrap;
  }

  .kh .kh-owner-row > .kh-pill {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: start;
    margin-top: 0;
  }
}

@media (max-width: 520px) {
  .kh .kh-owner-row {
    grid-template-columns: 1fr !important;
  }

  .kh .kh-owner-row__money {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    max-width: none;
    text-align: left;
  }

  .kh .kh-owner-row > .kh-pill {
    grid-row: 3;
  }

  .kh .kh-owner-row__saldo {
    font-size: 22px;
  }
}

/* Dashboard Sammelkonten final: nur Saldo, damit die Liste echte Zeilen bleibt. */
.kh .kh-owner-row {
  grid-template-columns: 40px minmax(0, 1fr) max-content !important;
  min-height: 56px !important;
  gap: 10px !important;
  align-items: center !important;
  padding: 8px 12px !important;
}

.kh .kh-owner-row__main {
  min-width: 0;
}

.kh .kh-owner-row__main strong,
.kh .kh-owner-row__main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kh .kh-owner-row__money {
  grid-column: auto !important;
  grid-row: auto !important;
  justify-self: end !important;
  align-self: center !important;
  max-width: none !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  text-align: right !important;
}

.kh .kh-owner-row__saldo {
  font-size: clamp(20px, 1.7vw, 24px) !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

.kh .kh-owner-row__money-label,
.kh .kh-owner-row__money-split,
.kh .kh-owner-row__meta,
.kh .kh-owner-row > .kh-pill {
  display: none !important;
}

@media (max-width: 900px) {
  .kh .kh-owner-row {
    grid-template-columns: minmax(0, 1fr) max-content !important;
    min-height: 58px !important;
  }

  .kh .kh-owner-row .kh-avatar {
    display: none !important;
  }

  .kh .kh-owner-row__main {
    grid-column: 1 !important;
    grid-row: 1 !important;
  }

  .kh .kh-owner-row__money {
    grid-column: 2 !important;
    grid-row: 1 !important;
  }

  .kh .kh-owner-row__saldo {
    font-size: 21px !important;
  }
}

@media (max-width: 380px) {
  .kh .kh-owner-row {
    grid-template-columns: 1fr !important;
  }

  .kh .kh-owner-row__money {
    grid-column: 1 !important;
    grid-row: 2 !important;
    justify-self: start !important;
    text-align: left !important;
  }
}
