:root,
html[data-theme="light"] {
  --bg: #eef3f7;
  --bg-top: #f4ebe0;
  --ink: #142033;
  --muted: #5d6b7c;
  --brand: #1f4d6e;
  --brand-deep: #163a54;
  --brand-soft: #d7e6ef;
  --accent: #c87941;
  --card: #ffffff;
  --danger: #b42318;
  --ok: #1f7a4d;
  --line: #e4ebf1;
  --radius: 18px;
  --shadow: 0 12px 28px rgba(20, 32, 51, 0.08);
  --font: "Onest", "Segoe UI", sans-serif;
  --sidebar-w: 248px;
  --nav-bg: rgba(255, 255, 255, 0.94);
  --drawer-bg: #fff;
  --sidebar-bg: linear-gradient(180deg, #14384f, #1f4d6e 55%, #245875);
  --hero-panel-bg: linear-gradient(165deg, #f8e9c8 0%, #edf1f8 58%, #e7eef8 100%);
  --flash-error-bg: #f8d7d4;
  --flash-ok-bg: #d9f2e4;
  --input-bg: #fff;
  --input-border: #d5dde6;
  --wip-bg: #fff1dc;
  --wip-ink: #9a5b12;
  --tile-bg: #f5f8fb;
  --btn-primary-bg: #1f4d6e;
  --btn-primary-ink: #fff;
  --surface: var(--card);
  --border: var(--line);
}

html[data-theme="dark"] {
  --bg: #0f1720;
  --bg-top: #1a2836;
  --ink: #e8eef4;
  --muted: #9aabbc;
  --brand: #7eb7d0;
  --brand-deep: #b7d7e6;
  --brand-soft: #1c3344;
  --accent: #d49a63;
  --card: #182430;
  --danger: #ff8d84;
  --ok: #6dcca0;
  --line: #2a3a4a;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  --nav-bg: rgba(18, 28, 38, 0.94);
  --drawer-bg: #152231;
  --sidebar-bg: linear-gradient(180deg, #0c1822, #132836 55%, #173141);
  --hero-panel-bg: linear-gradient(165deg, #243140 0%, #1a2834 58%, #15222d 100%);
  --flash-error-bg: #3a2220;
  --flash-ok-bg: #1d332a;
  --input-bg: #121c26;
  --input-border: #314354;
  --wip-bg: #3a2e1c;
  --wip-ink: #f0c37a;
  --tile-bg: #1c2a38;
  --btn-primary-bg: #e8f3f8;
  --btn-primary-ink: #0c1b2a;
  --surface: var(--card);
  --border: var(--line);
}

* { box-sizing: border-box; }

/* The designed ring lives in marketing.css, which app.js never imports — so the logged-in
   app had only UA defaults. Keep them consistent across both themes.
   --focus-ring is a token because --brand (#1f4d6e) is also a stop in --sidebar-bg, so a
   brand-coloured outline is 1.00:1 against the sidebar — invisible exactly where the nav is. */
:where(a, button, select, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus-ring, var(--brand));
  outline-offset: 2px;
  border-radius: 6px;
}
/* The sidebar is a dark gradient in BOTH themes, so it needs a light ring. The drawer is not:
   --drawer-bg is #fff in light (keep the brand ring) and #152231 in dark. */
.app-sidebar { --focus-ring: #ffffff; }
html[data-theme="dark"] .app-drawer { --focus-ring: #7eb7d0; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, var(--bg-top), transparent 42%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg) 100%);
  min-height: 100vh;
  transition: background 180ms ease, color 180ms ease;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.brand { font-size: 1.45rem; font-weight: 800; letter-spacing: 0.05em; color: var(--brand); }
.brand-link { display: inline-flex; text-decoration: none; }
.brand-link:hover { text-decoration: none; }

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: transparent;
  position: relative;
}
.logo-mark .logo-img {
  display: block;
  width: auto;
  height: 2.35rem;
}
.logo-mark .logo-img--for-dark { display: none; }
html[data-theme="dark"] .logo-mark .logo-img--for-light { display: none; }
html[data-theme="dark"] .logo-mark .logo-img--for-dark { display: block; }

.logo-dom-label {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  color: inherit;
  white-space: nowrap;
}
.app-sidebar .logo-dom-label,
.auth-hero .logo-dom-label,
.app-drawer .logo-dom-label {
  color: #fff;
}

/* Sidebar sits on a dark gradient — keep the white mark readable. */
.app-sidebar .logo-img--for-light {
  display: none;
}
.app-sidebar .logo-img--for-dark {
  display: block;
}

.logo-mark--sm .logo-img { height: 2.15rem; }
.logo-mark--sm .logo-dom-label { font-size: 0.95rem; }
.logo-mark--md .logo-img { height: 2.55rem; }
.logo-mark--md .logo-dom-label { font-size: 1.1rem; }
.logo-mark--lg .logo-img { height: 3.25rem; }
.logo-mark--lg .logo-dom-label { font-size: 1.25rem; }

.theme-toggle {
  border: 0;
  background: var(--card);
  color: var(--brand);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-size: 1.05rem;
  cursor: pointer;
  line-height: 1;
}
.theme-toggle--sidebar {
  margin-top: 0;
  width: 100%;
  background: rgba(255,255,255,0.12);
  color: #fff;
  box-shadow: none;
}
.theme-toggle--drawer {
  margin-top: 0.5rem;
  width: 100%;
}

.theme-toggle--auth {
  position: fixed;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 20;
  border: 1px solid var(--line);
}

.auth-wrap { max-width: 420px; margin: 3rem auto; padding: 0 1rem; }
.auth-hero {
  background: linear-gradient(160deg, #1f4d6e, #3d6f8f 55%, #c87941);
  color: #fff; border-radius: 24px; padding: 1.5rem; margin-bottom: 1rem;
}
.auth-hero h1 { font-size: 2rem; margin: 0.65rem 0 0.35rem; }
.auth-hero p { margin: 0; color: rgba(255, 255, 255, 0.9); }
.auth-hero .brand {
  display: inline-flex;
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: normal;
  color: inherit;
}

/* Auth hero is always a dark plane — use the white logo for contrast. */
.auth-hero .logo-img--for-light { display: none; }
.auth-hero .logo-img--for-dark { display: block; }
.auth-hero .logo-mark--md .logo-img { height: 2.7rem; }

.app-frame {
  min-height: 100vh;
  display: grid;
  /* minmax(0, …), not 1fr: a 1fr track never shrinks below its content's min-content width, so one
     nowrap row (the finance tabs, the year grid) widened every page to 900+px on a phone and pushed
     the bottom nav off screen instead of scrolling inside its own box. */
  grid-template-columns: minmax(0, 1fr);
}

.app-sidebar { display: none; }

.app-main {
  width: min(920px, 100%);
  min-width: 0;
  margin: 0 auto;
  padding: 0.85rem 1rem 6.2rem;
}

.app-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}

.app-top-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.top-profile {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 11rem;
  padding: 0.2rem 0.35rem 0.2rem 0.2rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
}
.top-profile:hover,
.top-profile.is-active {
  border-color: var(--brand);
  background: var(--brand-soft);
  text-decoration: none;
  color: var(--ink);
}
.top-profile-avatar {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--brand);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1;
}
.top-profile-avatar--sm {
  width: 1.45rem;
  height: 1.45rem;
  font-size: 0.7rem;
}
.top-profile-copy {
  display: grid;
  min-width: 0;
  padding-right: 0.35rem;
  line-height: 1.15;
}
.top-profile-name {
  font-size: 0.82rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-profile-hint {
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 600;
}
.drawer-profile {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink);
  background: var(--brand-soft);
}
.drawer-profile:hover { text-decoration: none; color: var(--ink); }
.drawer-profile strong { display: block; }
.drawer-profile .muted { font-size: 0.8rem; }
.danger-text { color: var(--danger) !important; }
.profile-logout-card { display: flex; }

/* Role: label + optional dropdown (dual access) */
.role-line {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}
.role-prefix {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  opacity: 0.85;
  white-space: nowrap;
}
.role-select-form {
  margin: 0;
  display: inline-flex;
  align-items: center;
  min-width: 0;
}
.role-select,
.role-label {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.2;
}
.role-select {
  appearance: none;
  border: 0;
  color-scheme: inherit;
  background:
    transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%235d6b7c' d='M1 1l4 4 4-4'/%3E%3C/svg%3E")
    right 0 center / 10px no-repeat;
  padding: 0.1rem 1rem 0.1rem 0;
  max-width: 11rem;
  cursor: pointer;
}
html[data-theme="dark"] .role-select {
  background-color: var(--input-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%239aabbc' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 0.28rem 1.15rem 0.28rem 0.5rem;
}
.role-select:focus-visible {
  outline: none;
  color: var(--ink);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.role-label {
  display: inline;
}
.drawer-user {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  padding: 0 1rem 0.75rem;
  margin: 0;
}

/* Context bar — building / unit switcher */
.context-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.55rem;
  margin: 0 0 1rem;
  padding: 0.65rem 0.75rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(12, 22, 34, 0.04);
}
.context-bar-block {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1 1 12rem;
  min-width: 0;
}
.context-bar-label {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.context-bar-form {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}
.context-bar-select {
  width: 100%;
  appearance: none;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  color-scheme: inherit;
  background:
    var(--input-bg)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%235d6b7c' d='M1 1l4 4 4-4'/%3E%3C/svg%3E")
    right 0.7rem center / 10px no-repeat;
  color: var(--ink);
  padding: 0.55rem 1.8rem 0.55rem 0.75rem;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  cursor: pointer;
}
html[data-theme="dark"] .context-bar-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%239aabbc' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
}
.context-bar-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.context-bar-action {
  flex: 0 0 auto;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--brand);
  text-decoration: none;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  white-space: nowrap;
}
.context-bar-action:hover {
  background: var(--brand-soft);
  text-decoration: none;
}
.context-bar-static,
.context-bar-empty {
  flex: 1 1 auto;
  font-size: 0.92rem;
  font-weight: 650;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.context-bar-empty {
  color: var(--muted);
  font-weight: 500;
}

.nav-group-label {
  margin: 0.7rem 0 0.2rem;
  padding: 0 0.65rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}
.nav-group-label:first-child {
  margin-top: 0.1rem;
}

.inline-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.inline-add-form input,
.inline-add-form select {
  flex: 1 1 8rem;
  width: auto;
  margin: 0;
}
.inline-add-form .btn {
  flex: 0 0 auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.plain-list {
  margin: 0;
  padding-left: 1.1rem;
}
.plain-list li {
  margin: 0.35rem 0;
}

.menu-btn, .icon-btn {
  border: 0;
  background: var(--card);
  color: var(--brand);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-size: 1.15rem;
  cursor: pointer;
}

.app-content > .hero-panel,
.app-content > .card { animation: rise 380ms ease both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.hero-panel {
  background: var(--hero-panel-bg);
  border-radius: 24px;
  padding: 1.15rem 1.2rem 1.3rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.hero-panel .eyebrow {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 0.2rem;
}

.hero-panel h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.2rem);
  letter-spacing: -0.02em;
}

.hero-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.hero-stats .stat { font-size: 1.25rem; font-weight: 750; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 1rem; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.05rem 1.15rem;
  margin-bottom: 0.9rem;
}

.first-month-checklist__list {
  padding-left: 1.2rem;
  line-height: 1.6;
  max-width: 100%;
}
.first-month-checklist__row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.55rem 0.75rem;
  max-width: 100%;
}
.first-month-checklist__copy {
  min-width: 0;
  flex: 1 1 12rem;
  overflow-wrap: anywhere;
}
.first-month-checklist__action {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 0.4rem;
  flex: 0 1 auto;
  margin-left: auto;
  max-width: 100%;
}
.first-month-checklist__action form {
  margin: 0;
}

.entrance-issues-off {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem 0.75rem;
}
.entrance-issues-off p { flex: 1 1 14rem; }

.pay-settings-more { margin-bottom: 0.9rem; }
.pay-settings-more > summary {
  cursor: pointer;
  padding: 0.6rem 0.2rem;
  font-weight: 650;
  color: var(--muted);
}
.pay-settings-more[open] > summary { color: var(--ink); }

.grid { display: grid; gap: 0.85rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hub-pair {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 0.9rem;
  align-items: stretch;
}
.hub-pair > .card {
  margin-bottom: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.hub-pair .section-head { align-items: center; }
.hub-pair .section-head h2 {
  min-width: 0;
  font-size: 1.05rem;
  line-height: 1.3;
}
.hub-pair .list-item { padding: 0.55rem 0; }
@media (min-width: 720px) {
  .hub-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hide-sm { display: none !important; }
}

h1, h2, h3 { margin: 0 0 0.45rem; }
.stat { font-size: 1.35rem; font-weight: 750; }
.resident-home h1 { font-size: 1.7rem; }
.resident-home-pay { margin-top: 0.75rem; }

.badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.22rem 0.6rem; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 0.78rem; font-weight: 700;
}
.badge.danger { background: #f8d7d4; color: var(--danger); }
.badge.ok { background: #d9f2e4; color: var(--ok); }
.badge.wip { background: var(--wip-bg); color: var(--wip-ink); }
html[data-theme="dark"] .badge.danger { background: #3a2220; }
html[data-theme="dark"] .badge.ok { background: #1d332a; }

.page-crumb {
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.85rem;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 0.88rem;
  font-weight: 650;
}

.role-cards {
  border: 0;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.role-cards legend {
  margin-bottom: 0.45rem;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 650;
}
.role-card {
  display: grid;
  gap: 0.15rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  background: var(--tile-bg);
}
.role-card:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.role-card input { position: absolute; opacity: 0; pointer-events: none; }
.role-card-title { font-weight: 750; color: var(--ink); }
.role-card-hint { font-size: 0.84rem; color: var(--muted); }

.nav-soon {
  margin-top: 0.35rem;
}
.nav-soon > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 650;
  font-size: 0.88rem;
}
.nav-soon > summary::-webkit-details-marker { display: none; }
.nav-soon[open] > summary { color: var(--ink); }
.app-sidebar-nav .nav-soon a,
.app-drawer-nav .nav-soon a {
  opacity: 0.88;
}

.resident-names {
  margin-top: 0.25rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
}

.iban {
  font-size: 0.95rem;
  word-break: break-all;
}

.pay-soon summary {
  cursor: pointer;
  font-weight: 700;
}
.pay-soon[open] summary { margin-bottom: 0.75rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}


.btn, button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  border: 0; border-radius: 999px; padding: 0.72rem 1.15rem;
  background: var(--btn-primary-bg); color: var(--btn-primary-ink); font-weight: 700; cursor: pointer; font: inherit;
}
.btn.secondary, button.secondary {
  background: transparent; color: var(--brand); border: 1px solid var(--brand);
}
.btn.ghost {
  background: var(--brand-soft); color: var(--brand-deep); border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
}
html[data-theme="dark"] .btn.ghost {
  background: rgba(255,255,255,0.08); color: var(--ink); border-color: var(--line);
}
.btn.block, button.block { width: 100%; }
.btn:hover, button:hover { opacity: 0.93; text-decoration: none; }

label { display: block; font-size: 0.9rem; margin: 0.7rem 0 0.3rem; color: var(--muted); }
.checkbox-row {
  display: flex; align-items: flex-start; gap: 0.65rem;
  margin: 0.9rem 0; color: var(--ink); font-weight: 600; cursor: pointer;
}
.checkbox-row input { width: 1.15rem; height: 1.15rem; margin: 0.15rem 0 0; flex-shrink: 0; accent-color: var(--brand); }
.checkbox-row span { font-weight: 500; color: var(--ink); line-height: 1.35; }
.radio-stack { display: grid; gap: 0.55rem; margin: 0.35rem 0 0.75rem; }
.radio-stack .checkbox-row { margin: 0; }
.checkbox-stack {
  display: grid;
  gap: 0.75rem;
  margin: 0.15rem 0 0.9rem;
}
.checkbox-stack .checkbox-row { margin: 0; }
/* Nested stack-form last-child kills floating-label bottom margin — keep gap before following checkboxes. */
.commercial-fee-factor-wrap {
  margin-bottom: 0.55rem;
}
.policy-subsection {
  margin: 0 0 1.35rem;
}
.policy-subsection > .form-section__title {
  margin: 0 0 0.45rem;
  font-size: 1rem;
}
.policy-subsection > .form-section__title:first-child {
  margin-top: 0;
}
.policy-subsection > .checkbox-stack {
  margin: 0.35rem 0 0;
}
.policy-subsection > .radio-stack {
  margin-bottom: 0.85rem;
}
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.45rem;
  align-items: center;
}
input, select, textarea {
  width: 100%; border: 1px solid var(--input-border); border-radius: 12px;
  padding: 0.75rem 0.85rem; font: inherit; background: var(--input-bg); color: var(--ink);
  color-scheme: inherit;
}
input[type="checkbox"],
input[type="radio"] {
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  border-radius: 4px;
  flex-shrink: 0;
}
textarea { min-height: 110px; resize: vertical; }

/*
 * Native <select> popups are OS-chrome. On Windows/Chrome the open list often
 * stays light even when the page is dark — if options inherit --ink (#e8eef4)
 * you get white-on-white (Режим: Живущ / Домоуправител). Force dark text on a
 * light option panel so every theme stays readable.
 */
select option,
select optgroup {
  background-color: #ffffff !important;
  color: #142033 !important;
}
html[data-theme="light"] select {
  color-scheme: light;
}
html[data-theme="dark"] select {
  /* Closed control stays dark; option colors above override popup text. */
  color-scheme: dark;
}

.flash { padding: 0.8rem 1rem; border-radius: 12px; margin-bottom: 0.85rem; }
.flash.error { background: var(--flash-error-bg); color: var(--danger); }
.flash.success, .flash.info { background: var(--flash-ok-bg); color: var(--ok); }
.flash.warning { background: var(--wip-bg); color: var(--wip-ink); }

/* ЗУЕС deadlines card (assembly show / protocol). */
.deadline-warn {
  margin: 0 0 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  background: var(--wip-bg);
  color: var(--wip-ink);
  font-size: 0.9rem;
  line-height: 1.45;
}
.deadline-list { list-style: none; margin: 0; padding: 0; }
.deadline-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.deadline-list li:last-child { border-bottom: 0; }
.deadline-list li span { color: var(--muted); }
.deadline-list__warn strong { color: var(--danger); }

.list-item {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 0.25rem;
}
.list-item:last-child { border-bottom: 0; }
.list-item-head {
  display: flex; justify-content: space-between; gap: 0.75rem; align-items: center;
}

.pill-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.55rem 0 0.85rem; }
.pill {
  border-radius: 999px; padding: 0.35rem 0.75rem; background: var(--brand-soft); color: var(--muted);
  font-size: 0.84rem; font-weight: 650;
}
.pill.active { background: var(--brand); color: #fff; }
html[data-theme="dark"] .pill.active { color: #0c1b2a; }

.metric-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}
.metric-card .label { color: var(--muted); font-size: 0.84rem; margin-bottom: 0.25rem; }

.pay-method, .market-tile {
  display: flex; justify-content: space-between; align-items: center; gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}
.pay-method:last-child, .market-tile:last-child { border-bottom: 0; }
.pay-method-card .pay-method {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.65rem;
  padding-top: 0;
}
.pay-details {
  display: grid;
  gap: 0.45rem;
  margin: 0;
}
.pay-details > div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.5rem;
  align-items: start;
}
.pay-details dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}
.pay-details dd { margin: 0; font-weight: 600; }
.pay-hours { white-space: pre-line; font-weight: 600; }
.cash-hours {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 0.55rem;
}
.cash-hours legend {
  font-weight: 650;
  margin-bottom: 0.2rem;
}
.cash-hours-day {
  display: grid;
  grid-template-columns: 7.5rem minmax(11rem, 1fr) auto;
  gap: 0.55rem 0.75rem;
  align-items: center;
}
.cash-hours-day__name { font-weight: 650; }
.cash-hours-day__state,
.cash-hours-times {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  align-items: center;
}
.cash-hours-day:not(:has(input[value="1"]:checked)) .cash-hours-times {
  opacity: 0.45;
  pointer-events: none;
}
.cash-hours-times select { min-width: 5.5rem; }
@media (max-width: 720px) {
  .cash-hours-day {
    grid-template-columns: 1fr;
    align-items: start;
  }
}
.pay-settings { display: grid; gap: 0.75rem; }
.pay-settings-card { margin-bottom: 0; }
/* Collapse details when channel checkbox is off — CSS so it works even if Stimulus is stale. */
.pay-settings-card:not(:has(.pay-settings-toggle input:checked)) .pay-settings-fields {
  display: none !important;
}
.pay-settings-card:not(:has(.pay-settings-toggle input:checked)) {
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}
.pay-settings-card:not(:has(.pay-settings-toggle input:checked)) .pay-settings-toggle {
  margin-bottom: 0;
}
.pay-settings-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  cursor: pointer;
  margin-bottom: 0.75rem;
}
.pay-settings-toggle input {
  margin-top: 0.3rem;
  width: 1.1rem;
  height: 1.1rem;
}
.pay-settings-toggle span { display: grid; gap: 0.15rem; }
.pay-settings-fields { max-width: none; }
.pay-settings-fields .req { color: var(--danger, #b42318); font-weight: 700; }
/* Soft warning only while „Фирма-управител“ is selected — CSS :has(), no JS. */
.account-holder__warn { margin-top: 0.15rem; }
.account-holder:not(:has(select option[value="company"]:checked)) .account-holder__warn {
  display: none;
}
.commercial-fee-policy form:not(:has(input[name="commercial_fee_enabled"][value="1"]:checked)) .commercial-fee-factor-wrap {
  display: none !important;
}
.scheme-row-actions {
  flex-shrink: 0;
  align-self: flex-start;
}
.scheme-row-action {
  display: inline-flex;
  align-items: center;
}
.market-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}
.market-grid .tile {
  background: var(--tile-bg);
  border-radius: 14px;
  padding: 0.9rem;
  font-weight: 700;
  color: var(--brand-deep);
}

.wip-panel {
  text-align: center;
  padding: 2rem 1.2rem;
}
.wip-panel .wip-icon {
  width: 3.4rem; height: 3.4rem; border-radius: 16px;
  display: grid; place-items: center; margin: 0 auto 1rem;
  background: var(--brand-soft); color: var(--brand); font-size: 1.4rem; font-weight: 800;
}
.wip-panel p { color: var(--muted); max-width: 34rem; margin: 0.5rem auto 1.1rem; line-height: 1.55; }

.section-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem;
  margin-bottom: 0.55rem;
}
/* Two buttons beside the title do not fit a phone; drop them under it instead of overflowing. */
.building-handover .section-head { flex-wrap: wrap; }
.section-head a { font-size: 0.9rem; font-weight: 700; }
.section-head h2 a {
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  text-decoration: none;
}
.section-head h2 a:hover { color: var(--brand); }

.nav-bottom {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0.7rem; width: min(560px, calc(100% - 1.2rem));
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--nav-bg); backdrop-filter: blur(10px);
  border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; z-index: 30;
}
.nav-bottom a {
  text-align: center; padding: 0.55rem 0.2rem 0.6rem; color: var(--muted);
  font-size: 0.68rem; font-weight: 700; text-decoration: none;
  display: grid; gap: 0.15rem; justify-items: center;
}
.nav-bottom a.active { color: var(--brand); background: var(--brand-soft); }
.nav-ico {
  width: 1.2rem;
  height: 1.2rem;
  display: inline-block;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask: var(--nav-ico) no-repeat center / contain;
  mask: var(--nav-ico) no-repeat center / contain;
}
.nav-ico[data-icon="home"] {
  --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 10.5 12 3l9 7.5V21a1 1 0 0 1-1 1h-5v-7H9v7H4a1 1 0 0 1-1-1z'/%3E%3C/svg%3E");
}
.nav-ico[data-icon="cash"] {
  --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.5' y='6' width='19' height='12' rx='2'/%3E%3Ccircle cx='12' cy='12' r='2.5'/%3E%3Cpath d='M6 12h.01M18 12h.01'/%3E%3C/svg%3E");
}
.nav-ico[data-icon="people"] {
  --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='3.5'/%3E%3Cpath d='M22 21v-2a3.5 3.5 0 0 0-2.5-3.35'/%3E%3Cpath d='M16.5 3.6a3.5 3.5 0 0 1 0 6.8'/%3E%3C/svg%3E");
}
.nav-ico[data-icon="issue"] {
  --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3Cpath d='M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z'/%3E%3C/svg%3E");
}
.nav-ico[data-icon="unit"] {
  --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 21V8l8-5 8 5v13'/%3E%3Cpath d='M9 21v-8h6v8'/%3E%3C/svg%3E");
}
.nav-ico[data-icon="building"] {
  --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 21h16'/%3E%3Cpath d='M6 21V5a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v16'/%3E%3Cpath d='M9 8h.01M12 8h.01M15 8h.01M9 12h.01M12 12h.01M15 12h.01M9 16h.01M12 16h.01M15 16h.01'/%3E%3C/svg%3E");
}
.nav-ico[data-icon="search"] {
  --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
}
.nav-ico[data-icon="megaphone"] {
  --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 11 18-5v12L3 13v-2z'/%3E%3Cpath d='M11.6 16.8a3.5 3.5 0 0 1-6.3 1.7L5 16'/%3E%3C/svg%3E");
}
.nav-ico[data-icon="card"] {
  --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.5' y='5' width='19' height='14' rx='2'/%3E%3Cpath d='M2.5 10h19'/%3E%3Cpath d='M7 15h3'/%3E%3C/svg%3E");
}
.nav-ico[data-icon="chat"] {
  --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a3 3 0 0 1-3 3H8l-5 3V6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3z'/%3E%3C/svg%3E");
}
.nav-ico[data-icon="poll"] {
  --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 11l2 2 4-4'/%3E%3Cpath d='M4 6h16v14a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1z'/%3E%3Cpath d='M8 3h8'/%3E%3C/svg%3E");
}
.nav-ico[data-icon="assembly"] {
  --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='8' r='2.5'/%3E%3Ccircle cx='16' cy='8' r='2.5'/%3E%3Ccircle cx='12' cy='15' r='2.5'/%3E%3Cpath d='M3.5 19.5a4.5 4.5 0 0 1 4.5-3.2M20.5 19.5a4.5 4.5 0 0 0-4.5-3.2M8.5 19.5a4 4 0 0 1 7 0'/%3E%3C/svg%3E");
}
.nav-ico[data-icon="doc"] {
  --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9z'/%3E%3Cpath d='M14 3v6h6'/%3E%3Cpath d='M9 13h6M9 17h6'/%3E%3C/svg%3E");
}
.nav-ico[data-icon="tools"] {
  --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.7 6.3a4.5 4.5 0 0 0-6.1 5.3L4 16.2 7.8 20l4.6-4.6a4.5 4.5 0 0 0 5.3-6.1l-2.5 2.5-2.5-2.5z'/%3E%3C/svg%3E");
}
.nav-ico[data-icon="user"] {
  --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='3.5'/%3E%3Cpath d='M5 20a7 7 0 0 1 14 0'/%3E%3C/svg%3E");
}
.nav-ico[data-icon="ai"] {
  --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v3M12 18v3M3 12h3M18 12h3'/%3E%3Cpath d='m6.5 6.5 2 2M15.5 15.5l2 2M17.5 6.5l-2 2M8.5 15.5l-2 2'/%3E%3Ccircle cx='12' cy='12' r='3.2'/%3E%3C/svg%3E");
}
.nav-ico[data-icon="logout"] {
  --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 17H5a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h5'/%3E%3Cpath d='M15 12H8'/%3E%3Cpath d='m13 8 4 4-4 4'/%3E%3C/svg%3E");
}
.nav-ico[data-icon="key"] {
  --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='15' r='4'/%3E%3Cpath d='M11.5 12.5 20 4'/%3E%3Cpath d='M16.5 7.5 19 10'/%3E%3C/svg%3E");
}
.nav-ico[data-icon="plus"] {
  --nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
}

.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(12, 22, 34, 0.35); z-index: 40;
}
.app-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(320px, 88vw);
  background: var(--drawer-bg); z-index: 50; padding: 1rem 1rem 1.5rem;
  box-shadow: -12px 0 30px rgba(12, 22, 34, 0.14);
  display: flex; flex-direction: column; gap: 0.4rem;
  /* body.drawer-open kills page scroll, so the drawer must scroll itself —
     the owner/tenant list is ~11 rows and „Изход" fell off small phones. */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.app-drawer[hidden], .drawer-backdrop[hidden] { display: none !important; }
.app-drawer-head { display: flex; justify-content: space-between; align-items: center; }
.app-drawer-nav { display: grid; gap: 0.2rem; }
.app-drawer-nav a {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.75rem 0.55rem; border-radius: 12px;
  color: var(--ink); font-weight: 650; text-decoration: none;
}
.app-drawer-nav a:hover { background: var(--brand-soft); }
/* Logout is a POST form (CSRF); the form is layout-transparent and the button keeps the link look. */
.logout-form { display: contents; }
.app-drawer-nav .logout-form button {
  display: flex; align-items: center; gap: 0.7rem; width: 100%;
  padding: 0.75rem 0.55rem; border-radius: 12px;
  color: var(--ink); font-weight: 650; text-decoration: none;
}
.app-drawer-nav .logout-form button:hover { background: var(--brand-soft); }
.app-sidebar-foot-logout.linklike { color: rgba(255,255,255,0.55); }
.danger-link { color: var(--danger) !important; }

body.drawer-open { overflow: hidden; }

.dev-otp {
  margin-top: 0.8rem; padding: 0.8rem; border-radius: 12px;
  background: var(--wip-bg); color: var(--wip-ink); border: 1px dashed var(--accent);
}

@media (min-width: 960px) {
  .app-frame {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }
  .app-sidebar {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    max-height: 100vh;
    min-height: 0;
    padding: 1rem 0.85rem;
    background: var(--sidebar-bg);
    color: #fff;
    overflow: hidden;
  }
  .app-sidebar-head {
    flex: 0 0 auto;
  }
  .app-sidebar-brand {
    display: inline-flex;
    margin-bottom: 0.85rem;
    text-decoration: none;
  }
  .app-sidebar-brand:hover { text-decoration: none; }
  .app-sidebar-nav {
    display: grid;
    gap: 0.15rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.15rem;
    scrollbar-gutter: stable;
  }
  .app-sidebar-nav a {
    display: flex; align-items: center; gap: 0.65rem;
    color: rgba(255,255,255,0.88); text-decoration: none;
    padding: 0.55rem 0.65rem; border-radius: 12px; font-weight: 650; font-size: 0.9rem;
    min-width: 0;
  }
  .app-sidebar-nav a .nav-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }
  .app-sidebar-nav a.active,
  .app-sidebar-nav a:hover {
    background: rgba(255,255,255,0.14); color: #fff;
  }
  .app-sidebar-nav .wip-chip {
    background: rgba(255,241,220,0.2); color: #ffe2b0;
  }
  .app-sidebar-foot {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    margin-top: 0.55rem;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(255,255,255,0.12);
  }
  .app-sidebar-foot-role {
    min-width: 0;
  }
  .app-sidebar-foot-role .role-line {
    display: flex;
    width: 100%;
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .app-sidebar-foot-role .role-prefix {
    color: rgba(255,255,255,0.55);
  }
  .app-sidebar-foot-role .role-label {
    color: rgba(255,255,255,0.92);
  }
  .app-sidebar-foot-role .role-select {
    color: #fff;
    max-width: none;
    flex: 1 1 auto;
    background-color: rgba(255,255,255,0.1);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23ffffff' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 8px;
    padding: 0.28rem 1.15rem 0.28rem 0.5rem;
  }
  .app-sidebar-foot-role .role-select-form {
    flex: 1 1 auto;
    min-width: 0;
  }
  .app-sidebar-foot-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }
  .app-sidebar-foot-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    flex: 1 1 auto;
    color: rgba(255,255,255,0.88);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 650;
    padding: 0.25rem 0.2rem;
    border-radius: 8px;
  }
  .app-sidebar-foot-link:hover { color: #fff; background: rgba(255,255,255,0.08); text-decoration: none; }
  .app-sidebar-foot-logout {
    flex: 0 0 auto;
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.45rem;
    border-radius: 8px;
  }
  .app-sidebar-foot-logout:hover { color: #fff; background: rgba(255,255,255,0.08); text-decoration: none; }
  .theme-toggle--sidebar {
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    font-size: 0.85rem;
    margin-top: 0;
  }
  .app-main {
    width: min(1180px, 100%);
    padding: 1.4rem 1.5rem 2rem;
  }
  .app-top {
    display: none;
  }
  .app-top .menu-btn,
  .nav-bottom,
  .app-drawer,
  .drawer-backdrop { display: none !important; }
}

.plain-list {
  margin: 0;
  padding-left: 1.1rem;
}
.plain-list li {
  margin: 0.35rem 0;
}
.stack-form { display: grid; gap: 0; max-width: 28rem; }
/* Grid items stretch the column. Direct submits stayed card-wide; keep them content-sized. */
.stack-form > .btn {
  width: auto;
  max-width: 100%;
  min-width: 5.5rem;
  min-height: 2.75rem;
  justify-self: start;
}
.stack-form label { font-size: 0.85rem; font-weight: 650; color: var(--muted); margin-top: 0.25rem; }
.stack-form label.checkbox-row,
.stack-form .checkbox-row {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0.9rem 0;
}
.stack-form .radio-stack .checkbox-row,
.stack-form .checkbox-stack .checkbox-row {
  margin: 0;
}
.invite-url { margin-top: 0.35rem; font-size: 0.82rem; word-break: break-all; }

/* People hub */

.people-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.55rem; margin-bottom: 0.9rem; }

.people-summary-item { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 0.75rem 0.85rem; text-align: center; }

.people-summary-item.is-alert { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); background: color-mix(in srgb, var(--danger) 8%, var(--card)); }

.people-summary-value { display: block; font-size: 1.35rem; font-weight: 750; line-height: 1.1; }

.people-summary-label { font-size: 0.78rem; color: var(--muted); font-weight: 650; }

.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.75rem; margin-bottom: 0.9rem; }

.unit-card { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.95rem 1rem; background: var(--card); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: border-color 120ms ease, transform 120ms ease; }

.unit-card:hover { border-color: var(--brand); transform: translateY(-1px); text-decoration: none; color: inherit; }

.unit-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }

.unit-card-title { font-size: 1.05rem; }

.unit-card-meta { font-size: 0.84rem; }

.unit-card-people { margin: 0.35rem 0 0; padding-left: 1rem; font-size: 0.9rem; }

.unit-card-people li { margin: 0.15rem 0; }

.unit-card-empty { margin: 0.35rem 0 0; font-size: 0.9rem; }

.unit-card-foot { margin-top: auto; padding-top: 0.45rem; font-size: 0.8rem; border-top: 1px solid var(--line); }

.invite-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-bottom: 0.75rem; }

.invite-actions form { margin: 0; }

.people-inbox { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }

.page-crumb a { color: inherit; font-weight: 700; }

/* Desktop workspace: full-width main; tables vs mobile cards */
.desktop-only { display: none !important; }
.page-shell { display: block; }
.page-main { min-width: 0; }
.page-aside { display: none; } /* legacy; asides removed from templates */
.help-panel-steps {
  margin-top: 0.35rem;
}
.summary-panel .aside-stats {
  margin-top: 0.35rem;
}
.summary-panel .aside-actions {
  margin-top: 0.85rem;
}
.aside-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.05rem;
  margin-bottom: 0.75rem;
  min-width: 0;
  overflow: hidden;
}
.aside-title {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
}
.aside-stats {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  min-width: 0;
}
.aside-stats > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.aside-stats > div:last-child { border-bottom: 0; padding-bottom: 0; }
.aside-stats dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
  flex: 0 0 auto;
  max-width: 42%;
}
.aside-stats dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.aside-stats > div.is-alert dd { color: var(--danger); }
.aside-stats--stack > div {
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
}
.aside-stats--stack dt { max-width: none; }
.aside-stats--stack dd { text-align: left; font-size: 0.9rem; }
.aside-actions {
  display: grid;
  gap: 0.45rem;
}
.aside-actions .btn { width: 100%; justify-content: center; text-align: center; }
.table-wrap { overflow-x: auto; margin: 0 -0.15rem; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th,
.data-table td {
  padding: 0.7rem 0.55rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.data-table th {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.data-table tbody tr:hover td {
  background: color-mix(in srgb, var(--brand-soft) 55%, transparent);
}
.data-table a { color: inherit; text-decoration: none; }
.data-table a:hover { color: var(--brand); text-decoration: underline; }
/* A real link inside a data table (e.g. report „Фактура“): visible without hover on touch. */
.data-table a.report-link { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }

.units-list-card { margin-bottom: 1rem; }
.units-table-action { text-align: right; white-space: nowrap; }
.units-table tbody tr td { vertical-align: middle; }

.module-core-list {
  display: grid;
  gap: 0.45rem;
  margin: 0.85rem 0 1rem;
}
.module-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.7rem;
  align-items: start;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--card) 92%, var(--brand-soft));
  cursor: pointer;
}
.module-row--locked {
  grid-template-columns: 1fr auto;
  cursor: default;
  opacity: 0.92;
}
.module-row input {
  margin-top: 0.2rem;
  width: 1.1rem;
  height: 1.1rem;
}
.module-row span { display: grid; gap: 0.12rem; }
.module-form { display: grid; gap: 0.45rem; }

.desktop-secondary { margin-top: 1rem; }

.finance-tabs,
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1rem;
  padding: 0.25rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  width: fit-content;
  max-width: 100%;
}
.finance-tab,
.filter-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.95rem;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
}
.finance-tab:hover,
.filter-tab:hover { color: var(--ink); text-decoration: none; background: var(--brand-soft); }
.finance-tab.is-active,
.filter-tab.is-active {
  background: var(--brand);
  color: #fff;
}
html[data-theme="dark"] .finance-tab.is-active,
html[data-theme="dark"] .filter-tab.is-active {
  color: #0c1b2a;
}
.filter-tabs-mobile { display: none; }
.filter-tabs-select {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}
@media (max-width: 720px) {
  .finance-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  .finance-tab { flex: 0 0 auto; }
  .filter-tabs--desktop { display: none; }
  .filter-tabs-mobile { display: block; margin: 0 0 1rem; }
}
.metric-row { margin-bottom: 0.85rem; }
.metric-card--alert { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.chart-grid {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 0.9rem;
}
.chart-card .section-head { margin-bottom: 0.75rem; }
.donut-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
}
.donut {
  width: 8.5rem;
  height: 8.5rem;
}
.donut-ring {
  fill: none;
  stroke: var(--line);
  stroke-width: 3.2;
}
.donut-segment {
  fill: none;
  stroke-width: 3.2;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}
.donut-segment--ok { stroke: var(--ok); }
.donut-segment--warn { stroke: var(--danger); }
.donut-center-value {
  fill: var(--ink);
  font-size: 0.45rem;
  font-weight: 750;
  text-anchor: middle;
}
.donut-center-label {
  fill: var(--muted);
  font-size: 0.22rem;
  font-weight: 650;
  text-anchor: middle;
}
.chart-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  font-size: 0.88rem;
}
.chart-legend .swatch {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  margin-right: 0.35rem;
  vertical-align: middle;
}
.swatch-ok { background: var(--ok); }
.swatch-warn { background: var(--danger); }
.bar-chart { display: grid; gap: 0.55rem; }
.bar-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr 4.5rem;
  gap: 0.55rem;
  align-items: center;
}
.bar-label { font-size: 0.84rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track {
  height: 0.65rem;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--danger) 70%, var(--brand)), var(--danger));
  min-width: 0.25rem;
}
.bar-value { font-size: 0.82rem; font-weight: 700; text-align: right; white-space: nowrap; }
.bar-fill--ok { background: linear-gradient(90deg, color-mix(in srgb, var(--ok) 65%, var(--brand)), var(--ok)); }
.bar-fill--brand { background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 70%, #fff)); }
.bar-fill--mid { background: linear-gradient(90deg, var(--accent, #c87941), color-mix(in srgb, var(--accent, #c87941) 70%, #fff)); }
.status-bars { display: grid; gap: 0.55rem; }
.contact-list { display: grid; gap: 0.55rem; }
.contact-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--brand-soft) 35%, var(--card));
}
.contact-card-main { display: grid; gap: 0.2rem; min-width: 0; }
.contact-card-name { font-size: 1rem; }
.contact-card-phone { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.45rem; }
.contact-card-hint { font-size: 0.78rem; }
.contact-call-btn { flex: 0 0 auto; }
.phone-link {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.phone-link:hover { text-decoration: underline; }
.table-contact { margin: 0.2rem 0 0.45rem; }
.table-contact:last-child { margin-bottom: 0; }
.debtor-contacts {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.45rem;
}
.debtor-contact {
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  line-height: 1.35;
}
.debtor-contact-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.4rem;
  align-items: baseline;
}
.debtor-contact-name { font-weight: 650; }
.debtor-item { padding-bottom: 0.85rem; }
.data-table .debtor-contacts { margin-top: 0; }

@media (min-width: 720px) {
  .chart-grid { grid-template-columns: 1fr 1.15fr; }
}

@media (max-width: 560px) {
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .bar-row { grid-template-columns: 4.2rem 1fr; }
  .bar-value { grid-column: 2; text-align: left; font-size: 0.78rem; color: var(--muted); }
}

@media (min-width: 960px) {
  .mobile-only { display: none !important; }
  .desktop-only { display: revert !important; }
  .page-shell {
    display: block;
  }
}

/* Assemblies / protocols */
.hero-panel > .muted { margin: 0.35rem 0 0; line-height: 1.45; }
.metric-card__hint { margin-top: 0.3rem; font-size: 0.8rem; line-height: 1.35; }
.form-hint { margin: 0.65rem 0 0; font-size: 0.8rem; line-height: 1.4; }
.block-form { margin: 0 0 0.75rem; }
.stack-form--flush { max-width: none; }
.stack-form--flush > label:first-of-type { margin-top: 0; }
.share-edit-form { margin-top: 0.85rem; }
.aside-copy { margin: 0; line-height: 1.45; }

.quorum-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.1rem;
  border-radius: var(--radius);
  margin: 0 0 0.9rem;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.quorum-banner--ok {
  background: var(--flash-ok-bg);
  border-color: color-mix(in srgb, var(--ok) 28%, var(--line));
  color: var(--ok);
}
.quorum-banner--wait {
  background: var(--flash-error-bg);
  border-color: color-mix(in srgb, var(--danger) 28%, var(--line));
  color: var(--danger);
}
.quorum-banner__text { min-width: 0; }
.quorum-banner__label {
  font-size: 1.1rem;
  font-weight: 750;
  line-height: 1.25;
}
.quorum-banner__meta {
  font-size: 0.84rem;
  margin-top: 0.25rem;
  color: var(--ink);
  line-height: 1.4;
}
.quorum-banner__pct {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  line-height: 1;
}
.quorum-banner__side {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}
.quorum-banner__legal {
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}

.info-tip {
  display: inline-block;
  position: relative;
  vertical-align: middle;
}
.info-tip__btn {
  list-style: none;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.info-tip__btn::-webkit-details-marker { display: none; }
.info-tip__btn::marker { content: ''; }
.info-tip[open] .info-tip__btn {
  border-color: var(--accent, #2A3C93);
  color: var(--accent, #2A3C93);
}
.info-tip__panel {
  position: absolute;
  z-index: 20;
  right: 0;
  top: calc(100% + 0.35rem);
  width: min(22rem, 80vw);
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.45;
}
.field-help-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem;
  align-items: start;
}
.field-help-row .info-tip { margin-top: 0.65rem; }
.hero-actions .info-tip { align-self: center; }
.agenda-totals .info-tip { margin-left: 0.15rem; }

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}
.choice-row form {
  margin: 0;
  flex: 0 0 auto;
  width: auto;
  display: inline-flex;
}
button.choice-chip,
.choice-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  margin: 0;
  min-height: 2.5rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--tile-bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
}
button.choice-chip:hover,
.choice-chip:hover { opacity: 0.92; }
button.choice-chip.is-active,
.choice-chip.is-active {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-ink);
  border-color: transparent;
}

.proxy-name-form {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.55rem;
  flex-wrap: wrap;
  align-items: center;
}
.proxy-name-form input {
  flex: 1 1 11rem;
  min-width: 0;
  padding: 0.55rem 0.75rem;
}
.proxy-name-form .btn {
  padding: 0.55rem 0.9rem;
  font-size: 0.84rem;
}

.agenda-create-rows {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0.35rem 0 0.55rem;
}
.agenda-create-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}
.agenda-create-row:last-child { border-bottom: 0; padding-bottom: 0; }
.agenda-create-row__remove {
  justify-self: start;
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
}
.agenda-majority-form {
  margin: 0.65rem 0 0.35rem;
}
.agenda-majority-form label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.82rem;
}
.agenda-majority-form select {
  width: 100%;
  min-height: 2.6rem;
}
@media (min-width: 720px) {
  .agenda-create-row {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto;
    align-items: start;
  }
  .agenda-create-row__remove { margin-top: 0.55rem; }
}

.agenda-block {
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--line);
}
.agenda-block:first-of-type { padding-top: 0.25rem; }
.agenda-block:last-child { border-bottom: 0; padding-bottom: 0; }
.agenda-block h3 {
  margin: 0 0 0.3rem;
  font-size: 1.02rem;
  line-height: 1.3;
}
.agenda-totals { margin: 0; font-size: 0.88rem; }
.agenda-totals__counts { display: inline; }
.agenda-decision { margin-top: 0.85rem; }
.agenda-decision-text { margin: 0.55rem 0 0; line-height: 1.45; }

.vote-grid {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.7rem;
}
.vote-unit {
  padding: 0.7rem 0.8rem;
  border-radius: 14px;
  background: var(--tile-bg);
  border: 1px solid var(--line);
}
.vote-unit__label {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: baseline;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}
.vote-unit .choice-row { margin-top: 0.5rem; }

.share-setup-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.15rem;
}
.share-setup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 6.6rem 5.2rem auto;
  gap: 0.35rem;
  align-items: center;
}
.share-setup-head {
  align-items: end;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.25;
  padding: 0 0 0.1rem;
}
.share-setup-col {
  text-align: center;
}
.share-setup-ok-spacer {
  min-width: 3.4rem;
}
.share-setup-label {
  font-size: 0.82rem;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-setup-head .share-setup-label {
  font-size: 0.68rem;
}
.share-setup-row input {
  padding: 0.45rem 0.5rem;
  font-size: 0.82rem;
}
.share-setup-row .btn {
  padding: 0.42rem 0.55rem;
  font-size: 0.75rem;
}

.list-item-link {
  display: block;
  color: inherit;
  text-decoration: none;
  margin: 0 -0.35rem;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  border-radius: 12px;
}
.list-item-link:hover {
  text-decoration: none;
  background: var(--tile-bg);
}

.protocol-editor {
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  font-size: 0.88rem;
  line-height: 1.5;
  width: 100%;
  min-height: 18rem;
  margin-top: 0.15rem;
}
.protocol-body {
  white-space: pre-wrap;
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0;
  color: var(--ink);
}

@media (max-width: 560px) {
  .share-setup-row {
    grid-template-columns: 1fr 1fr auto;
    grid-template-areas:
      "label label label"
      "share area ok";
  }
  .share-setup-label { grid-area: label; }
  .share-setup-row input[name="common_parts_share"],
  .share-setup-col--share { grid-area: share; }
  .share-setup-row input[name="area_sqm"],
  .share-setup-col--area { grid-area: area; }
  .share-setup-row .btn,
  .share-setup-ok-spacer { grid-area: ok; }
  .quorum-banner { align-items: flex-start; }
  .quorum-banner__pct { font-size: 1.35rem; }
}

.print-brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
  min-height: 3rem;
}
.print-brand-bar__left {
  flex: 1 1 auto;
  min-width: 0;
}
.print-brand-bar__name {
  display: block;
  font-weight: 650;
  font-size: 1.05rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.print-brand-bar__realistimo {
  display: block;
  height: 1.75rem;
  width: auto;
  max-width: 8.75rem;
  object-fit: contain;
  flex: 0 0 auto;
}
.print-party-logo,
.party-logo-preview {
  display: block;
  max-height: 3rem;
  max-width: 10rem;
  object-fit: contain;
  margin: 0;
}
.party-logo-preview {
  margin: 0 0 0.6rem;
}
.logo-crop-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  border-radius: 0.5rem;
  cursor: grab;
  touch-action: none;
}
.logo-crop-canvas:active {
  cursor: grabbing;
}
.logo-crop-zoom {
  width: 100%;
  margin: 0.65rem 0 0;
}

@media print {
  @page { size: A4; margin: 12mm; }
  /* A4 at 96dpi is ~794px, i.e. below the 960px breakpoint — so the MOBILE shell is what
     prints. These must match the real class names in layout.html.twig (.nav-bottom / .app-top),
     or protocols, покани, книгата and receipts print with the hamburger bar on the page. */
  .no-print,
  .info-tip,
  .app-sidebar,
  .nav-bottom,
  .app-top,
  .context-bar,
  .app-drawer,
  .drawer-backdrop,
  .flash,
  .page-crumb,
  .hero-panel,
  .sf-toolbar { display: none !important; }
  .protocol-print {
    box-shadow: none;
    border: 0;
    padding: 0;
    margin: 0;
  }
  .print-brand-bar {
    margin: 0 0 8mm;
  }
  .print-party-logo {
    max-height: 48px;
    max-width: 160px;
  }
  .print-brand-bar__realistimo {
    height: 28px;
    max-width: 140px;
  }
  body { background: #fff; color: #111; }
}
.issue-album {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.5rem 0;
}
.issue-album a,
.issue-album img {
  display: block;
  width: 5.5rem;
  height: 5.5rem;
  object-fit: cover;
  border-radius: 6px;
}
.issue-timeline {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
  color: var(--muted);
}
.issue-timeline li { margin: 0.15rem 0; }

/* Payment references / reconciliation */
.pay-ref {
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--brand-deep);
}
.pay-ref--lg { font-size: 1.45rem; }
.pay-ref-hero {
  margin-bottom: 0.9rem;
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line));
  background: color-mix(in srgb, var(--brand-soft) 70%, var(--card));
}
.pay-ref-hero .label {
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 0.35rem;
}
.pay-ref-hero__code { margin: 0.15rem 0 0.35rem; }
.pay-page .btn,
.pay-ref-hero .btn,
[data-copy-target] {
    min-height: 44px;
    min-width: 44px;
}
.pay-ref-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: baseline;
  margin-top: 0.35rem;
}
.aside-steps {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}
.aside-steps code { font-size: 0.84rem; }

.bank-match-summary {
  margin: 0 0 0.85rem;
  font-size: 1.02rem;
  line-height: 1.45;
}
.bank-match-override {
  margin: 0.15rem 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  background: color-mix(in srgb, var(--card) 88%, var(--bg));
}
.bank-match-override > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 650;
}
.bank-match-override[open] > summary { margin-bottom: 0.55rem; }
.bank-cash-toggle {
  margin: 0.35rem 0 0.85rem;
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
}
.bank-cash-toggle em {
  font-style: normal;
  opacity: 0.8;
}
.btn-confirm-payment {
  width: 100%;
  justify-content: center;
  font-size: 1.02rem;
  padding: 0.85rem 1.1rem;
}
.bank-debtors {
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}
.bank-debtors__summary {
  list-style: none;
  cursor: pointer;
  margin: 0;
}
.bank-debtors__summary::-webkit-details-marker { display: none; }
.bank-debtors__summary h2 { margin: 0; }
.bank-debtors > .form-hint,
.bank-debtors > .list-item,
.bank-debtors > .muted {
  margin-top: 0.7rem;
}

/* Notifications / calendar */
.notif-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.notif-inbox-card .section-head {
  margin-bottom: 0.35rem;
}
.notif-list {
  display: grid;
  gap: 0.75rem;
  margin: 0.35rem 0 0.85rem;
}
.notif-card {
  display: grid;
  gap: 0.45rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
.notif-card--unread {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
  background: color-mix(in srgb, var(--brand-soft) 60%, var(--card));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand) 12%, transparent);
}
.notif-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
}
.notif-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  align-items: baseline;
  min-width: 0;
}
.notif-card__type {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--brand);
}
.notif-card__time {
  font-size: 0.82rem;
  color: var(--muted);
}
.notif-card__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
}
.notif-card__body {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
.notif-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.15rem;
}
.notif-card__actions form {
  margin: 0;
}
.btn-sm {
  min-height: 2.5rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.82rem;
}
.notif-section-title {
  margin: 0.85rem 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.notif-section-title:first-of-type { margin-top: 0.2rem; }
.notif-cancel-form { margin-top: 0.45rem; }
/* Моите имоти: one list, each имот separated by a rule. */
.portfolio-list .portfolio-unit-card + .portfolio-unit-card {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.portfolio-list .portfolio-unit-card p { margin: 0.35rem 0 0; }
.portfolio-unit-card__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.portfolio-unit-card__head h3 {
  margin: 0;
  font-size: 1.05rem;
  flex: 1 1 auto;
  min-width: 0;
}
.portfolio-months {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.portfolio-months__cell {
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  background: var(--tile-bg);
  font-size: 0.9rem;
}
.portfolio-unit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
}
.portfolio-unit-actions form {
  margin: 0;
}
.portfolio-location-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  display: block;
}
a.portfolio-location-title {
  color: inherit;
  text-decoration: none;
}
a.portfolio-location-title:hover {
  color: var(--brand);
  text-decoration: underline;
}
h2.portfolio-location-title {
  margin: 0;
  font-size: 1.15rem;
}
h2.portfolio-location-title a {
  color: inherit;
  text-decoration: none;
}
h2.portfolio-location-title a:hover {
  color: var(--brand);
  text-decoration: underline;
}
.portfolio-attention-list {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
}
.portfolio-attention-list li { margin: 0.25rem 0; }
.portfolio-filters {
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}
.portfolio-filters__summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 1.05rem;
}
.portfolio-filters__summary::-webkit-details-marker { display: none; }
.portfolio-filters__summary::before {
  content: '▸';
  display: inline-block;
  color: var(--muted);
  transition: transform 0.12s ease;
}
.portfolio-filters[open] > .portfolio-filters__summary::before {
  transform: rotate(90deg);
}
.portfolio-filters__hint {
  font-weight: 500;
  font-size: 0.9rem;
}
.portfolio-filters__form {
  margin-top: 0.85rem;
  max-width: none;
}
.portfolio-filters__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin: 0 0 0.75rem;
}
.portfolio-filters__row > .floating-label {
  margin-bottom: 0;
}
.portfolio-filters__checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  margin: 0 0 0.85rem;
}
.portfolio-filters__checks .checkbox-row {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin: 0;
  white-space: nowrap;
}
.portfolio-filters__actions {
  margin-top: 0;
}
.portfolio-location-filter {
  margin-bottom: 0.75rem;
}
.portfolio-location-filter.form-row {
  gap: 0.75rem 1rem;
}
.portfolio-location-filter > .col-4 {
  width: calc(33.333% - 0.67rem);
  flex: 1 1 10rem;
  min-width: 10rem;
}
@media (max-width: 720px) {
  .portfolio-filters__row {
    grid-template-columns: 1fr;
  }
  .portfolio-location-filter > .col-4 {
    width: 100%;
    flex: 1 1 100%;
  }
}
.nav-badge {
  margin-left: auto;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--danger, #c45c5c) 88%, #000);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.nav-badge--bottom {
  position: absolute;
  top: 0.15rem;
  right: 0.35rem;
  margin-left: 0;
}
.nav-bottom > a { position: relative; }

/* Shared form dialogs (create composers + unit-create) */
.form-dialog,
.unit-create-dialog {
  width: min(28rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  margin: auto;
  padding: 0;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  border-radius: 1rem;
  background: var(--card, #1a2230);
  color: inherit;
  box-shadow: 0 1.25rem 3rem rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.form-dialog--wide {
  width: min(36rem, calc(100vw - 2rem));
}
.form-dialog::backdrop,
.unit-create-dialog::backdrop {
  background: rgba(4, 8, 16, 0.72);
}
.form-dialog__form {
  display: flex;
  flex-direction: column;
  padding: 0;
  max-width: none;
  max-height: calc(100vh - 2rem);
  overflow: hidden;
}
.form-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
  padding: 1.1rem 1.15rem 0.75rem;
}
.form-dialog__head h2 {
  margin: 0;
  font-size: 1.15rem;
}
.form-dialog__close {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.15rem 0.4rem;
  cursor: pointer;
  border-radius: 0.4rem;
}
.form-dialog__close:hover {
  color: inherit;
  background: rgba(255, 255, 255, 0.06);
}
.form-dialog__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0 1.15rem 0.5rem;
  /* form-dialog__form is flex (overrides stack-form). Field margins own vertical rhythm. */
  display: grid;
  gap: 0;
  align-content: start;
}
.form-dialog__actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-shrink: 0;
  margin: 0;
  padding: 0.85rem 1.15rem 1.15rem;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background: var(--card, #1a2230);
}
.form-dialog__actions .btn {
  min-width: 6.5rem;
}
.unit-create-form {
  display: flex;
  flex-direction: column;
  padding: 0;
  max-width: none;
  max-height: calc(100vh - 2rem);
  overflow: hidden;
}
.unit-create-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
  padding: 1.1rem 1.15rem 0.75rem;
}
.unit-create-dialog__head h2 {
  margin: 0;
  font-size: 1.15rem;
}
.unit-create-dialog__close {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.15rem 0.4rem;
  cursor: pointer;
  border-radius: 0.4rem;
}
.unit-create-dialog__close:hover {
  color: inherit;
  background: rgba(255, 255, 255, 0.06);
}
.unit-create-dialog__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0 1.15rem 0.5rem;
  display: grid;
  gap: 0;
  align-content: start;
}
.unit-create-section,
.form-panel-section {
  display: grid;
  gap: 0;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}
.unit-create-section:first-of-type,
.form-panel-section:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}
.unit-create-section__title,
.form-panel-section__title {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 700;
}
.unit-create-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.unit-create-field {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}
.unit-create-field label {
  margin-top: 0;
}
.unit-create-residents,
.form-repeat-list {
  display: grid;
  gap: 0.9rem;
  margin: 0 0 0.9rem;
}
.unit-create-resident,
.form-repeat-card {
  display: grid;
  gap: 0;
  padding: 0.75rem;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.12);
}
.unit-create-resident__head,
.form-repeat-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}
.unit-create-resident__title,
.form-repeat-card__title {
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--muted);
}
.unit-create-resident__remove,
.form-repeat-card__remove {
  min-width: 0;
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
}
.unit-create-add-resident,
.form-repeat-add {
  width: 100%;
  justify-content: center;
  margin-top: 0.25rem;
}
.unit-create-dialog__actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-shrink: 0;
  margin: 0;
  padding: 0.85rem 1.15rem 1.15rem;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background: var(--card, #1a2230);
}
.unit-create-dialog__actions .btn {
  min-width: 6.5rem;
}
@media (max-width: 28rem) {
  .unit-create-row {
    grid-template-columns: 1fr;
  }
}

/* Manager portfolio home */
.portfolio-buildings {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.portfolio-building-card__head {
  margin-bottom: 0.75rem;
}
.portfolio-building-card__title {
  margin: 0;
  font-size: 1.15rem;
}
.portfolio-building-card__address {
  margin: 0.25rem 0 0;
}
.portfolio-building-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.portfolio-building-card__actions form {
  margin: 0;
}
.portfolio-building-card__actions .btn {
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
}
.portfolio-metrics {
  margin-top: 0;
  margin-bottom: 0.9rem;
}

.is-hidden { display: none !important; }
.address-mode {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  margin: 0.25rem 0;
}
.address-mode legend {
  padding: 0 0.35rem;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--muted);
}



/* Floating labels — label inside field, shrinks to top when filled/focused */
.stack-form--floating {
  max-width: 36rem;
  gap: 0;
}
.stack-form--floating > .form-section,
.form-section {
  display: grid;
  gap: 0;
}
/* Cards / panels that hold floating fields directly.
   :has() in a comma list with other selectors is dropped wholesale in
   browsers that lack :has — keep each :has rule in its own block. */
.pay-settings-fields {
  display: grid;
  gap: 0;
  align-content: start;
}
.card:has(> .floating-label) {
  display: grid;
  gap: 0;
  align-content: start;
}
.card:has(> .form-row) {
  display: grid;
  gap: 0;
  align-content: start;
}
.card:has(> .form-section) {
  display: grid;
  gap: 0;
  align-content: start;
}
.stack-form .floating-label > label,
.stack-form--floating .floating-label > label {
  margin: 0 !important;
  font-weight: 500;
}
.form-section__title {
  margin: 0.35rem 0 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.form-section__title:first-child {
  margin-top: 0;
}
/* `display: block` would beat the UA `[hidden]` rule (the „Живущ от сградата“ select stayed visible but disabled). */
.floating-label[hidden] { display: none; }
.invite-status-panel__extra { margin-top: 0.35rem; }
.floating-label {
  display: block;
  position: relative;
  /* Spacing lives on the control so every screen gets gaps even if parent is not a grid. */
  margin: 0 0 0.9rem;
}
.floating-label.stretch {
  width: 100%;
}
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0 0 0.9rem;
}
.form-row > .col-6,
.form-row > .col-8,
.form-row > .col-4 {
  padding: 0;
}
.form-row > .col-6 { width: 50%; flex: 0 0 50%; }
.form-row > .col-8 { width: 66.666%; flex: 0 0 66.666%; }
.form-row > .col-4 { width: 33.333%; flex: 0 0 33.333%; }
.form-row > .col-6 > .floating-label,
.form-row > .col-8 > .floating-label,
.form-row > .col-4 > .floating-label {
  margin-bottom: 0;
}
.stack-form > .checkbox-row,
.stack-form > .checkbox-stack,
.stack-form > .pay-settings-toggle,
.stack-form > .form-hint,
.stack-form > .muted.form-hint,
.form-dialog__body > .checkbox-row,
.form-dialog__body > .checkbox-stack,
.form-dialog__body > .pay-settings-toggle,
.form-dialog__body > .form-hint,
.form-dialog__body > .muted.form-hint,
.unit-create-dialog__body > .form-hint,
.unit-create-section > .form-hint,
.unit-create-section > .muted.form-hint,
.unit-create-section > .checkbox-stack,
.form-panel-section > .form-hint,
.form-panel-section > .muted.form-hint,
.form-panel-section > .inline-form,
.form-panel-section > .checkbox-stack,
.unit-create-section > .unit-create-add-resident,
.form-panel-section > .form-repeat-add {
  margin: 0.15rem 0 0.9rem;
}
.stack-form > .checkbox-row,
.form-dialog__body > .checkbox-row {
  margin-top: 0.9rem;
}
.form-dialog__body > :last-child,
.unit-create-dialog__body > :last-child,
.stack-form > :last-child,
.unit-create-section > :last-child,
.form-panel-section > :last-child,
.unit-create-resident > :last-child,
.form-repeat-card > :last-child,
.form-repeat-card .stack-form > :last-child {
  margin-bottom: 0;
}
.muted.form-hint,
.form-hint {
  margin: 0 0 0.9rem;
}
.floating-label input,
.floating-label select,
.floating-label textarea {
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  height: 3.35rem;
  padding: 1.35rem 0.9rem 0.4rem;
  border: 1px solid var(--input-border);
  border-radius: 12px;
  width: 100%;
  line-height: 1.25;
  background: var(--input-bg);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.floating-label textarea {
  height: auto;
  min-height: 5.5rem;
  padding-top: 1.45rem;
}
.floating-label select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% + 4px), calc(100% - 10px) calc(50% + 4px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2.1rem;
}
.floating-label input:focus,
.floating-label select:focus,
.floating-label textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.floating-label > label {
  position: absolute;
  left: 0.9rem;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  padding: 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  transition: top 0.18s ease, transform 0.18s ease, font-size 0.18s ease, color 0.18s ease;
  z-index: 1;
}
.floating-label input::placeholder {
  opacity: 0;
  color: var(--muted);
  transition: opacity 0.2s ease;
}
.floating-label input:focus::placeholder {
  opacity: 0.85;
}
/* Active = focused or has value — label sits in the top padding band */
.floating-label.is-active > label,
.floating-label input:not([type="hidden"]):not([type="date"]):not([type="month"]):not([type="datetime-local"]):not([type="time"]):not(:placeholder-shown) ~ label,
.floating-label input:not([type="hidden"]):focus ~ label,
.floating-label input[type="date"] ~ label,
.floating-label input[type="month"] ~ label,
.floating-label input[type="datetime-local"] ~ label,
.floating-label input[type="time"] ~ label,
.floating-label select[value] ~ label,
.floating-label textarea:not(:placeholder-shown) ~ label,
.floating-label textarea:focus ~ label {
  top: 0.38rem;
  transform: none;
  font-size: 0.68rem;
  font-weight: 650;
  color: var(--brand);
  right: 0.9rem;
}
/* Own block: :has in a comma list would drop every floating label in
   browsers without :has. Visible option text (incl. empty-value
   „не импортирай“) floats; hidden/empty placeholders stay the prompt. */
.floating-label select:has(option:checked:not([hidden]):not(:empty)) ~ label {
  top: 0.38rem;
  transform: none;
  font-size: 0.68rem;
  font-weight: 650;
  color: var(--brand);
  right: 0.9rem;
}
/* Hide empty native date chrome (mm/dd/yyyy) so it does not overlap the floated label. */
.floating-label.is-empty-date input[type="date"]:not(:focus)::-webkit-datetime-edit,
.floating-label.is-empty-date input[type="month"]:not(:focus)::-webkit-datetime-edit,
.floating-label.is-empty-date input[type="datetime-local"]:not(:focus)::-webkit-datetime-edit,
.floating-label.is-empty-date input[type="time"]:not(:focus)::-webkit-datetime-edit {
  color: transparent;
}
.floating-label input[type="date"]:focus::-webkit-datetime-edit,
.floating-label input[type="month"]:focus::-webkit-datetime-edit,
.floating-label input[type="datetime-local"]:focus::-webkit-datetime-edit,
.floating-label input[type="time"]:focus::-webkit-datetime-edit {
  color: inherit;
}
.floating-label--picker > input[data-bg-date-input-target="visible"],
.floating-label--picker > input[data-bg-time-input-target="visible"] {
  padding-right: 2.65rem;
}
.floating-label--picker > label {
  right: 2.65rem;
}
.floating-label--picker.is-active > label,
.floating-label--picker > input:focus ~ label {
  right: 2.65rem;
}
.field-picker {
  position: absolute;
  top: 50%;
  right: 0.4rem;
  width: 2.1rem;
  height: 2.1rem;
  transform: translateY(-50%);
  z-index: 2;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.field-picker svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
  pointer-events: none;
}
.field-picker--btn {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  border-radius: 8px;
}
.field-picker--btn:hover,
.field-picker--btn[aria-expanded="true"] {
  color: var(--brand);
}
.field-picker--btn:disabled {
  cursor: default;
  opacity: 0.45;
}
.floating-label .field-picker__native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  opacity: 0;
  cursor: pointer;
  background: transparent;
  color: transparent;
  -webkit-appearance: auto;
  appearance: auto;
  box-shadow: none;
}
.floating-label .field-picker__native:focus {
  outline: none;
  border: 0;
  box-shadow: none;
}
.fused-wrap.form-row .floating-label .field-picker__native {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
}
.time-popover {
  position: fixed;
  inset: unset;
  margin: 0;
  padding: 0.35rem;
  border: 1px solid var(--input-border);
  border-radius: 12px;
  background: var(--input-bg);
  box-shadow: var(--shadow);
  color: var(--ink);
  width: max-content;
}
.time-popover::backdrop {
  background: transparent;
}
.time-popover__cols {
  display: flex;
  gap: 0.2rem;
  height: 12.5rem;
}
.time-popover__col {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-width: 3.15rem;
  scrollbar-width: thin;
}
.time-popover__opt {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0.28rem 0.55rem;
  border-radius: 8px;
  font: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  text-align: center;
}
.time-popover__opt:hover {
  background: color-mix(in srgb, var(--brand-soft) 70%, var(--input-bg));
}
.time-popover__opt.is-selected {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 650;
}
.fused-wrap.form-row > .col-6:first-of-type .floating-label input,
.fused-wrap.form-row > .col-6:first-of-type .floating-label select,
.fused-wrap.form-row > .col-8:first-of-type .floating-label input,
.fused-wrap.form-row > .col-8:first-of-type .floating-label select {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right-width: 0;
}
.fused-wrap.form-row > .col-6:last-of-type .floating-label input,
.fused-wrap.form-row > .col-6:last-of-type .floating-label select,
.fused-wrap.form-row > .col-4:last-of-type .floating-label input,
.fused-wrap.form-row > .col-4:last-of-type .floating-label select {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
@media (max-width: 560px) {
  .form-row > .col-6,
  .form-row > .col-8,
  .form-row > .col-4 {
    width: 100%;
    flex: 0 0 100%;
  }
  .fused-wrap.form-row > .col-6:first-of-type .floating-label input,
  .fused-wrap.form-row > .col-6:first-of-type .floating-label select,
  .fused-wrap.form-row > .col-8:first-of-type .floating-label input,
  .fused-wrap.form-row > .col-8:first-of-type .floating-label select {
    border-radius: 12px;
    border-right-width: 1px;
    margin-bottom: 0.65rem;
  }
  .fused-wrap.form-row > .col-6:last-of-type .floating-label input,
  .fused-wrap.form-row > .col-6:last-of-type .floating-label select,
  .fused-wrap.form-row > .col-4:last-of-type .floating-label input,
  .fused-wrap.form-row > .col-4:last-of-type .floating-label select {
    border-radius: 12px;
  }
}

.entrance-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem;
  display: grid;
  gap: 0.75rem;
  background: var(--tile-bg);
}
.entrance-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.entrance-block__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}
.entrance-block__remove {
  min-width: 0;
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
}
.entrance-floors {
  display: grid;
  gap: 0.75rem;
}
.entrance-floors__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}
.building-entrances__multi {
  display: grid;
  gap: 0.85rem;
}
.building-entrances__multi-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.building-entrances__list {
  display: grid;
  gap: 0.85rem;
}
.building-entrances__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

/* Building property grid */
.unit-search {
  margin: 0 0 1rem;
}
.unit-search__input {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--input-border);
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
}
.unit-search__result {
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
}
.property-grid {
  display: grid;
  gap: 1.1rem;
}
.property-grid__entrance h3 {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
}
.property-floor {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.55rem;
  align-items: start;
  padding: 0.45rem 0;
  border-top: 1px solid var(--line);
}
.property-floor:first-of-type {
  border-top: 0;
}
.property-floor__label {
  font-weight: 650;
  font-size: 0.9rem;
  color: var(--muted);
  padding-top: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.property-floor__action {
  font-size: 0.75rem;
  padding: 0.45rem 0.65rem;
  min-height: 44px;
  min-width: 44px;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.property-grid__entrance h3 {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.unit-create-replicate {
  margin: 0.35rem 0 0.85rem;
  padding: 0.65rem 0.75rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
}
.property-floor__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: stretch;
}
.unit-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.2rem;
  min-width: 11.5rem;
  max-width: 17rem;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.25;
}
.unit-pill__line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.55rem;
  font-weight: 500;
  color: var(--muted);
}
.unit-pill__line--primary {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
}
.unit-pill__line--money.is-debt {
  color: #b42318;
}
.unit-pill__owner {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 500;
}
.unit-pill__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex: 0 0 auto;
  background: #c0392b;
}
.unit-pill__owner--invited .unit-pill__dot { background: #d4a017; }
.unit-pill__owner--book_only .unit-pill__dot { background: #8a8a8a; }
.unit-pill__owner--confirmed .unit-pill__dot { background: #2e7d32; }
.property-grid__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin: 0.75rem 0 0;
}
.unit-pill:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.unit-pill:hover .unit-pill__line--primary {
  color: var(--brand);
}
.unit-pill--add {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  min-width: 8rem;
  border-style: dashed;
  color: var(--brand);
  background: transparent;
  font-weight: 650;
}
.unit-pill--add:hover {
  background: var(--brand-soft);
}

/* Invite panel (phone-first modals) — GitHub issue #108 */
.invite-panel-row { align-items: stretch; margin-bottom: 0.75rem; }
.invite-status-panel {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3.2rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  background: var(--surface-alt, #f4f5f7);
  color: var(--ink, #24272c);
  font-size: 0.92rem;
}
html[data-theme="dark"] .invite-status-panel { background: rgba(255,255,255,0.04); }
.invite-status-panel .badge { flex: 0 0 auto; }
.badge.warn { background: #fdf1d7; color: #8a5a00; }
html[data-theme="dark"] .badge.warn { background: #3a2f18; color: #f0c46b; }
.invite-panel-invite { margin-top: 0.5rem; }
.invite-panel-invite .form-hint { margin-top: 0.25rem; }

/* Per-unit fee adjustments (ръчна корекция) — GitHub issue #237 */
.fee-adjust { margin: 0.25rem 0 0; }
.fee-adjust__toggle {
  cursor: pointer;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 650;
}
.fee-adjust__form {
  display: grid;
  gap: 0.3rem;
  max-width: 22rem;
  margin: 0.4rem 0 0.6rem;
  padding: 0.6rem 0.7rem;
  border-radius: 8px;
  background: var(--surface-alt, #f4f5f7);
}
html[data-theme="dark"] .fee-adjust__form { background: rgba(255,255,255,0.04); }
.fee-adjust__form label { font-size: 0.78rem; font-weight: 650; }
.fee-adjust__form input,
.fee-adjust__form select { width: 100%; }
.fee-adjust-list { margin: 0; padding: 0; list-style: none; }
.fee-adjust-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line, #e4e6ea);
  font-size: 0.86rem;
}
.fee-adjust-list li:last-child { border-bottom: 0; }
.cadastre-id-row__action {
  display: flex;
  align-items: flex-end;
  padding-bottom: 0.15rem;
}
.cadastre-id-row__action .btn {
  width: 100%;
}
.property-grid__entrance-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.cadastre-map-row {
  align-items: center;
}
.cadastre-map-row__label {
  margin: 0;
  font-weight: 650;
}
.cadastre-preview-table tr.is-disabled td {
  color: var(--muted);
}
.cadastre-missing-number {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 14rem;
}
.cadastre-missing-number__hint {
  margin: 0;
  color: #8a5a00;
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.35;
}
html[data-theme="dark"] .cadastre-missing-number__hint { color: #f0c46b; }
.cadastre-preview-table .cadastre-missing-number .floating-label {
  margin: 0;
}
.cadastre-choices .list-item {
  margin-bottom: 0.5rem;
}

/* A submit button that must read as a link: the „Нужно внимание" rows post to
   app_context_unit before opening a context-dependent screen, but sit in a list of
   plain links. Without this they inherit the bare `button` pill rule above. */
.linklike {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--brand);
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.linklike:hover { text-decoration: underline; }
.portfolio-attention-form { display: inline; }

/* Resident „Как да платя“ */
.pay-quick-rules {
  margin: 0.75rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  line-height: 1.5;
}
.pay-quick-rules strong { color: var(--ink); }
.pay-fee-breakdown { margin-top: 0.85rem; }
.pay-fee-breakdown summary { cursor: pointer; font-weight: 600; }
.pay-subhead { margin: 1rem 0 0; font-size: 1rem; }

/* EasyPay activation readiness (manager account screen + admin request) */
.checklist { list-style: none; margin: 0.5rem 0 1rem; padding: 0; line-height: 1.7; }
.checklist .is-missing { color: var(--danger); font-weight: 600; }

/* Entrance notice with QR (/app/building/notice), A4 portrait */
.entrance-notice {
    max-width: 46rem;
    margin: 0 auto;
    text-align: center;
}

.entrance-notice__kicker {
    margin: 1rem 0 0;
    font-size: 1.1rem;
}

.entrance-notice__title {
    margin: 0.2rem 0;
    font-size: 2.2rem;
}

.entrance-notice__address {
    margin: 0;
    color: var(--muted);
}

.entrance-notice__lead {
    margin: 1.4rem auto;
    max-width: 36rem;
    font-size: 1.15rem;
    line-height: 1.5;
}

.entrance-notice__grid {
    display: grid;
    grid-template-columns: 15rem 1fr;
    gap: 1.6rem;
    align-items: center;
    text-align: left;
}

.entrance-notice__qr svg {
    display: block;
    width: 15rem;
    height: 15rem;
}

.entrance-notice__qr .dark {
    fill: #000;
}

.entrance-notice__steps {
    margin: 0;
    padding-left: 1.4rem;
    font-size: 1.1rem;
    line-height: 1.6;
}

.entrance-notice__code {
    margin: 1.6rem 0 0.4rem;
    font-size: 1.05rem;
}

.entrance-notice__foot {
    color: var(--muted);
    font-size: 0.9rem;
}

@media print {
    .entrance-notice {
        max-width: none;
        border: 0;
        box-shadow: none;
    }
}
