:root {
  --font-display: "Manrope", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --bg: #f3f1ec;
  --bg-elev: #fffcf7;
  --bg-soft: #e8e4db;
  --line: #d9d3c6;
  --text: #1c1a16;
  --muted: #6b655a;
  --accent: #0f6e56;
  --accent-soft: #d8f0e7;
  --accent-2: #b45309;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #067647;
  --shadow: 0 10px 30px rgba(28, 26, 22, 0.08);
  --sidebar-w: 260px;
  --radius: 14px;
  --radius-sm: 10px;
}

html[data-theme="dark"] {
  --bg: #12141a;
  --bg-elev: #1a1e27;
  --bg-soft: #242a36;
  --line: #303846;
  --text: #eef2f7;
  --muted: #9aa3b2;
  --accent: #3ecf9a;
  --accent-soft: #16352c;
  --accent-2: #f0a05a;
  --danger: #f97066;
  --warn: #fdb022;
  --ok: #32d583;
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(900px 500px at 10% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    radial-gradient(700px 400px at 100% 0%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 55%),
    var(--bg);
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns .2s ease;
}
.app-shell.sidebar-collapsed {
  grid-template-columns: 76px 1fr;
}
.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .nav-item > span:last-child {
  display: none;
}
.app-shell.sidebar-collapsed .nav-item {
  justify-content: center;
  padding-left: 10px;
  padding-right: 10px;
}
.app-shell.sidebar-collapsed .sidebar {
  padding-left: 10px;
  padding-right: 10px;
}
.app-shell.sidebar-collapsed .sidebar-top {
  justify-content: center;
}

.sidebar-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 18px;
}
.sidebar-toggle {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--muted);
  border-radius: 12px;
  padding: 0;
}
.sidebar-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.sidebar-toggle-ico {
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 700;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 14px;
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand-mark {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  flex-shrink: 0;
  aspect-ratio: 1;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 40%, #0b3d31));
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; gap: 2px; }
.brand-text strong { font-family: var(--font-display); font-size: 1.05rem; }
.brand-text span { color: var(--muted); font-size: 0.78rem; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--bg-soft); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-ico { width: 1.4rem; text-align: center; opacity: .9; }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.nav-danger:hover { color: var(--danger); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.top-search { flex: 1; min-width: 0; position: relative; }
.top-search input {
  width: 100%;
  max-width: 520px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 999px;
  padding: 10px 16px;
  outline: none;
}
.top-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }

.search-pop {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: min(420px, 58vh);
  overflow: auto;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px 0;
  z-index: 45;
}
.search-pop[hidden] { display: none; }
.search-pop-empty {
  padding: 14px 16px;
  color: var(--muted);
  font-size: 0.88rem;
}
.search-pop-group + .search-pop-group {
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 4px;
}
.search-pop-label {
  padding: 6px 14px 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.search-pop-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 14px;
  display: grid;
  gap: 2px;
  cursor: pointer;
}
.search-pop-item:hover,
.search-pop-item:focus-visible {
  background: var(--bg-soft);
  outline: none;
}
.search-pop-item strong { font-size: 0.9rem; }
.search-pop-item span { color: var(--muted); font-size: 0.8rem; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  display: grid;
  place-items: center;
  position: relative;
}
.icon-btn:hover { border-color: var(--accent); }
.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 0 4px;
}
.badge[hidden] { display: none; }
.bell-wrap { position: relative; }
.popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(360px, 86vw);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px;
  z-index: 40;
}
.popover[hidden] { display: none; }
.popover-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  border-radius: 10px;
  display: grid;
  gap: 2px;
}
.popover-item:hover { background: var(--bg-soft); }
.popover-item strong { font-size: 0.9rem; }
.popover-item span { color: var(--muted); font-size: 0.8rem; }
.popover-item.unread strong::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
}

.account-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
}
.account-badge {
  cursor: default;
  user-select: none;
}

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}
.settings-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.settings-user .avatar {
  width: 28px;
  height: 28px;
  font-size: 0.68rem;
  flex-shrink: 0;
}
.settings-theme .toolbar {
  margin-bottom: 8px;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
}
.account-meta { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.account-meta strong { font-size: 0.82rem; }
.account-meta em { font-style: normal; color: var(--muted); font-size: 0.72rem; }

.content { padding: 8px 22px 36px; }
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin: 8px 0 18px;
  flex-wrap: wrap;
}
.page-head-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}
.page-back {
  padding-top: 4px;
  flex-shrink: 0;
}
.page-back .btn-ghost {
  padding: 8px 12px;
}
.page-titles { min-width: 0; }
.page-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2vw, 1.9rem);
  letter-spacing: -0.02em;
}
.page-head p { margin: 6px 0 0; color: var(--muted); }

.btn, .btn-primary, .btn-ghost {
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  padding: 9px 14px;
  font-weight: 600;
}
.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}
html[data-theme="dark"] .btn-primary { color: #062117; }
.btn-ghost { background: transparent; }
.btn:hover, .btn-ghost:hover { border-color: var(--accent); }

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

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card.clickable { cursor: pointer; transition: transform .12s, border-color .12s; }
.card.clickable:hover { transform: translateY(-1px); border-color: var(--accent); }
.kpi-label { color: var(--muted); font-size: 0.82rem; }
.kpi-value {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.kpi-sub { margin-top: 6px; color: var(--muted); font-size: 0.8rem; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-elev); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .04em; background: color-mix(in srgb, var(--bg-soft) 55%, transparent); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tr.row-click { cursor: pointer; }
tr.row-click:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-soft);
  color: var(--muted);
}
.pill.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.danger { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input, .toolbar select {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 10px;
  padding: 8px 12px;
}

.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; align-items: center; }
.bar-track { height: 10px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 40%, var(--accent-2))); }

/* —— Dashboard infographics —— */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.card-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
}
.kpi-card .kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
}
.kpi-meter {
  margin-top: 10px;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-soft);
  overflow: hidden;
}
.kpi-meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--warn), var(--danger));
}
.kpi-meter--ok > span {
  background: linear-gradient(90deg, var(--ok), color-mix(in srgb, var(--ok) 40%, var(--accent)));
}
.kpi-slash {
  font-size: 0.55em;
  font-weight: 600;
  color: var(--muted);
  margin-left: 2px;
}

.dash-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dash-note {
  margin: 12px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.attn-list {
  display: grid;
  gap: 2px;
  max-height: 420px;
  overflow: auto;
}
.attn-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 10px 8px 10px 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  border-left: 3px solid transparent;
  cursor: pointer;
}
.attn-item:hover { background: var(--bg-soft); }
.attn-item.sev-high { border-left-color: var(--danger); }
.attn-item.sev-med { border-left-color: var(--warn); }
.attn-item.sev-low { border-left-color: color-mix(in srgb, var(--muted) 50%, transparent); }
.attn-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.attn-body strong {
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attn-body em {
  font-style: normal;
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attn-arrow { color: var(--muted); font-size: 0.9rem; }

.debtor-list { display: grid; gap: 4px; }
.debtor-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  border: 0;
  background: transparent;
  padding: 8px 6px;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
}
.debtor-row:hover { background: var(--bg-soft); }
.debtor-name {
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.debtor-days {
  font-size: 0.76rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.debtor-days.bad { color: var(--danger); font-weight: 700; }
.debtor-sum {
  font-size: 0.84rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.vacancy-row {
  width: 100%;
  display: grid;
  gap: 2px;
  text-align: left;
  border: 0;
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
}
.vacancy-row:last-of-type { margin-bottom: 0; }
.vacancy-row:hover { outline: 1px solid var(--accent); }
.vacancy-row strong { font-size: 0.9rem; }
.vacancy-row span { color: var(--muted); font-size: 0.78rem; }

.prop-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.prop-chip {
  display: grid;
  gap: 8px;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
}
.prop-chip:hover {
  border-color: var(--accent);
  background: var(--bg-elev);
}
.prop-chip strong {
  font-family: var(--font-display);
  font-size: 0.95rem;
}
.prop-chip-meta {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: -4px;
}
.prop-chip-kpis {
  display: grid;
  gap: 6px;
}
.prop-chip-kpis div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
}
.prop-chip-kpis small { color: var(--muted); }
.prop-chip-kpis b { font-variant-numeric: tabular-nums; }
.prop-chip-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.delta {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.delta.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.delta.bad { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }

.dash-main {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 14px;
}
.chart-card { overflow: hidden; }
.col-chart { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.bar-plan { fill: color-mix(in srgb, var(--muted) 45%, var(--bg-soft)); }
.bar-fact { fill: var(--accent); }
.chart-label { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.chart-legend {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}
.chart-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -1px;
}
.lg-plan { background: color-mix(in srgb, var(--muted) 45%, var(--bg-soft)); }
.lg-fact { background: var(--accent); }

.mini-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.mini-stats > div {
  display: grid;
  gap: 2px;
  text-align: center;
}
.mini-stats small { color: var(--muted); font-size: 0.72rem; }
.mini-stats b { font-family: var(--font-display); font-size: 0.95rem; }
.mini-stats em { font-style: normal; color: var(--muted); font-size: 0.7rem; }
.ok-t { color: var(--ok); }
.warn-t { color: var(--warn); }

.donut-wrap { position: relative; width: 148px; height: 148px; flex-shrink: 0; }
.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
}
.donut-center strong {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.15;
}
.donut-center span { color: var(--muted); font-size: 0.72rem; }
.donut-layout {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  flex: 1;
  min-width: 140px;
}
.legend-list li {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 0.82rem;
}
.legend-list i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.legend-list span { color: var(--muted); }
.legend-list b { font-weight: 600; font-variant-numeric: tabular-nums; }

.hbars { display: grid; gap: 10px; }
.hbar-row {
  display: grid;
  grid-template-columns: minmax(72px, 28%) 1fr auto;
  gap: 10px;
  align-items: center;
}
.hbar-label {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hbar-track {
  height: 12px;
  border-radius: 999px;
  background: var(--bg-soft);
  overflow: hidden;
}
.hbar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 50%, #5b8def));
  min-width: 4px;
}
.hbar-fill.tone-warn { background: linear-gradient(90deg, var(--warn), color-mix(in srgb, var(--warn) 50%, var(--danger))); }
.hbar-fill.tone-danger { background: linear-gradient(90deg, var(--danger), #f04438); }
.hbar-val {
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ticket-prio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.prio-chip {
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 4px;
  justify-items: start;
}
.prio-chip b { font-family: var(--font-display); font-size: 1.2rem; }
.prio-chip small { color: var(--muted); font-size: 0.72rem; }

.split { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; }
.list-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.list-item:hover { color: var(--accent); }

.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.detail-grid div { background: var(--bg-soft); border-radius: 12px; padding: 12px; }
.detail-grid small { color: var(--muted); display: block; margin-bottom: 4px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: 999px;
  z-index: 80;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.toast[hidden] { display: none; }
html[data-theme="dark"] .toast { background: #eef2f7; color: #12141a; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 16, .45);
  display: grid;
  place-items: center;
  z-index: 70;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  width: min(520px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.modal header, .modal footer { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; }
.modal header { border-bottom: 1px solid var(--line); }
.modal footer { border-top: 1px solid var(--line); justify-content: flex-end; }
.modal-body { padding: 16px; color: var(--muted); line-height: 1.5; }
.modal h3 { margin: 0; font-family: var(--font-display); }

.ai-page {
  width: min(960px, 100%);
  margin: 0 auto;
}
.ai-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}
.ai-page .page-head {
  justify-content: center;
  text-align: center;
}
.ai-page .page-head-main {
  justify-content: center;
}
.ai-page .page-titles {
  text-align: center;
}
.ai-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: color-mix(in srgb, var(--accent-soft) 28%, var(--bg-elev));
}
.ai-chat-card { display: flex; flex-direction: column; min-height: min(70vh, 640px); }
.ai-messages {
  flex: 1;
  display: grid;
  gap: 10px;
  align-content: start;
  overflow: auto;
  max-height: min(52vh, 480px);
  padding: 4px 2px 12px;
  scroll-behavior: smooth;
}
.bubble {
  max-width: 88%;
  padding: 11px 14px;
  border-radius: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  line-height: 1.45;
  font-size: 0.92rem;
}
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 6px 0 8px; padding-left: 1.2rem; }
.bubble.me {
  justify-self: end;
  background: var(--accent-soft);
  border-color: transparent;
  white-space: pre-wrap;
}
.bubble.thinking {
  border-style: dashed;
  color: var(--muted);
  background: color-mix(in srgb, var(--bg-soft) 70%, var(--bg-elev));
}
.think-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 0.85rem;
}
.think-dots {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 1s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: .35; transform: scale(.85); }
  50% { opacity: 1; transform: scale(1.15); }
}
.think-steps {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
}
.think-steps li { margin: 3px 0; }
.ai-hint { color: var(--muted); font-size: 0.85rem; }
.ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 12px;
}
.chip {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.8rem;
  color: var(--muted);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.ai-composer {
  display: flex;
  gap: 8px;
  align-items: center;
}
.ai-composer input {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 12px;
  padding: 11px 14px;
  outline: none;
}
.ai-composer input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.ai-composer input:disabled, .ai-composer button:disabled { opacity: .55; cursor: wait; }
.ai-footnote {
  margin: 10px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}
.ai-side h3 { margin: 0; font-family: var(--font-display); font-size: 1rem; }

/* —— Properties list (table) + detail —— */
.prop-group { margin-bottom: 22px; }
.prop-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.prop-group-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
}

.prop-table-wrap { box-shadow: var(--shadow); overflow-x: auto; }
.prop-table { table-layout: fixed; width: 100%; min-width: 760px; }
.prop-table th,
.prop-table td {
  vertical-align: middle;
  padding: 12px 14px;
}
.prop-table .col-addr {
  width: 22%;
  white-space: normal;
}
.prop-table .col-mgr {
  width: 16%;
  white-space: nowrap;
  color: var(--text);
  font-weight: 600;
}
.prop-table .col-addr strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}
.prop-table .col-addr span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
}
.prop-table .col-num {
  width: 11%;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.prop-table .col-pay {
  width: 13%;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.prop-table .col-tickets {
  width: 9%;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.prop-table th.col-num,
.prop-table th.col-pay,
.prop-table th.col-tickets { text-align: right; }
.prop-table tbody tr.row-click { cursor: pointer; }
.prop-table tbody tr.row-click:hover td {
  background: color-mix(in srgb, var(--accent-soft) 35%, transparent);
}
.pay-ok { color: var(--ok); font-weight: 600; }
.pay-debt { color: var(--danger); font-weight: 600; }
.ind-ok { color: var(--ok); }
.ind-debt { color: var(--danger); }
.ind-warn { color: var(--warn); }
.muted-cell { color: var(--muted); }
.tenant-places {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
  max-width: 28rem;
}

.prop-block {
  margin-bottom: 22px;
}
.prop-block > h3 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}
.block-sub {
  margin: 16px 0 8px;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
}
.block-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}
.info-table th {
  width: 18%;
  color: var(--muted);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.82rem;
  background: transparent;
}
.info-table td {
  width: 32%;
  font-weight: 600;
}
.info-table-stack th { width: 42%; }
.info-table-stack td { width: 58%; }
.info-table tr:last-child th,
.info-table tr:last-child td { border-bottom: 0; }

.passport-split {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 12px;
  align-items: stretch;
}
.passport-extra {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  padding: 14px 16px;
}
.passport-extra h4 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
}
.passport-extra dl {
  margin: 0;
  display: grid;
  gap: 10px;
}
.passport-extra dl > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  align-items: baseline;
}
.passport-extra dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}
.passport-extra dd {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}
.passport-notes {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.passport-notes > span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 6px;
}
.passport-notes ul {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 4px;
  font-size: 0.88rem;
}
@media (max-width: 1100px) {
  .passport-split { grid-template-columns: 1fr; }
}

.prop-hero {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.prop-hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.prop-hero-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.prop-hero-kpis small { display: block; color: var(--muted); font-size: 0.72rem; margin-bottom: 4px; }
.prop-hero-kpis b { font-family: var(--font-display); font-size: 1.05rem; font-weight: 800; }
.prop-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.prop-jump button {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  color: var(--muted);
}
.prop-jump button:hover { border-color: var(--accent); color: var(--accent); }
.prop-sec { margin-bottom: 14px; scroll-margin-top: 80px; }
.prop-sec-row { margin-bottom: 14px; }
.room-grid, .meter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.room-card, .meter-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg-soft);
  border-top: 3px solid var(--ok);
}
.room-card.is-vacant { border-top-color: var(--warn); }
.meter-card.is-check { border-top-color: var(--warn); }
.room-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.room-tenant { margin-top: 8px; font-size: 0.85rem; font-weight: 600; }
.meter-vals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 10px;
}
.meter-vals small { display: block; color: var(--muted); font-size: 0.7rem; }
.meter-vals b { font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.meter-hist { margin-top: 12px; }
.hist-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 64px;
  margin-top: 6px;
}
.hist-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  height: 100%;
}
.hist-col span {
  width: 100%;
  max-width: 28px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 40%, var(--bg-soft)));
  display: block;
}
.hist-col em { font-style: normal; font-size: 0.65rem; color: var(--muted); }
.file-list { display: grid; gap: 8px; }
.file-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 10px 12px;
}
.file-row:hover { border-color: var(--accent); }
.file-ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: var(--accent-soft);
  color: var(--accent);
}
.file-meta { display: grid; gap: 2px; min-width: 0; }
.file-meta strong {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-meta em { font-style: normal; color: var(--muted); font-size: 0.75rem; }
.event-list { margin-top: 12px; display: grid; gap: 6px; }
.event-item {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-soft);
  font-size: 0.85rem;
}
.mini-panel { min-width: 0; }

@media (max-width: 1100px) {
  .prop-hero-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ai-layout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .prop-hero-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.mobile-only { display: none; }

/* —— Files storage —— */
.modal--wide { width: min(920px, 100%); }
.modal-body .file-preview-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 14px;
  margin-bottom: 14px;
}
.modal-body .file-preview-meta small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  margin-bottom: 2px;
}
.modal-body .file-preview-meta b { color: var(--text); font-weight: 600; }
.file-preview-stage {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-soft);
  min-height: 280px;
  overflow: hidden;
}
.file-preview-stage img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #0b0d12;
}
.file-preview-frame iframe {
  width: 100%;
  height: 420px;
  border: 0;
  background: #fff;
}
.file-preview-mock { padding: 18px; }
.file-preview-photo .mock-photo,
.file-preview-pdf .mock-pdf,
.file-preview-cad .mock-cad {
  border-radius: 12px;
  padding: 22px;
  min-height: 220px;
  display: grid;
  align-content: center;
  gap: 8px;
}
.mock-photo {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 25%, transparent), transparent),
    repeating-linear-gradient(45deg, var(--line) 0 2px, transparent 2px 14px);
}
.mock-photo span { font-family: var(--font-display); font-size: 1.15rem; color: var(--text); font-weight: 700; }
.mock-photo em { color: var(--muted); font-style: normal; }
.mock-pdf { background: #f7f8fb; color: #1a1d24; }
html[data-theme="dark"] .mock-pdf { background: #1a1e27; color: var(--text); }
.mock-pdf header { font-weight: 700; font-family: var(--font-display); }
.mock-pdf .muted, .file-preview-mock .muted { color: var(--muted); }
.mock-pdf-lines { display: grid; gap: 8px; margin-top: 12px; }
.mock-pdf-lines i {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--muted) 28%, transparent);
}
.mock-pdf-lines i:nth-child(1) { width: 92%; }
.mock-pdf-lines i:nth-child(2) { width: 78%; }
.mock-pdf-lines i:nth-child(3) { width: 86%; }
.mock-pdf-lines i:nth-child(4) { width: 64%; }
.mock-pdf-lines i:nth-child(5) { width: 70%; }
.mock-cad {
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--bg-soft));
  border: 1px dashed var(--accent);
}
.mock-sheet { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.mock-sheet th, .mock-sheet td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.mock-sheet th { background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }

.file-upload-form { display: grid; gap: 12px; }
.file-upload-form label { display: grid; gap: 6px; color: var(--text); font-weight: 600; font-size: 0.88rem; }
.file-upload-form select,
.file-upload-form input[type="file"] {
  font: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
}

.files-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.mini-kpi .kpi-value { font-size: 1.25rem; }
.files-toolbar { align-items: stretch; }
.files-toolbar input,
.files-toolbar select { min-width: 0; flex: 1 1 140px; }
.files-toolbar input { flex: 2 1 220px; }
.th-sort {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: inherit;
  padding: 0;
  cursor: pointer;
}
.th-sort.active { color: var(--accent); }
.ext-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.2rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
}
.ext-badge.ext-pdf { color: #c44536; border-color: color-mix(in srgb, #c44536 35%, var(--line)); }
.ext-badge.ext-img { color: #2f6fed; border-color: color-mix(in srgb, #2f6fed 35%, var(--line)); }
.ext-badge.ext-cad { color: #0f8a5f; border-color: color-mix(in srgb, #0f8a5f 35%, var(--line)); }
.ext-badge.ext-sheet { color: #1f7a3f; border-color: color-mix(in srgb, #1f7a3f 35%, var(--line)); }
.ext-badge.ext-doc { color: var(--muted); }
.linkish {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  text-align: left;
  cursor: pointer;
}
.linkish:hover strong,
.linkish:hover { color: var(--accent); }
.file-name-btn { max-width: 100%; }
.files-actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.btn-tiny {
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: 8px;
}
.btn-danger {
  background: color-mix(in srgb, var(--danger) 18%, var(--bg-elev));
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--line));
}
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 28%, var(--bg-elev)); }

/* —— Payments ledger (bank-style) —— */
.amount-in { color: var(--ok); font-weight: 700; font-variant-numeric: tabular-nums; }
.amount-out { color: var(--danger); font-weight: 700; font-variant-numeric: tabular-nums; }
.pay-kpis .kpi-value { font-size: 1.15rem; }
.pay-ledger { display: grid; gap: 18px; }
.pay-day-title {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: capitalize;
}
.pay-day-list {
  display: grid;
  gap: 8px;
}
.pay-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elev);
}
.pay-row.is-draft { opacity: 0.78; border-style: dashed; }
.pay-row-main { min-width: 0; display: grid; gap: 3px; }
.pay-party {
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text);
}
.pay-purpose {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}
.pay-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--muted);
}
.pay-amount {
  font-size: 1.05rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pri-high { color: var(--danger); font-weight: 700; }
.pri-mid { color: var(--warn); font-weight: 600; }
.pri-low { color: var(--muted); font-weight: 600; }

@media (max-width: 1100px) {
  .files-kpis { grid-template-columns: 1fr; }
  .modal-body .file-preview-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .grid-3, .detail-grid, .dash-main { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .prop-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .prop-strip { grid-template-columns: 1fr; }
  .app-shell,
  .app-shell.sidebar-collapsed { grid-template-columns: 1fr; }
  .app-shell.sidebar-collapsed .brand-text,
  .app-shell.sidebar-collapsed .nav-item > span:last-child { display: initial; }
  .app-shell.sidebar-collapsed .brand-text { display: flex; flex-direction: column; }
  .app-shell.sidebar-collapsed .nav-item { justify-content: flex-start; }
  .app-shell.sidebar-collapsed .sidebar-top { justify-content: flex-start; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 300px);
    z-index: 50;
    transform: translateX(-105%);
    transition: transform .2s;
    padding-left: 14px;
    padding-right: 14px;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: grid; }
  .account-meta { display: none; }
  .content { padding: 8px 14px 28px; }
  .page-head-main { flex-direction: column; gap: 8px; }
}
