/**
 * Тема: зелёный + белый, без Vite.
 * Сайдбар: .app-shell.is-sidebar-collapsed — только иконки (состояние в localStorage).
 */
 :root {
    --green-950: #052e16;
    --green-900: #14532d;
    --green-800: #166534;
    --green-700: #15803d;
    --green-600: #16a34a;
    --green-500: #22c55e;
    --green-400: #4ade80;
    --green-100: #dcfce7;
    --green-50: #f0fdf4;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-500: #64748b;
    --gray-700: #334155;
    --gray-900: #0f172a;
    --danger: #dc2626;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 14px rgb(22 101 52 / 0.12);
    --shadow-soft: 0 1px 3px rgb(15 118 110 / 0.08);
    --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
    --sidebar-width-expanded: 15.5rem;
    --sidebar-width-collapsed: 4.25rem;
    --transition-sidebar: width 0.32s var(--ease-out);
    --transition-fade: opacity 0.28s var(--ease-out), transform 0.32s var(--ease-out);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.55;
    font-size: 1rem;
    color: var(--gray-900);
    background: var(--gray-50);
}

/* --- Публичные страницы (лендинг, вход) --- */
.theme-public body {
    background: var(--white);
}

a {
    color: inherit;
}

@keyframes fade-up {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes gentle-pulse {
    0%,
    100% {
        opacity: 0.55;
    }
    50% {
        opacity: 0.85;
    }
}

.animate-fade-up {
    animation: fade-up 0.3s var(--ease-out) both;
}

.animate-fade-in {
    animation: fade-in 0.25s var(--ease-out) both;
}

.animate-delay-1 {
    animation-delay: 0.03s;
}
.animate-delay-2 {
    animation-delay: 0.06s;
}
.animate-delay-3 {
    animation-delay: 0.09s;
}
.animate-delay-4 {
    animation-delay: 0.12s;
}
.animate-delay-5 {
    animation-delay: 0.15s;
}

/* ----- Кнопки ----- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.35rem;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    border: 2px solid transparent;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition:
        transform 0.2s var(--ease-out),
        box-shadow 0.25s var(--ease-out),
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgb(22 163 74 / 0.22);
}

.btn:active {
    transform: translateY(0);
}

.btn:focus-visible {
    outline: 2px solid var(--green-500);
    outline-offset: 2px;
}

.btn--primary {
    background: linear-gradient(180deg, var(--green-500) 0%, var(--green-600) 100%);
    color: var(--white);
    border-color: var(--green-700);
    box-shadow: var(--shadow-soft);
}

.btn--primary:hover {
    background: linear-gradient(180deg, #4ade80 0%, var(--green-600) 100%);
}

.btn--outline {
    background: var(--white);
    color: var(--green-800);
    border-color: var(--green-600);
}

.btn--outline:hover {
    background: var(--green-50);
    border-color: var(--green-700);
}

.btn--ghost {
    background: transparent;
    color: var(--gray-700);
    border-color: transparent;
    font-weight: 500;
    box-shadow: none;
}

.btn--ghost:hover {
    background: var(--green-50);
    color: var(--green-800);
    box-shadow: none;
}

.btn--block {
    width: 100%;
}

.btn--sm {
    padding: 0.45rem 1rem;
    font-size: 0.875rem;
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

@media (min-width: 640px) {
    .btn-group--row {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
}

/* ----- Лендинг ----- */
.glow-bg {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(165deg, var(--green-50) 0%, var(--white) 42%, var(--gray-50) 100%);
}

.glow-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 900px 480px at 88% -8%, rgb(34 197 94 / 0.28), transparent 55%),
        radial-gradient(ellipse 700px 400px at -5% 75%, rgb(22 163 74 / 0.14), transparent 50%);
    animation: gentle-pulse 10s ease-in-out infinite;
    pointer-events: none;
}

.site-header {
    border-bottom: 1px solid rgb(22 163 74 / 0.12);
    background: rgb(255 255 255 / 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding-top: env(safe-area-inset-top, 0px);
    animation: fade-in 0.5s ease both;
}

.site-header__inner {
    max-width: 64rem;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    font-size: 1.2rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -0.03em;
    color: var(--green-900);
    transition: color 0.2s ease;
}

.brand:hover {
    color: var(--green-600);
}

.nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.nav form {
    display: inline;
    margin: 0;
}

main {
    flex: 1;
}

.wrap {
    max-width: 64rem;
    margin: 0 auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.hero {
    padding: 3rem 0 4rem;
}

@media (min-width: 640px) {
    .hero {
        padding-top: 3.75rem;
    }
}

.hero__kicker {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--green-700);
}

.hero__title {
    margin: 0.75rem 0 0;
    font-size: clamp(1.85rem, 4.2vw, 2.85rem);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.03em;
    max-width: 40rem;
    color: var(--green-950);
}

.hero__lead {
    margin: 1.35rem 0 0;
    font-size: 1.1rem;
    max-width: 36rem;
    color: var(--gray-700);
    line-height: 1.65;
}

.hero__hint {
    margin: 1rem 0 0;
    font-size: 0.9rem;
    color: var(--gray-500);
}

.features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1.25rem;
}

@media (min-width: 768px) {
    .features {
        grid-template-columns: repeat(3, 1fr);
    }
}

.feature-card {
    border: 1px solid rgb(22 163 74 / 0.15);
    border-radius: var(--radius);
    padding: 1.5rem;
    background: var(--white);
    box-shadow: var(--shadow-soft);
    transition:
        transform 0.3s var(--ease-out),
        box-shadow 0.3s var(--ease-out),
        border-color 0.25s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: rgb(22 163 74 / 0.28);
}

.feature-card h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--green-900);
}

.feature-card p {
    margin: 0.55rem 0 0;
    font-size: 0.92rem;
    color: var(--gray-700);
    line-height: 1.5;
}

.cta-section {
    border-top: 1px solid rgb(22 163 74 / 0.12);
    background: linear-gradient(180deg, var(--green-50) 0%, var(--white) 100%);
    padding: 4rem 0;
    margin-top: 1rem;
}

.cta-section__inner {
    max-width: 40rem;
    margin: 0 auto;
    text-align: center;
    padding: 0 1.5rem;
}

.cta-section h2 {
    margin: 0;
    font-size: clamp(1.45rem, 3vw, 1.9rem);
    font-weight: 700;
    color: var(--green-950);
}

.cta-section__lead {
    margin: 0.85rem auto 0;
    color: var(--gray-700);
    max-width: 28rem;
    line-height: 1.6;
}

.cta-section__actions {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
}

@media (min-width: 640px) {
    .cta-section__actions {
        flex-direction: row;
        justify-content: center;
    }
    .cta-section__actions .btn {
        min-width: 12rem;
    }
}

.site-footer {
    border-top: 1px solid rgb(22 163 74 / 0.1);
    padding: 2rem 1.5rem;
    padding-bottom: max(2rem, env(safe-area-inset-bottom, 0px));
    background: var(--white);
}

.site-footer__inner {
    max-width: 64rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--gray-500);
}

@media (min-width: 640px) {
    .site-footer__inner {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
}

.footer-links a {
    font-weight: 600;
    color: var(--green-800);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.footer-links span {
    margin: 0 0.5rem;
    opacity: 0.45;
}

/* ----- Авторизация ----- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.75rem 1rem;
    background: linear-gradient(145deg, var(--green-50) 0%, var(--white) 45%, var(--green-100) 120%);
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 55% at 50% -15%, rgb(34 197 94 / 0.2), transparent 55%);
    pointer-events: none;
}

.auth-card {
    position: relative;
    width: 100%;
    max-width: 26rem;
    padding: 2rem 1.85rem 2.1rem;
    border-radius: var(--radius);
    background: var(--white);
    border: 1px solid rgb(22 163 74 / 0.16);
    box-shadow: var(--shadow);
}

.auth-card__title {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--green-950);
    animation: fade-up 0.55s var(--ease-out) both;
}

.auth-card__lead {
    margin: 0.55rem 0 0;
    font-size: 0.92rem;
    color: var(--gray-700);
    line-height: 1.55;
    animation: fade-up 0.55s var(--ease-out) both;
    animation-delay: 0.07s;
}

.auth-card .form {
    animation: fade-up 0.55s var(--ease-out) both;
    animation-delay: 0.14s;
}

.auth-card .auth-card__footer {
    animation: fade-in 0.5s var(--ease-out) both;
}

.auth-card .auth-card__footer:nth-of-type(1) {
    animation-delay: 0.22s;
}

.auth-card .auth-card__footer:nth-of-type(2) {
    animation-delay: 0.28s;
}

.form {
    margin-top: 1.65rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.field label,
.field-heading {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--gray-900);
}

.field input[type="text"],
.field input[type="password"],
.field input[type="email"],
.field input[type="number"],
.field input[type="search"],
.field input[type="tel"],
.field input[type="url"],
.field textarea,
.field select {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgb(22 163 74 / 0.22);
    background: var(--white);
    color: var(--gray-900);
    font-size: 1rem;
    font-family: inherit;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.field input:hover,
.field textarea:hover,
.field select:hover {
    border-color: rgb(22 163 74 / 0.35);
}

.field input:focus-visible,
.field textarea:focus-visible,
.field select:focus-visible {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgb(34 197 94 / 0.22);
}

.field__check {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--gray-700);
}

.field__check input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--green-600);
}

.field-error {
    margin: 0.3rem 0 0;
    font-size: 0.875rem;
    color: var(--danger);
}

.field-hint {
    margin: 0.25rem 0 0;
    font-size: 0.8rem;
    color: var(--gray-500);
}

.form__actions {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}

.auth-card__footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--gray-500);
}

.auth-card__footer a {
    font-weight: 700;
    color: var(--green-700);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ----- Flash ----- */
.flash {
    margin: 0;
    padding: 0.85rem 1.35rem;
    font-size: 0.9rem;
    border-bottom: 1px solid rgb(22 163 74 / 0.18);
    background: linear-gradient(90deg, var(--green-100), var(--green-50));
    color: var(--green-950);
    animation: fade-in 0.35s ease;
}

.flash--success {
    border-left: 4px solid var(--green-600);
}

.flash--error {
    background: linear-gradient(90deg, rgb(254 226 226 / 0.9), rgb(254 242 242 / 0.95));
    border-bottom: 1px solid rgb(185 28 28 / 0.22);
    border-left: 4px solid rgb(220 38 38);
    color: rgb(69 10 10);
}

/* ----- Приложение (сайдбар) ----- */
.app-body {
    margin: 0;
    min-height: 100vh;
    background: var(--gray-50);
}

.app-body.theme-app {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
}

.app-body.theme-app > .flash {
    flex-shrink: 0;
}

.app-body.theme-app > .app-shell {
    flex: 1;
    min-height: 0;
    height: auto;
    max-height: none;
}

.app-shell {
    display: flex;
    height: 100dvh;
    min-height: 0;
    max-height: 100dvh;
    overflow: hidden;
}

.sidebar {
    --sb-bg: #ffffff;
    --sb-ink: #1f2433;
    --sb-muted: #737a8c;
    --sb-faint: #a3a9b8;
    --sb-line: #eceef3;
    --sb-hover: #f3f5f9;
    --sb-active: #eef1f6;
    --sb-accent: #12806a;
    width: var(--sidebar-width-expanded);
    height: 100%;
    max-height: 100dvh;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: var(--sb-bg);
    color: var(--sb-ink);
    border-right: 1px solid var(--sb-line);
    font-family: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    transition: var(--transition-sidebar);
}

.sidebar__brand-block {
    padding: 1rem 0.75rem 0.5rem 1rem;
}

.sidebar__brand-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.5rem;
}

.sidebar__brand {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.2rem;
    margin-left: -0.2rem;
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
}

.sidebar__brand-logo {
    flex-shrink: 0;
    width: 2.1rem;
    height: 2.1rem;
    object-fit: contain;
    border-radius: 10px;
}

.sidebar__brand-text {
    display: flex;
    min-width: 0;
    overflow: hidden;
    transition: var(--transition-fade);
}

.sidebar__brand-name {
    font-size: 1.05rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar__toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--sb-faint);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar__toggle:hover {
    background: var(--sb-hover);
    color: var(--sb-ink);
}

.sidebar__toggle:focus-visible,
.sidebar__link:focus-visible,
.sidebar__logout:focus-visible,
.sidebar__brand:focus-visible {
    outline: 2px solid var(--sb-accent);
    outline-offset: 2px;
}

.sidebar__toggle-icon {
    display: block;
}

.sidebar__nav {
    flex: 1;
    min-height: 0;
    padding: 0.5rem 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.sidebar__group {
    flex-shrink: 0;
    margin: 1.1rem 0 0.35rem;
    padding: 0 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--sb-faint);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar__link {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 2.5rem;
    padding: 0 0.75rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--sb-muted);
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar__link:hover {
    background: var(--sb-hover);
    color: var(--sb-ink);
}

.sidebar__link.is-active {
    background: var(--sb-active);
    color: var(--sb-ink);
    font-weight: 600;
}

.sidebar__link.is-active .sidebar__icon {
    color: var(--sb-accent);
}

.sidebar__icon {
    flex: 0 0 1.25rem;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Явные размеры: без них inline-SVG иногда раздувается при flex/wrap или частичной загрузке стилей */
.sidebar .sidebar__link .sidebar__icon-svg {
    width: 1.2rem;
    height: 1.2rem;
    min-width: 1.2rem;
    min-height: 1.2rem;
    max-width: 1.2rem;
    max-height: 1.2rem;
    display: block;
    flex-shrink: 0;
    box-sizing: border-box;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar__label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s var(--ease-out);
}

/* Footer: пользователь + выход */
.sidebar__footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0.75rem 0.75rem;
    padding: 0.6rem 0.5rem 0.6rem 0.6rem;
    border-radius: 16px;
    background: var(--sb-hover);
}

.sidebar__user {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.sidebar__avatar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: #dcf2ea;
    color: var(--sb-accent);
    font-size: 0.8rem;
    font-weight: 600;
}

.sidebar__user-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar__user-name,
.sidebar__user-company {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar__user-name {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.3;
}

.sidebar__user-company {
    font-size: 0.75rem;
    color: var(--sb-muted);
}

.sidebar__logout-form {
    margin: 0;
    flex-shrink: 0;
}

.sidebar__logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--sb-muted);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.sidebar__logout:hover {
    background: var(--sb-bg);
    color: #a11d35;
}

/* Свернутый сайдбар: только иконки */
.app-shell.is-sidebar-collapsed .sidebar {
    width: var(--sidebar-width-collapsed);
}

.app-shell.is-sidebar-collapsed .sidebar__brand-block {
    padding: 1rem 0.5rem 0.5rem;
}

.app-shell.is-sidebar-collapsed .sidebar__brand-row {
    flex-direction: column;
    gap: 0.5rem;
}

.app-shell.is-sidebar-collapsed .sidebar__brand {
    flex: none;
    margin: 0;
}

.app-shell.is-sidebar-collapsed .sidebar__brand-text,
.app-shell.is-sidebar-collapsed .sidebar__user {
    display: none;
}

.app-shell.is-sidebar-collapsed .sidebar__nav {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.app-shell.is-sidebar-collapsed .sidebar__group {
    height: 1px;
    margin: 0.6rem 0.5rem;
    padding: 0;
    background: var(--sb-line);
    font-size: 0;
}

.app-shell.is-sidebar-collapsed .sidebar__label {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    position: absolute;
}

.app-shell.is-sidebar-collapsed .sidebar__link {
    justify-content: center;
    padding: 0;
    gap: 0;
}

.app-shell.is-sidebar-collapsed .sidebar__footer {
    flex-direction: column;
    justify-content: center;
    margin: 0 0.5rem 0.75rem;
    padding: 0.35rem;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    max-height: 100dvh;
    overflow: hidden;
    transition: flex 0.3s var(--ease-out);
}

#app-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.app-topbar {
    display: none;
}

.app-content {
    flex: 1;
    min-height: 0;
    padding: 1.35rem 1.5rem 2.75rem;
    max-width: min(56rem, 100%);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-behavior: auto;
    -webkit-overflow-scrolling: touch;
    animation: fade-up 0.18s var(--ease-out) both;
}

@media (min-width: 1400px) {
    .app-content {
        max-width: min(72rem, 100%);
    }
}

@media (min-width: 1800px) {
    .app-content {
        max-width: min(90rem, 100%);
    }
}

@media (min-width: 2400px) {
    .app-content {
        max-width: min(110rem, 100%);
    }
}

.app-content.is-scroll-locked {
    overflow: hidden !important;
}

/* Прокрутка без видимой полосы (колёсико / тач сохраняются) */
.app-content,
.sidebar__nav,
.unit-modal__dialog {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.app-content::-webkit-scrollbar,
.sidebar__nav::-webkit-scrollbar,
.unit-modal__dialog::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
    background: transparent;
}

.app-content:has(.property-show) {
    max-width: none;
    padding-left: 1rem;
    padding-right: 1rem;
    animation: none;
}

.property-block-workspace__map {
    content-visibility: auto;
    contain-intrinsic-size: auto 12rem;
}

.property-show__narrow {
    max-width: 56rem;
    margin-left: auto;
    margin-right: auto;
}

.property-hero-map {
    width: 100%;
    margin: 0 0 1.75rem;
    padding: 1rem 1.15rem 1.35rem;
    border-radius: var(--radius);
    border: 1px solid rgb(22 163 74 / 0.16);
    background: linear-gradient(180deg, var(--white) 0%, var(--green-50) 120%);
    box-shadow: var(--shadow-soft);
}

.property-hero-map__address {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    color: var(--gray-700);
}

.property-hero-map__lead {
    margin: 0 0 1rem;
    font-size: 0.88rem;
    color: var(--gray-600);
    max-width: 52rem;
}

.app-content__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.35rem;
}

.app-content__title {
    margin: 0;
    font-family: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 1.75rem;
    font-weight: 650;
    letter-spacing: -0.03em;
    color: #1f2433;
}

.app-content__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.app-lead {
    margin: 0 0 1.25rem;
    font-size: 0.95rem;
    color: var(--gray-700);
    max-width: 40rem;
    line-height: 1.55;
}

.app-footer-links {
    margin: 2rem 0 0;
    font-size: 0.9rem;
}

.app-footer-links a {
    font-weight: 600;
    color: var(--green-700);
}

.panel {
    border: 1px solid rgb(22 163 74 / 0.15);
    border-radius: var(--radius);
    padding: 1.35rem 1.45rem 1.6rem;
    background: var(--white);
    box-shadow: var(--shadow-soft);
    max-width: 36rem;
}

.panel--narrow {
    max-width: 26rem;
}

.table-link {
    font-weight: 600;
    color: var(--green-800);
    text-decoration: none;
}

.table-link:hover {
    color: var(--green-600);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.table-actions {
    text-align: right;
    white-space: nowrap;
}

.property-structure {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1.25rem;
}

.structure-block {
    border: 1px solid rgb(22 163 74 / 0.18);
    border-radius: var(--radius);
    padding: 1rem 1.1rem 1.15rem;
    background: rgb(255 255 255 / 0.85);
}

.structure-block__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.structure-block__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--green-950);
}

.structure-floor {
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px dashed rgb(22 163 74 / 0.2);
}

.structure-floor:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.structure-floor__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
}

.structure-floor__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-800);
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: flex-end;
    margin: 0.65rem 0 0;
}

.inline-form .field {
    margin: 0;
    flex: 1 1 8rem;
}

.inline-form .field label {
    font-size: 0.75rem;
}

.inline-form .field input,
.inline-form .field select {
    padding: 0.45rem 0.6rem;
    font-size: 0.875rem;
}

.inline-form--tight {
    gap: 0.35rem;
}

.btn--small {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.btn--danger {
    border-color: rgb(185 28 28 / 0.45);
    color: rgb(127 29 29);
    background: rgb(254 242 242 / 0.9);
}

.btn--danger:hover {
    background: rgb(254 226 226 / 0.95);
    border-color: rgb(185 28 28 / 0.65);
}

.unit-table-wrap {
    overflow-x: auto;
    margin-top: 0.35rem;
}

.property-unit-details[id] {
    scroll-margin-top: 1.25rem;
}

.property-unit-details {
    border: 1px solid rgb(22 163 74 / 0.14);
    border-radius: var(--radius-sm);
    margin-top: 0.35rem;
    background: var(--white);
}

.property-unit-details > summary {
    list-style: none;
    cursor: pointer;
    padding: 0.5rem 0.65rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.85rem;
}

.property-unit-details > summary::-webkit-details-marker {
    display: none;
}

.property-unit-details[open] > summary {
    border-bottom: 1px solid rgb(22 163 74 / 0.1);
}

.property-unit-details__body {
    padding: 0.75rem 0.85rem 0.95rem;
}

.status-pill {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status-pill--available {
    background: #dcf5e9;
    color: #0e6546;
}

.status-pill--reserved {
    background: #ffecd2;
    color: #8a4a06;
}

.status-pill--sold {
    background: #e4e6fd;
    color: #353c9e;
}

.status-pill--occupied {
    background: #eceef3;
    color: #3f4658;
}

.status-pill--installment {
    background: #f1e5fd;
    color: #6a2fae;
}

.status-pill--overdue {
    background: #ffe2e6;
    color: #a11d35;
}

.status-pill--reassignment {
    background: #dcf1fb;
    color: #0c5a80;
}

.status-pill--archived {
    background: #f4f5f7;
    color: #8a90a0;
}

.page-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.object-address {
    margin: 0 0 1rem;
    font-size: 0.95rem;
    color: var(--gray-700);
    line-height: 1.45;
}

.building-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 1.1rem;
    margin: 0 0 1rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgb(22 163 74 / 0.14);
    background: var(--white);
    font-size: 0.78rem;
    color: var(--gray-600);
}

.building-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.building-map-wrap {
    overflow-x: auto;
    margin-bottom: 0;
    padding-bottom: 0.35rem;
    max-width: 100%;
}

.property-hero-map .building-map-wrap {
    overflow-x: auto;
}

.building-map {
    display: grid;
    grid-template-columns: minmax(4.25rem, 5.5rem) repeat(var(--block-count, 1), minmax(0, 1fr));
    gap: 0.45rem;
    align-items: stretch;
    width: 100%;
    min-width: 100%;
}

.floor-kind-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.15rem;
    height: 1.15rem;
    margin: 0 0.25rem 0.15rem 0;
    padding: 0 0.2rem;
    border-radius: 4px;
    font-size: 0.62rem;
    font-weight: 800;
    vertical-align: middle;
    background: rgb(113 63 18 / 0.12);
    color: rgb(113 63 18);
}

.floor-kind-tag {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    vertical-align: middle;
}

.floor-kind-tag--residential {
    background: rgb(220 252 231 / 0.9);
    color: rgb(21 128 61);
}

.floor-kind-tag--commercial {
    background: rgb(254 249 195 / 0.95);
    color: rgb(113 63 18);
}

.ajax-flash {
    margin: 0 0 1rem;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
}

.ajax-flash--ok {
    border: 1px solid rgb(22 163 74 / 0.35);
    background: rgb(240 253 244 / 0.95);
    color: rgb(21 128 61);
}

.ajax-flash--err {
    border: 1px solid rgb(185 28 28 / 0.35);
    background: rgb(254 242 242 / 0.92);
    color: rgb(127 29 29);
}

.ps-h {
    margin: 0 0 0.65rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--green-950);
}

.ps-subh {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
}

.ps-units-floor {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px dashed rgb(22 163 74 / 0.18);
}

.ps-units-floor:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.ps-accordion {
    border: 1px solid rgb(22 163 74 / 0.15);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    background: var(--white);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.ps-accordion__trigger {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 0.75rem;
    padding: 0.75rem 1rem;
    margin: 0;
    border: none;
    background: linear-gradient(180deg, var(--green-50), rgb(255 255 255 / 0.92));
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--green-950);
    cursor: pointer;
    text-align: left;
}

.ps-accordion__title {
    flex: 1 1 auto;
    min-width: 0;
}

.ps-accordion__meta {
    font-size: 0.78rem;
    font-weight: 600;
}

.ps-accordion__panel {
    border-top: 1px dashed rgb(22 163 74 / 0.18);
}

.ps-panel-inner {
    padding: 1rem 1rem 1.15rem;
}

.ps-grid-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
    gap: 0.65rem 1rem;
    margin-bottom: 0.65rem;
}

.ps-slot-rows {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ps-slot-row {
    display: grid;
    grid-template-columns: 2rem minmax(8rem, 1.4fr) minmax(5rem, 0.7fr) minmax(4rem, 0.5fr);
    gap: 0.5rem 0.65rem;
    align-items: end;
    padding: 0.55rem 0.65rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgb(22 163 74 / 0.12);
    background: var(--gray-50);
}

.ps-slot-row--floor {
    grid-template-columns: 2rem minmax(7rem, 1.2fr) minmax(4.5rem, 0.6fr) minmax(3.5rem, 0.45fr) auto;
}

.ps-floor-unit-delete {
    align-self: end;
    margin-bottom: 0.1rem;
    white-space: nowrap;
    font-size: 0.72rem;
    padding: 0.35rem 0.5rem;
}

.ps-slot-row__pos {
    font-size: 0.75rem;
    font-weight: 700;
    padding-bottom: 0.45rem;
}

.field--grow {
    min-width: 0;
}

.ps-naming-section {
    margin: 0.75rem 0;
    border: 1px solid rgb(22 163 74 / 0.14);
    border-radius: var(--radius-sm);
    background: var(--white);
}

.ps-naming-section__title {
    cursor: pointer;
    padding: 0.6rem 0.85rem;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--green-900);
}

.ps-naming-section__body {
    padding: 0 0.85rem 0.85rem;
    border-top: 1px dashed rgb(22 163 74 / 0.12);
}

.ps-floor-units {
    margin-bottom: 0.5rem;
    border: 1px solid rgb(22 163 74 / 0.1);
    border-radius: var(--radius-sm);
}

.ps-floor-units__summary {
    cursor: pointer;
    padding: 0.5rem 0.65rem;
    font-weight: 600;
    font-size: 0.85rem;
}

.ps-floor-units__form {
    padding: 0 0.65rem 0.65rem;
}

.ps-floor-units__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.ps-floor-units-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 22rem;
    overflow-y: auto;
}

.ps-danger-zone {
    margin: 0 0 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px dashed rgb(185 28 28 / 0.25);
}

.ps-advanced {
    margin-top: 1rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px dashed rgb(22 163 74 / 0.28);
    background: rgb(248 250 252 / 0.85);
    font-size: 0.88rem;
}

.ps-advanced__body {
    margin-top: 0.65rem;
}

.btn--link {
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    color: var(--green-700);
    font-size: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.btn--link:hover {
    color: var(--green-600);
}

.building-map__corner {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.45rem 0.35rem;
    display: flex;
    align-items: flex-end;
}

.ps-block-card {
    border: 1px solid rgb(22 163 74 / 0.18);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    background: var(--white);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.ps-block-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.85rem 1rem;
    background: linear-gradient(180deg, var(--green-50), var(--white));
    border-bottom: 1px solid rgb(22 163 74 / 0.12);
}

.ps-block-card__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--green-950);
    flex: 1 1 auto;
}

.ps-block-card__delete {
    margin-left: auto;
}

.ps-wizard__steps {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px dashed rgb(22 163 74 / 0.15);
    background: rgb(248 250 252 / 0.6);
}

.ps-wizard__step {
    margin: 0;
    padding: 0.4rem 0.75rem;
    border: 1px solid rgb(22 163 74 / 0.2);
    border-radius: 999px;
    background: var(--white);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.ps-wizard__step:hover {
    border-color: var(--green-500);
    color: var(--green-800);
}

.ps-wizard__step.is-active {
    background: var(--green-600);
    border-color: var(--green-600);
    color: var(--white);
}

.ps-wizard__panels {
    padding: 1rem;
}

.ps-wizard__panel {
    display: none;
}

.ps-wizard__panel.is-active {
    display: block;
}

.ps-wizard__hint {
    margin: 0 0 0.85rem;
    font-size: 0.88rem;
    color: var(--gray-600);
    line-height: 1.5;
}

.ps-wizard__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px dashed rgb(22 163 74 / 0.15);
}

.ps-entrances-manage {
    margin-bottom: 1.25rem;
}
.ps-entrances-manage__title {
    margin: 0 0 0.65rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-800);
}
.ps-entrances-manage__empty {
    margin: 0 0 0.75rem;
    font-size: 0.88rem;
}
.ps-entrances-list {
    list-style: none;
    margin: 0 0 0.85rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.ps-entrances-list__item {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 0.75rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgb(22 163 74 / 0.14);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
}
.ps-entrances-list__rename {
    flex: 1;
    min-width: min(100%, 14rem);
}
.ps-entrances-add {
    margin-top: 0.5rem;
}
.ps-entrance-slots-table-wrap {
    overflow-x: auto;
    margin-top: 0.5rem;
}
.ps-entrance-slots-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.ps-entrance-slots-table th,
.ps-entrance-slots-table td {
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid var(--gray-200);
    text-align: left;
    vertical-align: middle;
}
.ps-entrance-slots-table th {
    font-weight: 600;
    color: var(--gray-700);
    background: var(--gray-50);
}
.ps-entrance-slots-table__pos {
    font-weight: 600;
    white-space: nowrap;
}
.ps-entrance-slots-table__examples {
    font-size: 0.82rem;
}
.ps-entrance-slots-table__select {
    min-width: 10rem;
    max-width: 100%;
}

.ps-layout-section {
    margin-bottom: 1.5rem;
}

.ps-layout-section--floor {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border, #e2e8f0);
}

.ps-layout-section__title {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
    font-weight: 600;
}

.ps-floor-layouts {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.ps-layout-row--floor {
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    padding: 1rem;
}

.ps-layout-row__copy {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.ps-layout-row__copy .field {
    margin: 0;
    min-width: 12rem;
}

.ps-layout-rows {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ps-layout-row {
    padding: 0.75rem;
    border: 1px solid rgb(22 163 74 / 0.14);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
}

.ps-layout-row__head {
    margin-bottom: 0.5rem;
}

.ps-layout-row__nums {
    font-size: 0.78rem;
}

.ps-layout-row__preview {
    margin-bottom: 0.65rem;
    min-height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--white);
    border: 1px dashed rgb(22 163 74 / 0.2);
    overflow: hidden;
}

.ps-layout-row__preview--empty {
    font-size: 0.8rem;
    color: var(--gray-500);
    padding: 0.5rem;
    text-align: center;
}

.ps-layout-row__preview img {
    max-width: 100%;
    max-height: 10rem;
    object-fit: contain;
}

.ps-layout-row__form {
    margin-bottom: 0.5rem;
}

.unit-cell--has-plan {
    position: relative;
    flex-direction: column;
    gap: 0.1rem;
    padding-top: 0.2rem;
}

.unit-cell__plan {
    font-size: 0.55rem;
    font-weight: 800;
    line-height: 1;
    opacity: 0.95;
    letter-spacing: 0.02em;
}

.unit-layout-preview {
    margin: 0.65rem 0 0;
}

.unit-layout-preview img {
    max-width: 100%;
    max-height: 14rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgb(22 163 74 / 0.15);
}

.property-hero-map .building-map__col-head,
.property-hero-map .building-map__row-head {
    font-size: 0.88rem;
}

.building-map__col-head {
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
    padding: 0.4rem 0.35rem 0.35rem;
    background: var(--green-50);
    border: 1px solid rgb(22 163 74 / 0.2);
    border-radius: var(--radius-sm);
    color: var(--green-950);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 0.35rem;
    min-width: 0;
}

.building-map__col-head-name {
    display: block;
    text-align: center;
    line-height: 1.2;
}

.building-map__slot-labels {
    display: grid;
    grid-template-columns: repeat(var(--slot-count, 1), minmax(0, 1fr));
    gap: 0.35rem;
    width: 100%;
}

.building-map__slot-label {
    font-size: 0.62rem;
    font-weight: 700;
    color: rgb(22 101 52 / 0.75);
    text-align: center;
    line-height: 1;
}

.building-map__row-head {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: right;
    padding: 0.35rem 0.4rem;
    color: var(--gray-800);
    border-right: 1px dashed rgb(22 163 74 / 0.2);
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.building-map__cell {
    border: 1px solid rgb(22 163 74 / 0.15);
    border-radius: var(--radius-sm);
    background: rgb(255 255 255 / 0.92);
    min-height: 3.5rem;
    padding: 0.4rem;
    min-width: 0;
}

.building-map__cell--commercial {
    background: rgb(254 249 195 / 0.35);
}

.building-map__units {
    display: grid;
    grid-template-columns: repeat(var(--slot-count, 1), minmax(0, 1fr));
    gap: 0.35rem;
    width: 100%;
    align-items: stretch;
}

.building-map__orphans {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px dashed rgb(234 179 8 / 0.45);
}

.building-map__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    font-size: 0.85rem;
}

.unit-cell {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 2.75rem;
    aspect-ratio: 1;
    max-height: 4.25rem;
    padding: 0.2rem 0.25rem;
    border-radius: 8px;
    font-size: clamp(0.58rem, 0.85vw, 0.72rem);
    font-weight: 700;
    line-height: 1.15;
    text-decoration: none;
    color: rgb(255 255 255 / 0.98);
    text-shadow: 0 1px 1px rgb(0 0 0 / 0.22);
    border: 1px solid rgb(0 0 0 / 0.1);
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        z-index 0s;
}

.building-map__units .unit-cell:hover,
.building-map__units .unit-cell:focus-visible {
    transform: scale(1.04);
    box-shadow: 0 4px 14px rgb(0 0 0 / 0.18);
    z-index: 5;
}

.unit-cell--empty {
    display: block;
    width: 100%;
    min-height: 2.75rem;
    aspect-ratio: 1;
    max-height: 4.25rem;
    padding: 0;
    border-radius: 8px;
    background: repeating-linear-gradient(
        -45deg,
        rgb(248 250 252),
        rgb(248 250 252) 4px,
        rgb(241 245 249) 4px,
        rgb(241 245 249) 8px
    );
    border: 1px dashed rgb(148 163 184 / 0.55);
    box-shadow: none;
    pointer-events: none;
}

.unit-cell__label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.unit-cell__tip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 0.4rem);
    transform: translateX(-50%) translateY(4px);
    z-index: 30;
    min-width: 9.5rem;
    max-width: 14rem;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    background: rgb(15 23 42 / 0.96);
    color: #f8fafc;
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    text-shadow: none;
    box-shadow: 0 8px 24px rgb(15 23 42 / 0.35);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.15s ease,
        transform 0.15s ease,
        visibility 0.15s;
}

.unit-cell__tip::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgb(15 23 42 / 0.96);
}

.unit-cell__tip-title {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
}

.unit-cell__tip-meta {
    display: block;
    color: rgb(226 232 240);
}

.unit-cell__tip-extra {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.65rem;
    color: rgb(134 239 172);
}

.unit-cell:hover .unit-cell__tip,
.unit-cell:focus-visible .unit-cell__tip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.unit-cell--tiny {
    min-width: 0.75rem;
    min-height: 0.75rem;
    max-height: none;
    aspect-ratio: 1;
    padding: 0;
    border-radius: 3px;
    text-shadow: none;
}

.unit-cell--tiny.unit-cell--empty {
    display: inline-block;
    width: 0.85rem;
    min-height: 0.85rem;
}

.building-legend__item--hint {
    color: var(--gray-600);
    font-size: 0.82rem;
}

.unit-cell--tiny .unit-cell__label {
    display: none;
}

.unit-cell--available {
    background: #22c55e;
    color: #052e16;
    text-shadow: none;
    border-color: rgb(21 128 61 / 0.35);
}

.unit-cell--reserved {
    background: #3b82f6;
}

.unit-cell--sold {
    background: #ef4444;
}

.unit-cell--installment {
    background: #eab308;
    color: #422006;
    text-shadow: none;
    border-color: rgb(161 98 7 / 0.4);
}

.unit-cell--overdue {
    background: #171717;
    color: #fafafa;
}

.unit-cell--reassignment {
    background: #a855f7;
}

.unit-cell--archived {
    background: #64748b;
    color: #f8fafc;
}

.structure-panel {
    margin-top: 0.5rem;
    border: 1px solid rgb(22 163 74 / 0.18);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow-soft);
}

.structure-panel__summary {
    cursor: pointer;
    padding: 0.85rem 1rem;
    font-weight: 700;
    color: var(--green-900);
    list-style: none;
}

.structure-panel__summary::-webkit-details-marker {
    display: none;
}

.structure-panel__summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 0.5rem;
    transition: transform 0.2s ease;
}

.structure-panel[open] .structure-panel__summary::before {
    transform: rotate(90deg);
}

.structure-panel__body {
    padding: 0 1rem 1.15rem;
    border-top: 1px dashed rgb(22 163 74 / 0.18);
}

.table-addr {
    font-size: 0.82rem;
    max-width: 16rem;
}

.info-grid {
    display: grid;
    gap: 1rem;
    border: 1px solid rgb(22 163 74 / 0.12);
    border-radius: var(--radius);
    padding: 1.5rem;
    background: var(--white);
    box-shadow: var(--shadow-soft);
}

.field textarea {
    min-height: 4rem;
    resize: vertical;
}

.mini-dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 1rem;
    margin: 0;
    font-size: 0.85rem;
}

.mini-dl dt {
    margin: 0;
    font-weight: 600;
    color: var(--gray-600);
}

.mini-dl dd {
    margin: 0;
    color: var(--gray-900);
}

@media (min-width: 640px) {
    .info-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.info-item dt {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--green-700);
}

.info-item dd {
    margin: 0.35rem 0 0;
    font-weight: 600;
    color: var(--gray-900);
}

.info-item dd.mono,
.data-table .mono,
.mono {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 0.88rem;
}

.data-table-wrap {
    overflow-x: auto;
    margin-top: 0.5rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th,
.data-table td {
    border: 1px solid rgb(22 163 74 / 0.12);
    padding: 0.55rem 0.7rem;
    text-align: left;
    vertical-align: top;
}

.data-table th {
    background: var(--green-50);
    font-weight: 700;
    color: var(--green-900);
}

.data-table .muted,
.muted {
    color: var(--gray-500);
    font-size: 0.85rem;
}

.empty-hint {
    margin-top: 1rem;
    padding: 1.1rem;
    border: 1px dashed rgb(22 163 74 / 0.35);
    border-radius: var(--radius-sm);
    color: var(--gray-600);
    font-size: 0.9rem;
    background: var(--green-50);
}

/* ----- Список объектов: карточки-здания ----- */
.app-content:has(.properties-index),
.app-content:has(.property-hub-v2),
.app-content:has(.block-editor) {
    max-width: none;
    width: 100%;
    padding-left: clamp(1rem, 2vw, 2rem);
    padding-right: clamp(1rem, 2vw, 2rem);
}

.properties-index__lead {
    max-width: 40rem;
}

.properties-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    gap: 1.35rem;
}

.properties-grid__item {
    margin: 0;
    min-width: 0;
}

.property-building-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius);
    border: 1px solid rgb(22 163 74 / 0.2);
    background: linear-gradient(180deg, var(--white) 0%, var(--green-50) 100%);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    transition:
        transform 0.25s var(--ease-out),
        box-shadow 0.25s var(--ease-out),
        border-color 0.2s ease;
}

.property-building-card:hover {
    transform: translateY(-4px);
    border-color: rgb(22 163 74 / 0.45);
    box-shadow: 0 12px 28px rgb(22 101 52 / 0.18);
}

.property-building-card:focus-visible {
    outline: 3px solid var(--green-500);
    outline-offset: 3px;
}

.property-building-card__roof {
    position: relative;
    height: 1.1rem;
    background: linear-gradient(90deg, var(--green-800), var(--green-600));
}

.property-building-card__roof-cap {
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 0.65rem solid transparent;
    border-right: 0.65rem solid transparent;
    border-top: 0.45rem solid var(--green-700);
}

.property-building-card__facade {
    position: relative;
    padding: 1rem 1rem 0.85rem;
    background: linear-gradient(180deg, rgb(240 253 244 / 0.5) 0%, rgb(255 255 255 / 0.9) 100%);
    border-bottom: 1px solid rgb(22 163 74 / 0.12);
    min-height: 7.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.property-building-card__windows {
    display: grid;
    grid-template-columns: repeat(var(--window-cols, 3), 1.35rem);
    grid-template-rows: repeat(var(--window-rows, 2), 1.1rem);
    gap: 0.35rem;
    margin-bottom: 0.65rem;
    justify-content: center;
}

.property-building-card__window {
    display: block;
    border-radius: 3px;
    background: linear-gradient(145deg, rgb(186 230 253 / 0.85), rgb(34 197 94 / 0.35));
    border: 1px solid rgb(22 163 74 / 0.25);
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.5);
}

.property-building-card:hover .property-building-card__window {
    background: linear-gradient(145deg, rgb(254 249 195 / 0.9), rgb(74 222 128 / 0.55));
}

.property-building-card__door {
    display: block;
    width: 1.5rem;
    height: 2rem;
    border-radius: 3px 3px 0 0;
    background: linear-gradient(180deg, var(--green-700), var(--green-900));
    border: 1px solid rgb(5 46 22 / 0.35);
}

.property-building-card__info {
    flex: 1;
    padding: 1rem 1.1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.property-building-card__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--green-950);
    line-height: 1.3;
}

.property-building-card__address {
    margin: 0;
    font-size: 0.82rem;
    color: var(--gray-600);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.property-building-card__stats {
    margin: 0.35rem 0 0;
    display: grid;
    gap: 0.35rem;
    font-size: 0.78rem;
}

.property-building-card__stats > div {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.35rem 0.65rem;
    align-items: baseline;
}

.property-building-card__stats dt {
    margin: 0;
    font-weight: 600;
    color: var(--gray-500);
}

.property-building-card__stats dd {
    margin: 0;
    font-weight: 600;
    color: var(--gray-800);
}

.property-building-card__blocks dd {
    font-weight: 500;
    font-size: 0.75rem;
}

.property-building-card__cta {
    margin-top: auto;
    padding-top: 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--green-700);
    opacity: 0;
    transform: translateY(4px);
    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}

.property-building-card:hover .property-building-card__cta,
.property-building-card:focus-visible .property-building-card__cta {
    opacity: 1;
    transform: translateY(0);
}

/* ----- Объект: выбор подъезда ----- */
.app-content:has(.property-hub) {
    max-width: none;
}

.property-hub__flash {
    margin-bottom: 1rem;
}

.property-hub__hero {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 2rem;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    padding: 1.35rem 1.5rem;
    border-radius: var(--radius);
    border: 1px solid rgb(22 163 74 / 0.18);
    background: linear-gradient(135deg, var(--green-50) 0%, var(--white) 55%, var(--gray-50) 100%);
    box-shadow: var(--shadow-soft);
}

.property-hub__eyebrow {
    margin: 0 0 0.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--green-700);
}

.property-hub__name {
    margin: 0;
    font-size: clamp(1.35rem, 3vw, 1.85rem);
    font-weight: 800;
    color: var(--green-950);
    letter-spacing: -0.02em;
}

.property-hub__address {
    margin: 0.35rem 0 0;
    font-size: 0.9rem;
    color: var(--gray-600);
}

.property-hub__lead {
    margin: 0.75rem 0 0;
    font-size: 0.9rem;
    color: var(--gray-700);
    max-width: 32rem;
    line-height: 1.5;
}

.property-hub__hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
}

.property-hub__stat {
    text-align: center;
    min-width: 4.5rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    background: rgb(255 255 255 / 0.85);
    border: 1px solid rgb(22 163 74 / 0.15);
}

.property-hub__stat-value {
    display: block;
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--green-800);
    line-height: 1.1;
}

.property-hub__stat-label {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.property-hub__add {
    margin-bottom: 1.5rem;
    max-width: 28rem;
}

.property-hub__add-title {
    margin: 0 0 0.65rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--green-900);
}

.block-hub-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 1.25rem;
}

.block-hub-grid__item {
    margin: 0;
    min-width: 0;
}

.block-tower-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius);
    border: 1px solid rgb(22 163 74 / 0.22);
    background: var(--white);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    position: relative;
    transition:
        transform 0.25s var(--ease-out),
        box-shadow 0.25s var(--ease-out),
        border-color 0.2s ease;
}

.block-tower-card:hover {
    transform: translateY(-5px);
    border-color: rgb(22 163 74 / 0.5);
    box-shadow: 0 14px 32px rgb(22 101 52 / 0.2);
}

.block-tower-card:focus-visible {
    outline: 3px solid var(--green-500);
    outline-offset: 3px;
}

.block-tower-card__badge {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    z-index: 2;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--white);
    background: linear-gradient(145deg, var(--green-500), var(--green-800));
    box-shadow: 0 2px 8px rgb(22 101 52 / 0.35);
}

.block-tower-card__tower {
    padding: 1.25rem 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(180deg, rgb(186 230 253 / 0.25) 0%, rgb(240 253 244 / 0.6) 100%);
}

.block-tower-card__tower-body {
    display: flex;
    flex-direction: column-reverse;
    gap: 0.2rem;
    width: 100%;
    max-width: 5.5rem;
}

.block-tower-card__floor {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.2rem 0.35rem;
    border-radius: 4px;
    background: rgb(255 255 255 / 0.65);
    border: 1px solid rgb(22 163 74 / 0.12);
}

.block-tower-card__window {
    width: 0.65rem;
    height: 0.75rem;
    border-radius: 2px;
    background: linear-gradient(160deg, rgb(186 230 253), rgb(34 197 94 / 0.4));
    border: 1px solid rgb(22 163 74 / 0.2);
}

.block-tower-card:hover .block-tower-card__window {
    background: linear-gradient(160deg, rgb(254 249 195), rgb(74 222 128 / 0.65));
}

.block-tower-card__base {
    display: block;
    width: 6rem;
    height: 0.45rem;
    margin-top: 0.35rem;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--green-800), var(--green-600));
}

.block-tower-card__info {
    padding: 0.85rem 1rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border-top: 1px solid rgb(22 163 74 / 0.1);
}

.block-tower-card__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--green-950);
}

.block-tower-card__meta {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--green-800);
}

.block-tower-card__hint {
    margin: 0.15rem 0 0;
    font-size: 0.72rem;
    color: var(--gray-500);
    line-height: 1.35;
}

.property-block-page__title-wrap {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem;
}

.property-block-page__back {
    font-weight: 600;
    color: var(--green-700);
    text-decoration: none;
}

.property-block-page__back:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.property-block-page__sep {
    color: var(--gray-500);
    font-weight: 400;
}

.check-list {
    list-style: none;
    margin: 0;
    padding: 0.7rem;
    max-height: 14rem;
    overflow: auto;
    border: 1px solid rgb(22 163 74 / 0.18);
    border-radius: var(--radius-sm);
    background: var(--white);
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.check-list label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 400;
    font-size: 0.9rem;
}

.check-list input {
    margin-top: 0.2rem;
    accent-color: var(--green-600);
}

/* ── Mobile / tablet topbar + drawer nav (<=1024px, iPad и телефоны) ── */
.mobile-topbar {
    display: none;
}

.mobile-backdrop {
    display: none;
}

@media (max-width: 1024px) {
    .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        position: sticky;
        top: 0;
        z-index: 100;
        min-height: 3rem;
        padding: 0.5rem 0.75rem;
        padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
        padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
        padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
        background: #ffffff;
        color: #1f2433;
        border-bottom: 1px solid #eceef3;
        box-sizing: border-box;
        font-family: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    }

    .mobile-topbar__burger {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2.75rem;
        height: 2.75rem;
        flex-shrink: 0;
        padding: 0;
        border: none;
        border-radius: 12px;
        background: transparent;
        color: #1f2433;
        cursor: pointer;
        transition: background 0.15s;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-topbar__burger:active {
        background: #f3f5f9;
    }

    .mobile-topbar__brand {
        display: flex;
        align-items: center;
        gap: 0.45rem;
        text-decoration: none;
        color: inherit;
        flex: 1;
        min-width: 0;
    }

    .mobile-topbar__logo {
        width: 1.75rem;
        height: 1.75rem;
        flex-shrink: 0;
        object-fit: contain;
        border-radius: 6px;
    }

    .mobile-topbar__name {
        font-size: 1rem;
        font-weight: 650;
        letter-spacing: -0.02em;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 199;
        background: rgb(31 36 51 / 0.28);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.28s ease, visibility 0.28s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .app-shell.is-mobile-nav-open .mobile-backdrop {
        opacity: 1;
        visibility: visible;
    }

    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 200;
        width: 17rem !important;
        max-height: none;
        flex-direction: column;
        flex-wrap: nowrap;
        border-right: 0;
        border-radius: 0 24px 24px 0;
        box-shadow: 0 30px 80px rgb(31 36 51 / 0.2);
        border-bottom: none;
        transform: translateX(-110%);
        transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .app-shell.is-mobile-nav-open .sidebar {
        transform: translateX(0);
    }

    .app-shell.is-sidebar-collapsed .sidebar {
        width: 17rem !important;
    }

    .app-shell.is-sidebar-collapsed .sidebar__brand-text,
    .app-shell.is-sidebar-collapsed .sidebar__label,
    .app-shell.is-sidebar-collapsed .sidebar__logout .sidebar__label {
        opacity: 1 !important;
        max-width: none !important;
        max-height: none !important;
        position: static !important;
        overflow: visible !important;
        pointer-events: auto !important;
    }

    .app-shell.is-sidebar-collapsed .sidebar__link {
        justify-content: flex-start;
        gap: 0.75rem;
        padding: 0 0.75rem;
    }

    .app-shell.is-sidebar-collapsed .sidebar__user,
    .app-shell.is-sidebar-collapsed .sidebar__brand-text {
        display: flex;
    }

    .app-shell.is-sidebar-collapsed .sidebar__group {
        height: auto;
        margin: 1.1rem 0 0.35rem;
        padding: 0 0.75rem;
        background: none;
        font-size: 0.75rem;
    }

    .app-shell.is-sidebar-collapsed .sidebar__brand-row {
        flex-direction: row;
    }

    .app-shell.is-sidebar-collapsed .sidebar__footer {
        justify-content: flex-start;
        margin: 0 0.75rem 0.75rem;
        padding: 0.6rem 0.5rem 0.6rem 0.6rem;
    }

    .sidebar__toggle {
        display: none;
    }

    .sidebar__nav {
        flex-direction: column;
        flex-wrap: nowrap;
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .sidebar__link {
        min-height: 2.75rem;
    }

    .app-topbar {
        display: none;
    }

    .app-main {
        flex: 1;
        min-height: 0;
    }

    .app-content {
        max-width: none;
    }

    .sidebar {
        padding-top: env(safe-area-inset-top, 0px);
    }
}

/* —— Квартира: модалка и страница просмотра —— */
.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;
}

.unit-cell {
    cursor: pointer;
    font-family: inherit;
    appearance: none;
}

body.unit-modal-open {
    overflow: hidden;
}

/* Карточка квартиры: боковая панель справа, на телефоне — шторка снизу */
.unit-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    justify-content: flex-end;
    align-items: stretch;
    padding: 0.75rem;
    box-sizing: border-box;
    overflow: hidden;
    font-family: var(--cb-font);
    color: var(--cb-ink);
}

.unit-modal[hidden] {
    display: none !important;
}

.unit-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgb(31 36 51 / 0.28);
    animation: unit-modal-fade 0.2s ease-out;
}

.unit-modal__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(32rem, 100%);
    max-height: 100%;
    overflow: auto;
    border-radius: 28px;
    background: var(--cb-surface);
    box-shadow: 0 30px 80px rgb(31 36 51 / 0.25);
    animation: unit-drawer-in 0.28s cubic-bezier(0.2, 0.9, 0.2, 1);
}

@keyframes unit-modal-fade {
    from { opacity: 0; }
}

@keyframes unit-drawer-in {
    from {
        opacity: 0;
        transform: translateX(2rem);
    }
}

.unit-modal__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgb(255 255 255 / 0.75);
    color: var(--cb-ink);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.unit-modal__close:hover {
    background: var(--cb-surface);
}

.unit-modal__close:focus-visible {
    outline: 2px solid var(--cb-accent);
    outline-offset: 2px;
}

.unit-modal__body {
    flex: 1;
    padding: 0.5rem;
}

.unit-modal-alert {
    margin: 1rem 1rem 0;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    font-size: 0.9rem;
}

.unit-modal-alert--ok {
    background: #dcf5e9;
    color: #0e6546;
}

.unit-modal-alert--err {
    background: #ffe2e6;
    color: #a11d35;
}

.unit-modal-panel {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.unit-modal-panel__actions {
    position: sticky;
    bottom: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
    padding: 1rem 1rem 0.75rem;
    background: linear-gradient(to top, var(--cb-surface) 75%, rgb(255 255 255 / 0));
}

.unit-modal-panel__actions .btn {
    border-radius: 999px;
}

.unit-modal-panel--edit {
    padding: 1.25rem 1rem 0;
}

.unit-modal-panel__edit-head {
    margin-bottom: 1.25rem;
    padding-right: 3rem;
}

.unit-modal-panel__edit-label {
    margin: 0;
    font-size: 0.9rem;
    color: var(--cb-muted);
}

.unit-modal-panel__edit-title {
    margin: 0.2rem 0 0;
    font-size: 1.75rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.unit-modal-form__section {
    margin-bottom: 1.25rem;
}

.unit-modal-form__section-title {
    margin: 0 0 0.65rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.unit-modal-panel__delete {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--cb-line);
}

/* Unit detail: цветная шапка статуса + факты + секции */
.unit-detail {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.unit-detail__hero {
    --hero-bg: #eceef3;
    --hero-ink: #3f4658;
    --hero-dot: #8d95a8;
    padding: 1.5rem 1.25rem 1.35rem;
    padding-right: 4rem;
    border-radius: 22px;
    background: var(--hero-bg);
    color: var(--hero-ink);
}

.unit-detail__hero--available { --hero-bg: #dcf5e9; --hero-ink: #0e6546; --hero-dot: #2bb07f; }
.unit-detail__hero--reserved { --hero-bg: #ffecd2; --hero-ink: #8a4a06; --hero-dot: #f2a33a; }
.unit-detail__hero--sold { --hero-bg: #e4e6fd; --hero-ink: #353c9e; --hero-dot: #6b74e8; }
.unit-detail__hero--installment { --hero-bg: #f1e5fd; --hero-ink: #6a2fae; --hero-dot: #a769e6; }
.unit-detail__hero--overdue { --hero-bg: #ffe2e6; --hero-ink: #a11d35; --hero-dot: #ef5b73; }
.unit-detail__hero--reassignment { --hero-bg: #dcf1fb; --hero-ink: #0c5a80; --hero-dot: #2aa6d9; }
.unit-detail__hero--archived { --hero-bg: #f4f5f7; --hero-ink: #8a90a0; --hero-dot: #c2c7d1; }

.unit-detail__eyebrow {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.8;
}

.unit-detail__number {
    margin: 0.25rem 0 0.9rem;
    font-family: var(--cb-font);
    font-size: 2rem;
    font-weight: 650;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.unit-detail__status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.8rem 0.35rem 0.65rem;
    border-radius: 999px;
    background: rgb(255 255 255 / 0.7);
    font-size: 0.85rem;
    font-weight: 500;
}

.unit-detail__status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--hero-dot);
}

.unit-detail__facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
    gap: 0.5rem;
    margin: 0;
}

.unit-detail__fact {
    padding: 0.9rem 1rem;
    border-radius: 18px;
    background: var(--cb-mist);
}

.unit-detail__fact--wide {
    grid-column: span 2;
}

.unit-detail__fact dt {
    font-size: 0.8rem;
    color: var(--cb-muted);
}

.unit-detail__fact dd {
    margin: 0.2rem 0 0;
    font-size: 1.35rem;
    font-weight: 650;
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.unit-detail__fact dd small {
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--cb-muted);
}

.unit-detail__fact-note {
    margin: 0.2rem 0 0;
    font-size: 0.78rem;
    color: var(--cb-muted);
}

.unit-detail__section {
    padding: 1.1rem 1rem 0.5rem;
}

.unit-detail__section-title {
    margin: 0 0 0.65rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.unit-detail__text {
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
    color: var(--cb-muted);
}

.unit-detail__empty {
    margin: 0;
    padding: 1.1rem;
    border-radius: 16px;
    border: 1.5px dashed var(--cb-line);
    font-size: 0.875rem;
    color: var(--cb-faint);
    text-align: center;
}

.unit-detail__plan {
    margin: 0;
}

.unit-detail__plan img {
    display: block;
    width: 100%;
    max-height: 20rem;
    object-fit: contain;
    border-radius: 16px;
    background: var(--cb-mist);
}

.unit-detail__dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem 1rem;
    margin: 0;
}

.unit-detail__dl dt {
    font-size: 0.8rem;
    color: var(--cb-muted);
}

.unit-detail__dl dd {
    margin: 0.15rem 0 0;
    font-weight: 500;
}

.unit-detail__notes {
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.55;
}

/* Собственники / житель */
.unit-occupancy {
    padding: 1rem;
    border-radius: 18px;
    background: var(--cb-surface);
    box-shadow: inset 0 0 0 1px var(--cb-line);
}

.unit-occupancy__title {
    margin: 0 0 0.7rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.unit-occupancy__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.unit-occupancy__item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.unit-occupancy__item--previous {
    opacity: 0.65;
}

.unit-occupancy__badge {
    flex-shrink: 0;
    order: 2;
    margin-left: auto;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    background: var(--cb-mist);
    color: var(--cb-muted);
}

.unit-occupancy__item--current .unit-occupancy__badge {
    background: #dcf5e9;
    color: #0e6546;
}

.unit-occupancy__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.unit-occupancy__name {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

.unit-occupancy__meta {
    font-size: 0.82rem;
    color: var(--cb-muted);
}

.unit-occupancy__sep {
    opacity: 0.55;
}

.unit-occupancy__phone {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--cb-accent);
    text-decoration: none;
}

.unit-occupancy__phone:hover {
    text-decoration: underline;
}

.unit-occupancy__comment {
    margin: 0.4rem 0 0;
    padding: 0.55rem 0.7rem;
    border-radius: 12px;
    background: var(--cb-mist);
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-size: 0.82rem;
    line-height: 1.45;
}

.unit-occupancy__comment-label {
    font-size: 0.75rem;
    color: var(--cb-muted);
}

.unit-occupancy__comment-text {
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 640px) {
    .unit-modal {
        align-items: flex-end;
        padding: 0;
    }

    .unit-modal__dialog {
        width: 100%;
        max-height: 92dvh;
        border-radius: 26px 26px 0 0;
        animation-name: unit-sheet-in;
    }

    .unit-detail__number {
        font-size: 1.65rem;
    }

    .unit-detail__fact--wide {
        grid-column: auto;
    }
}

@keyframes unit-sheet-in {
    from {
        transform: translateY(2.5rem);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .unit-modal__backdrop,
    .unit-modal__dialog {
        animation: none;
    }
}

.unit-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.4rem;
}

.unit-list-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.65rem;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid rgb(22 163 74 / 0.16);
    border-radius: 8px;
    background: var(--white);
    text-align: left;
    cursor: pointer;
    font: inherit;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.unit-list-card:hover {
    border-color: rgb(22 163 74 / 0.45);
    box-shadow: 0 4px 14px rgb(22 163 74 / 0.1);
}

.unit-list-card__number {
    font-weight: 700;
}

.unit-list-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--muted);
    margin-left: auto;
}

.unit-list-card__plan {
    font-size: 0.65rem;
    font-weight: 800;
    color: rgb(22 101 52);
    border: 1px solid rgb(22 163 74 / 0.35);
    border-radius: 4px;
    padding: 0.1rem 0.25rem;
}

.unit-page-card {
    margin-top: 0.5rem;
    padding: 1.25rem;
    border-radius: var(--radius);
    background: var(--white);
    border: 1px solid rgb(22 163 74 / 0.14);
    box-shadow: var(--shadow-soft);
}

@media (max-width: 560px) {
    .unit-detail__grid {
        grid-template-columns: 1fr;
    }

    .unit-detail__hero {
        flex-direction: column;
    }
}

/* ============================================================ */
/* Property creation wizard & hub v2                            */
/* ============================================================ */
.object-wizard {
    max-width: 36rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.object-wizard__steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}
.object-wizard__step {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 0.9rem;
    background: var(--white);
    border: 1px solid rgb(22 163 74 / 0.14);
    border-radius: var(--radius);
    color: var(--gray-500);
    font-size: 0.9rem;
}
.object-wizard__step--active {
    color: var(--green-900);
    border-color: var(--green-500);
    background: var(--green-50);
    box-shadow: var(--shadow-soft);
}
.object-wizard__step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 50%;
    background: var(--green-100);
    color: var(--green-800);
    font-weight: 700;
}
.object-wizard__step--active .object-wizard__step-num {
    background: var(--green-600);
    color: var(--white);
}
.object-wizard__panel {
    padding: 1.5rem;
}
.object-wizard__head {
    margin-bottom: 1.25rem;
}
.object-wizard__title {
    margin: 0 0 0.35rem;
    font-size: 1.4rem;
}
.object-wizard__lead {
    margin: 0;
    color: var(--gray-500);
}
.object-wizard__form .form__actions {
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Property hub v2 */
.property-hub-v2 {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    max-width: none;
}
.property-hub-v2__flash {
    margin: 0;
}
.property-hub-v2__hero {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.5rem;
    align-items: end;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--green-50), var(--white));
    border: 1px solid rgb(22 163 74 / 0.14);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}
.property-hub-v2__eyebrow {
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--green-700);
    font-weight: 700;
}
.property-hub-v2__name {
    margin: 0.4rem 0 0.3rem;
    font-size: 1.6rem;
    color: var(--green-900);
}
.property-hub-v2__address {
    margin: 0;
    color: var(--gray-500);
}
.property-hub-v2__stats {
    display: grid;
    grid-auto-flow: column;
    gap: 0.6rem;
    margin: 0;
}
.property-hub-v2__stats > div {
    background: var(--white);
    border: 1px solid rgb(22 163 74 / 0.16);
    border-radius: var(--radius-sm);
    padding: 0.7rem 1rem;
    min-width: 5.5rem;
    text-align: center;
    box-shadow: var(--shadow-soft);
}
.property-hub-v2__stats dt {
    margin: 0;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
}
.property-hub-v2__stats dd {
    margin: 0.2rem 0 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--green-900);
}
.property-hub-v2__empty {
    background: var(--white);
    border: 1px dashed rgb(22 163 74 / 0.3);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    align-items: center;
}
.property-hub-v2__empty-title {
    font-weight: 700;
    color: var(--green-900);
    margin: 0;
}
.property-hub-v2__empty-hint {
    color: var(--gray-500);
    margin: 0;
}

/* Block grid v2 */
.block-grid-v2 {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
    gap: 0.9rem;
}

@media (min-width: 720px) {
    .block-grid-v2 {
        grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
        gap: 1rem;
    }
}

@media (min-width: 1200px) {
    .block-grid-v2 {
        grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
    }
}
.block-card-v2 {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.8rem;
    background: var(--white);
    border: 1px solid rgb(22 163 74 / 0.14);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow-soft);
    transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.block-card-v2:hover {
    border-color: var(--green-500);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.block-card-v2__name {
    margin: 0 0 0.25rem;
    font-size: 1.15rem;
    color: var(--green-900);
}
.block-card-v2__meta {
    margin: 0;
    color: var(--gray-500);
    font-size: 0.88rem;
}
.block-card-v2__actions {
    display: flex;
    gap: 0.4rem;
}
.block-card-v2__actions .btn {
    flex: 1;
    justify-content: center;
}

/* Generic Modal (reused) */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 4vh 1rem;
    overflow-y: auto;
}
.modal[hidden] { display: none; }
.modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgb(15 23 42 / 0.55);
    backdrop-filter: blur(2px);
}
.modal__dialog--wide {
    width: min(42rem, 100%);
}
.modal__dialog {
    position: relative;
    z-index: 1;
    width: min(36rem, 100%);
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid rgb(22 163 74 / 0.18);
    box-shadow: 0 22px 60px rgb(15 23 42 / 0.22);
    padding: 1.5rem;
    animation: fade-up 0.18s var(--ease-out);
}
.modal__close {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--gray-500);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
}
.modal__close:hover { color: var(--green-700); background: var(--green-50); }
.modal__head { margin-bottom: 1rem; }
.modal__title { margin: 0 0 0.3rem; font-size: 1.25rem; color: var(--green-900); }
.modal__lead { margin: 0; color: var(--gray-500); }
.modal__form .form__actions { display: flex; gap: 0.5rem; }
.form__actions--right { justify-content: flex-end; }

body.has-modal-open { overflow: hidden; }

/* Field rows / groups */
.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}
.field-group {
    border: 1px solid rgb(22 163 74 / 0.14);
    border-radius: var(--radius-sm);
    padding: 0.8rem 0.9rem 1rem;
    margin: 0;
    background: var(--green-50);
}
.field-group legend {
    padding: 0 0.4rem;
    color: var(--green-900);
    font-weight: 600;
    font-size: 0.9rem;
}
.field-group legend small {
    color: var(--gray-500);
    font-weight: 400;
}
.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.92rem;
    color: var(--gray-700);
}
.checkbox code {
    background: var(--green-50);
    border: 1px solid rgb(22 163 74 / 0.18);
    border-radius: 4px;
    padding: 0.05rem 0.3rem;
    font-size: 0.85em;
}

/* ============================================================ */
/* Block editor (structure page)                                */
/* ============================================================ */
.block-editor {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
    max-width: none;
}

.block-editor__panel {
    border: 1px solid rgb(22 163 74 / 0.15);
    border-radius: var(--radius);
    padding: 1.35rem 1.45rem 1.6rem;
    background: var(--white);
    box-shadow: var(--shadow-soft);
    max-width: none;
    width: 100%;
}
.block-editor__flash { margin: 0; }
.block-editor__hero {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.5rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--green-50), var(--white));
    border: 1px solid rgb(22 163 74 / 0.14);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}
.block-editor__eyebrow {
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--green-700);
    font-weight: 700;
}
.block-editor__title { margin: 0.4rem 0 0.3rem; font-size: 1.5rem; color: var(--green-900); }
.block-editor__lead { margin: 0; color: var(--gray-500); max-width: 52rem; }
.block-editor__stats { display: grid; grid-auto-flow: column; gap: 0.5rem; margin: 0; }
.block-editor__stats > div {
    background: var(--white);
    border: 1px solid rgb(22 163 74 / 0.16);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.9rem;
    min-width: 5rem;
    text-align: center;
}
.block-editor__stats dt {
    margin: 0;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
}
.block-editor__stats dd {
    margin: 0.2rem 0 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--green-900);
}
.block-editor__entrances {
    margin-bottom: 1.5rem;
}
.block-editor__entrances-head {
    margin-bottom: 1rem;
}
.block-editor__entrances-title {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--green-900);
}
.block-editor__entrances-lead {
    margin: 0;
    font-size: 0.88rem;
    color: var(--gray-600);
    line-height: 1.45;
    max-width: 52rem;
}
.block-editor__entrances .ps-entrances-manage:first-of-type {
    margin-top: 0;
}

.block-editor__entrances .ps-entrances-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
}

@media (min-width: 640px) {
    .block-editor__entrances .ps-entrances-list {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
    }
}

@media (min-width: 1100px) {
    .block-editor__entrances .ps-entrances-list {
        grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
    }
}

.block-editor__entrances .ps-entrances-list__item {
    flex-direction: column;
    align-items: stretch;
}

.block-editor__entrances .ps-entrances-list__rename {
    min-width: 0;
    width: 100%;
}

.block-editor__entrances .ps-entrances-add {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
    max-width: none;
}

.block-editor__entrances .ps-entrances-add .field {
    flex: 1 1 14rem;
    min-width: min(100%, 14rem);
}
.unit-row__entrance {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    background: var(--green-50);
    color: var(--green-800);
    border: 1px solid rgb(22 163 74 / 0.2);
}
.floor-card__entrance-hint {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    color: var(--gray-600);
}
.floor-entrance-form__save {
    margin-top: 0.75rem;
}
.unit-rows--floor-entrances {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 12.5rem), 1fr));
}

@media (min-width: 768px) {
    .unit-rows--floor-entrances {
        grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    }
}

@media (min-width: 1200px) {
    .unit-rows--floor-entrances {
        grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
    }
}

@media (min-width: 1600px) {
    .unit-rows--floor-entrances {
        grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
    }
}
.unit-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgb(22 163 74 / 0.14);
    border-radius: var(--radius-sm);
    background: var(--white);
}
.unit-card__open {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    width: 100%;
    padding: 0;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
}
.unit-card__open:hover .unit-card__num {
    color: var(--green-700);
}
.unit-card__num {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--green-900);
}
.unit-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    font-size: 0.8rem;
    color: var(--gray-500);
}
.unit-card__layout {
    font-size: 0.72rem;
    color: var(--green-700);
}
.unit-card__chevron {
    position: absolute;
    right: 0;
    top: 0;
    color: var(--gray-400);
    font-size: 1.1rem;
}
.unit-card__open {
    position: relative;
    padding-right: 1.25rem;
}
.unit-card__entrance {
    margin: 0;
}
.unit-card__entrance label {
    font-size: 0.72rem;
    color: var(--gray-500);
    margin-bottom: 0.2rem;
}
.unit-card__entrance-select {
    width: 100%;
    font-size: 0.85rem;
}
.block-editor__empty {
    background: var(--white);
    border: 1px dashed rgb(22 163 74 / 0.3);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-align: center;
    color: var(--gray-500);
}

/* Floors list */
.floor-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.floor-card {
    background: var(--white);
    border: 1px solid rgb(22 163 74 / 0.14);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}
.floor-list__item--commercial .floor-card {
    background: linear-gradient(0deg, rgb(250 204 21 / 0.06), var(--white));
    border-color: rgb(202 138 4 / 0.25);
}
.floor-card__summary {
    list-style: none;
    cursor: pointer;
    display: grid;
    grid-template-columns: auto auto 1fr auto auto;
    align-items: center;
    gap: 0.8rem;
    padding: 0.85rem 1rem;
    user-select: none;
}

@media (min-width: 900px) {
    .floor-card__summary {
        padding: 0.9rem 1.25rem;
        gap: 1rem 1.25rem;
    }

    .floor-card__body {
        padding: 0 1.25rem 1.15rem;
    }
}
.floor-card__summary::-webkit-details-marker { display: none; }
.floor-card__label {
    font-weight: 700;
    color: var(--green-900);
    font-size: 1.05rem;
}
.floor-card__badge {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    background: var(--green-100);
    color: var(--green-800);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.floor-card__badge--commercial {
    background: rgb(250 204 21 / 0.18);
    color: rgb(133 77 14);
}
.floor-card__count {
    color: var(--gray-500);
    font-size: 0.88rem;
    justify-self: start;
}
.floor-card__plan-btn {
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 2px solid #dc2626;
    background: #fff;
    color: #dc2626;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.floor-card__plan-btn:hover {
    background: rgb(254 226 226);
}
.floor-card__plan-btn--has {
    border-color: var(--green-600);
    color: var(--green-700);
    background: var(--green-50);
}
.floor-card__plan-btn--has:hover {
    background: var(--green-100);
}
.floor-card__plan-icon {
    display: block;
}
.floor-card__toggle {
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--green-50);
    color: var(--green-800);
    font-size: 1.3rem;
    font-weight: 700;
    transition: transform 0.18s ease, background 0.18s ease;
}
.floor-layout-modal__preview {
    margin-bottom: 1rem;
    text-align: center;
}
.floor-layout-modal__img {
    max-width: 100%;
    max-height: 280px;
    border-radius: var(--radius-sm);
    border: 1px solid rgb(22 163 74 / 0.15);
}
.floor-layout-modal__empty {
    margin: 0;
    padding: 1.5rem;
    border: 1px dashed var(--gray-300);
    border-radius: var(--radius-sm);
}
.floor-layout-modal__delete {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgb(22 163 74 / 0.1);
}
.floor-layout-modal__copy-details {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgb(22 163 74 / 0.08);
}
.floor-layout-modal__copy-summary {
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--green-800);
    user-select: none;
}
.floor-layout-modal__copy-details[open] .floor-layout-modal__copy-summary {
    margin-bottom: 0.65rem;
}
.floor-layout-modal__copy .field {
    margin-bottom: 0.5rem;
}
.floor-layout-modal__name {
    margin: 0.35rem 0 0;
    font-size: 0.85rem;
}
.floor-card[open] .floor-card__toggle {
    background: var(--green-600);
    color: var(--white);
    transform: rotate(45deg);
}
.floor-card__body {
    padding: 0 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    border-top: 1px solid rgb(22 163 74 / 0.08);
}
.floor-card__note {
    margin: 0.8rem 0 0;
    padding: 0.6rem 0.8rem;
    background: rgb(250 204 21 / 0.12);
    border-left: 3px solid rgb(202 138 4);
    color: rgb(120 53 15);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
}
.floor-card__toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    margin-top: 0.8rem;
}
.floor-card__delete { margin: 0; margin-left: auto; }
.floor-card__empty {
    margin: 0;
    padding: 1rem;
    text-align: center;
    color: var(--gray-500);
    border: 1px dashed rgb(22 163 74 / 0.2);
    border-radius: var(--radius-sm);
    background: var(--green-50);
}

/* Unit rows on floor */
.unit-rows {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 0.5rem;
}
.unit-row {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    text-align: left;
    background: var(--white);
    border: 1px solid rgb(22 163 74 / 0.14);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    font: inherit;
    color: inherit;
}
.unit-row:hover {
    border-color: var(--green-500);
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}
.unit-row__num {
    font-weight: 700;
    color: var(--green-900);
    min-width: 3rem;
}
.unit-row__meta {
    color: var(--gray-500);
    font-size: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.unit-row__layout {
    background: var(--green-100);
    color: var(--green-800);
    border-radius: 4px;
    padding: 0 0.4rem;
    font-size: 0.75rem;
}
.unit-row__chevron {
    color: var(--green-700);
    font-size: 1.3rem;
}

@media (min-width: 900px) {
    .property-hub-v2__hero,
    .block-editor__hero {
        align-items: center;
    }
}

@media (max-width: 720px) {
    .property-hub-v2__hero,
    .block-editor__hero {
        grid-template-columns: 1fr;
    }
    .property-hub-v2__stats,
    .block-editor__stats {
        grid-auto-flow: column;
        overflow-x: auto;
    }
    .field-row {
        grid-template-columns: 1fr;
    }
    .object-wizard__steps {
        grid-template-columns: 1fr;
    }

    .block-editor__entrances .ps-entrances-list__item {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-end;
    }
}

/* ============================================================ */
/* Dashboard — главная: входная дверь в систему                  */
/* Одна большая карточка «как продаётся», дальше объекты и       */
/* разделы. Без анимаций счётчиков — всё видно сразу.            */
/* ============================================================ */
.app-content:has(.dash) {
    background: var(--cb-mist);
    max-width: none;
    animation: none;
}

.dash {
    max-width: 80rem;
    margin: 0 auto;
    padding: 0.5rem 0 3rem;
    font-family: var(--cb-font);
    color: var(--cb-ink);
}

/* Hero */
.dash-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem 2rem;
    margin-bottom: 1.75rem;
}

.dash-hero__date {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    color: var(--cb-muted);
}

.dash-hero__title {
    margin: 0;
    max-width: 24em;
    font-size: 2.25rem;
    font-weight: 650;
    line-height: 1.15;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

.dash-scope {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.dash-scope__select-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.dash-scope__select {
    appearance: none;
    -webkit-appearance: none;
    height: 2.75rem;
    max-width: 18rem;
    padding: 0 2.5rem 0 1.15rem;
    border: 0;
    border-radius: 999px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--cb-ink);
    text-overflow: ellipsis;
    cursor: pointer;
}

.dash-scope__select:focus-visible {
    outline: 2px solid var(--cb-accent);
    outline-offset: 2px;
}

.dash-scope__chevron {
    position: absolute;
    right: 1rem;
    color: var(--cb-faint);
    pointer-events: none;
}

.dash-scope__blocks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.dash-scope__reset {
    align-self: center;
    margin-left: 0.35rem;
}

.dash-scope__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 2.25rem;
    padding: 0 0.95rem;
    border-radius: 999px;
    background: rgb(255 255 255 / 0.6);
    box-shadow: inset 0 0 0 1px var(--cb-line);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--cb-muted);
    cursor: pointer;
}

.dash-scope__chip.is-active {
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
    color: var(--cb-ink);
}

.dash-scope__chip.is-active::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--cb-accent);
}

.dash-scope__chip:has(input:focus-visible) {
    outline: 2px solid var(--cb-accent);
    outline-offset: 2px;
}

/* Pulse: как продаётся */
.dash-pulse {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
    gap: 2rem 3rem;
    margin-bottom: 1.25rem;
    padding: 2rem 2.25rem 0;
    border-radius: 28px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
}

.dash-pulse__label {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.dash-pulse__rate {
    margin: 0.75rem 0 0;
    line-height: 1;
}

.dash-pulse__rate-num {
    font-size: 5.5rem;
    font-weight: 600;
    letter-spacing: -0.05em;
    font-variant-numeric: tabular-nums;
}

.dash-pulse__rate-unit {
    margin-left: 0.15rem;
    font-size: 2rem;
    font-weight: 500;
    color: var(--cb-faint);
}

.dash-pulse__caption {
    margin: 0.6rem 0 0;
    font-size: 0.95rem;
    color: var(--cb-muted);
}

.dash-pulse__side {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.1rem;
}

.dash-pulse__pair {
    display: flex;
    gap: 2.5rem;
    margin: 0;
}

.dash-pulse__pair dt {
    font-size: 0.9rem;
    color: var(--cb-muted);
}

.dash-pulse__pair dd {
    margin: 0.2rem 0 0;
    font-size: 2rem;
    font-weight: 650;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.dash-pulse__pair-item--free dd {
    color: var(--cb-available-text);
}

.dash-ribbon {
    display: flex;
    gap: 3px;
    height: 0.875rem;
    border-radius: 999px;
    overflow: hidden;
    background: var(--cb-mist);
}

.dash-ribbon--thin {
    height: 0.375rem;
    gap: 2px;
}

.dash-ribbon__seg {
    min-width: 3px;
    background: var(--cb-faint);
}

.chessboard-themed .dash-ribbon__seg--available,
.chessboard-themed .dash-legend__item--available { --dash-c: var(--cb-available-accent); }
.chessboard-themed .dash-ribbon__seg--reserved,
.chessboard-themed .dash-legend__item--reserved { --dash-c: var(--cb-reserved-accent); }
.chessboard-themed .dash-ribbon__seg--sold,
.chessboard-themed .dash-legend__item--sold { --dash-c: var(--cb-sold-accent); }
.chessboard-themed .dash-ribbon__seg--installment,
.chessboard-themed .dash-legend__item--installment { --dash-c: var(--cb-installment-accent); }
.chessboard-themed .dash-ribbon__seg--overdue,
.chessboard-themed .dash-legend__item--overdue { --dash-c: var(--cb-overdue-accent); }
.chessboard-themed .dash-ribbon__seg--reassignment,
.chessboard-themed .dash-legend__item--reassignment { --dash-c: var(--cb-reassignment-accent); }
.chessboard-themed .dash-ribbon__seg--occupied,
.chessboard-themed .dash-legend__item--occupied { --dash-c: var(--cb-occupied-accent); }
.chessboard-themed .dash-ribbon__seg--archived,
.chessboard-themed .dash-legend__item--archived { --dash-c: var(--cb-archived-accent); }

.dash-ribbon__seg {
    background: var(--dash-c, var(--cb-faint));
}

.dash-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dash-legend__item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.9rem;
}

.dash-legend__dot {
    flex-shrink: 0;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--dash-c, var(--cb-faint));
}

.dash-legend__label {
    color: var(--cb-muted);
}

.dash-legend__value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.dash-pulse__facts {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0 -2.25rem;
    padding: 1.1rem 2.25rem 1.3rem;
    border-top: 1px solid var(--cb-line);
}

.dash-pulse__facts > div + div {
    padding-left: 1.5rem;
    border-left: 1px solid var(--cb-line);
}

.dash-pulse__facts dt {
    font-size: 0.85rem;
    color: var(--cb-muted);
}

.dash-pulse__facts dd {
    margin: 0.15rem 0 0;
    font-size: 1.35rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.dash-pulse__empty {
    grid-column: 1 / -1;
    padding: 1rem 0 0.5rem;
}

.dash-pulse__empty-title {
    margin: 0 0 0.4rem;
    font-size: 1.5rem;
    font-weight: 650;
}

.dash-pulse__empty p {
    margin: 0 0 1rem;
    max-width: 32rem;
    color: var(--cb-muted);
}

/* Columns */
.dash-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.dash-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.dash-card {
    padding: 1.5rem;
    border-radius: 24px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
}

.dash-card__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.dash-card__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.dash-card__empty {
    margin: 0;
    color: var(--cb-muted);
}

.dash-link {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--cb-accent);
    text-decoration: none;
}

.dash-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Объекты */
.dash-props {
    display: flex;
    flex-direction: column;
    margin: 0 -0.75rem;
    padding: 0;
    list-style: none;
}

.dash-prop {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.9rem 0.75rem 1rem;
    border-radius: 16px;
    color: inherit;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.dash-props li + li {
    margin-top: 1px;
    box-shadow: 0 -1px 0 var(--cb-line);
}

.dash-prop:hover {
    background: var(--cb-mist);
}

.dash-prop:focus-visible {
    outline: 2px solid var(--cb-accent);
    outline-offset: -2px;
}

.dash-prop__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.dash-prop__name {
    min-width: 0;
    font-size: 1rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-prop__free {
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--cb-muted);
    font-variant-numeric: tabular-nums;
}

.dash-prop__free strong {
    font-weight: 600;
    color: var(--cb-available-text);
}

.dash-prop__addr {
    font-size: 0.85rem;
    color: var(--cb-muted);
}

.dash-prop .dash-ribbon {
    margin-top: 0.5rem;
}

/* Перейти */
.dash-go {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.25rem;
    margin: 0 -0.5rem;
    padding: 0;
    list-style: none;
}

.dash-go__item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 0.5rem;
    border-radius: 16px;
    color: inherit;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.dash-go__item:hover {
    background: var(--cb-mist);
}

.dash-go__item:focus-visible {
    outline: 2px solid var(--cb-accent);
    outline-offset: -2px;
}

.dash-go__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 12px;
    background: var(--cb-mist);
    color: var(--cb-ink);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.dash-go__item:hover .dash-go__icon {
    background: var(--cb-accent-soft);
    color: var(--cb-accent);
}

.dash-go__icon .sidebar__icon-svg {
    width: 1.2rem;
    height: 1.2rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dash-go__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dash-go__label {
    font-size: 0.95rem;
    font-weight: 600;
}

.dash-go__hint {
    font-size: 0.8rem;
    color: var(--cb-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Помещения */
.dash-shops {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: 0 0 1rem;
}

.dash-shops__item dt {
    font-size: 0.85rem;
    color: var(--cb-muted);
}

.dash-shops__item dd {
    margin: 0.2rem 0 0;
    font-size: 1.6rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.dash-shops__item dd small {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--cb-muted);
}

.dash-shops__item--free dd {
    color: var(--cb-available-text);
}

.dash-shops__item p {
    margin: 0.1rem 0 0;
    font-size: 0.8rem;
    color: var(--cb-muted);
}

.dash-shops__pool {
    margin: 0.75rem 0 0;
    font-size: 0.8rem;
    color: var(--cb-muted);
}

/* Responsive */
@media (max-width: 1100px) {
    .dash-columns {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 860px) {
    .dash-pulse {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.5rem;
        padding: 1.5rem 1.35rem 0;
        border-radius: 24px;
    }

    .dash-pulse__facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem 0;
        margin: 0 -1.35rem;
        padding: 1rem 1.35rem 1.2rem;
    }

    .dash-pulse__facts > div:nth-child(3) {
        padding-left: 0;
        border-left: 0;
    }

    .dash-pulse__rate-num {
        font-size: 4.25rem;
    }
}

@media (max-width: 640px) {
    .dash {
        padding-top: 0;
    }

    .dash-hero {
        align-items: flex-start;
        flex-direction: column;
        margin-bottom: 1.25rem;
    }

    .dash-hero__title {
        font-size: 1.65rem;
    }

    .dash-scope {
        justify-content: flex-start;
    }

    .dash-card {
        padding: 1.25rem;
        border-radius: 22px;
    }

    .dash-go {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ============================================================ */
/* Chessboard module (/chessboard)                              */
/* «Дома на участке»: каждый блок — отдельная белая башня на    */
/* мягком туманном фоне, квартиры — пастельные окна.            */
/* ============================================================ */
:root {
    --cb-mist: #eef1f6;
    --cb-surface: #ffffff;
    --cb-ink: #1f2433;
    --cb-muted: #737a8c;
    --cb-faint: #a3a9b8;
    --cb-line: #e6e9f0;
    --cb-accent: #12806a;
    --cb-accent-ink: #0c5d4d;
    --cb-accent-soft: #dcf2ea;
    --cb-lift: 0 1px 2px rgb(31 36 51 / 0.04), 0 10px 30px rgb(31 36 51 / 0.06);
    --cb-font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.app-content:has(.chessboard-page) {
    background: var(--cb-mist);
}

.app-content--sales-full,
.app-content:has(.sales-workspace),
.app-content:has(.chessboard-page),
.app-content:has(.shops-page) {
    max-width: none !important;
    width: 100%;
    min-width: 0;
    padding-left: 1rem;
    padding-right: 1.25rem;
    animation: none;
}

.chessboard-themed {
    font-family: var(--cb-font);
}

.chessboard-page {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
    padding: 0.5rem 0 3rem;
    color: var(--cb-ink);
}

/* Head: объект + поиск */
.cb-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem 2rem;
    margin-bottom: 1.25rem;
}

.cb-head__main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    flex: 1 1 auto;
    min-width: 0;
}

.cb-head__tools {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chessboard-select-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    margin-left: -0.6rem;
    padding: 0.1rem 0.6rem;
    border-radius: 14px;
    transition: background-color 0.15s ease;
}

.chessboard-select-wrap:hover {
    background: rgb(31 36 51 / 0.05);
}

.chessboard-select-wrap:has(.chessboard-select:focus-visible) {
    box-shadow: 0 0 0 2px var(--cb-accent);
}

.chessboard-select-wrap__chevron {
    flex-shrink: 0;
    color: var(--cb-faint);
}

.chessboard-select-label {
    min-width: 0;
    font-size: 2rem;
    font-weight: 650;
    line-height: 1.2;
    letter-spacing: -0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chessboard-select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    font: inherit;
    font-size: 1rem;
    cursor: pointer;
}

.chessboard-select:disabled {
    cursor: default;
}

.chessboard-toolbar__meta {
    margin: 0;
    font-size: 0.95rem;
    color: var(--cb-muted);
}

.chessboard-toolbar__meta:empty {
    display: none;
}

/* Search */
.cb-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.cb-search-wrap__icon {
    position: absolute;
    left: 1rem;
    color: var(--cb-faint);
    pointer-events: none;
}

.cb-search {
    width: 20rem;
    height: 2.875rem;
    padding: 0 2.75rem 0 2.75rem;
    border: 0;
    border-radius: 999px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
    font: inherit;
    font-size: 0.95rem;
    color: var(--cb-ink);
    outline: none;
    transition: box-shadow 0.15s ease;
}

.cb-search::placeholder {
    color: var(--cb-faint);
}

.cb-search::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.cb-search:focus {
    box-shadow: var(--cb-lift), 0 0 0 2px var(--cb-accent);
}

.cb-search-wrap__clear {
    position: absolute;
    right: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--cb-mist);
    color: var(--cb-muted);
    cursor: pointer;
}

.cb-search-wrap__clear[hidden] {
    display: none;
}

.cb-search-wrap__clear:hover {
    color: var(--cb-ink);
}

/* View toggle (mobile) */
.cb-view-toggle {
    display: none;
    gap: 2px;
    padding: 4px;
    border-radius: 999px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
}

.cb-view-toggle__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--cb-faint);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.cb-view-toggle__btn.is-active {
    background: var(--cb-mist);
    color: var(--cb-ink);
}

/* Scope: блоки и подъезды */
.cb-scope {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.cb-scope__row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.cb-scope__row.is-hidden {
    display: none;
}

.cb-scope__label {
    flex: 0 0 5.25rem;
    font-size: 0.875rem;
    color: var(--cb-muted);
}

.cb-scope__actions {
    display: flex;
    gap: 0.15rem;
    flex-shrink: 0;
}

.cb-scope__link {
    padding: 0.35rem 0.6rem;
    border: 0;
    border-radius: 999px;
    background: none;
    font: inherit;
    font-size: 0.85rem;
    color: var(--cb-muted);
    cursor: pointer;
}

.cb-scope__link:hover:not(:disabled) {
    background: rgb(31 36 51 / 0.05);
    color: var(--cb-ink);
}

.cb-scope__link:disabled {
    opacity: 0.4;
    cursor: default;
}

.cb-scope__link[hidden] {
    display: none;
}

.chessboard-chips-scroll {
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.chessboard-chips-scroll::-webkit-scrollbar {
    display: none;
}

.chessboard-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.chessboard-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 2.25rem;
    padding: 0 1rem;
    border: 0;
    border-radius: 999px;
    background: rgb(255 255 255 / 0.6);
    box-shadow: inset 0 0 0 1px var(--cb-line);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--cb-muted);
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.chessboard-chip:hover {
    color: var(--cb-ink);
    background: var(--cb-surface);
}

.chessboard-chip.is-active {
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
    color: var(--cb-ink);
}

.chessboard-chip.is-active::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--cb-accent);
}

.chessboard-chip:focus-visible,
.cb-scope__link:focus-visible,
.cb-filter:focus-visible,
.cb-view-toggle__btn:focus-visible {
    outline: 2px solid var(--cb-accent);
    outline-offset: 2px;
}

/* Stage */
.chessboard-stage {
    position: relative;
    min-height: 12rem;
}

.chessboard-stage__loader {
    display: none;
}

.chessboard-map-panel {
    background: none;
    border: 0;
    padding: 0;
}

/* Summary: лента продаж + фильтры */
.cb-summary {
    margin-bottom: 1.75rem;
    padding: 1.25rem 1.35rem 1.1rem;
    border-radius: 24px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
}

.cb-summary__ribbon {
    display: flex;
    gap: 3px;
    height: 0.625rem;
    margin-bottom: 1.1rem;
    border-radius: 999px;
    overflow: hidden;
    background: var(--cb-mist);
}

.cb-ribbon__seg {
    min-width: 4px;
    background: var(--cb-faint);
    transition: opacity 0.2s ease;
}

.cb-ribbon__seg.is-muted {
    opacity: 0.2;
}

.cb-summary__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
}

.cb-summary__statuses {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.cb-summary__side {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cb-summary__rooms {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.cb-summary__rooms[hidden] {
    display: none;
}

.cb-summary__rooms-label {
    margin-right: 0.3rem;
    font-size: 0.85rem;
    color: var(--cb-muted);
}

.cb-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    height: 2.25rem;
    padding: 0 0.9rem 0 0.8rem;
    border: 0;
    border-radius: 999px;
    background: var(--cb-mist);
    font: inherit;
    font-size: 0.875rem;
    color: var(--cb-ink);
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.cb-filter:hover {
    box-shadow: inset 0 0 0 1px var(--cb-line);
    background: var(--cb-surface);
}

.cb-filter__dot {
    flex-shrink: 0;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--cb-faint);
}

.cb-filter__count {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--cb-muted);
}

.cb-filter[data-count="0"] {
    display: none;
}

.cb-filter--rooms {
    justify-content: center;
    width: 2.25rem;
    padding: 0;
    font-weight: 600;
}

.cb-filter--rooms.is-active {
    background: var(--cb-ink);
    color: var(--cb-surface);
    box-shadow: none;
}

/* Цвета статусов для точек, ленты и активных фильтров */
.chessboard-themed .cb-filter--available { --cb-f-accent: var(--cb-available-accent); --cb-f-bg: var(--cb-available-bg); --cb-f-text: var(--cb-available-text); }
.chessboard-themed .cb-filter--reserved { --cb-f-accent: var(--cb-reserved-accent); --cb-f-bg: var(--cb-reserved-bg); --cb-f-text: var(--cb-reserved-text); }
.chessboard-themed .cb-filter--sold { --cb-f-accent: var(--cb-sold-accent); --cb-f-bg: var(--cb-sold-bg); --cb-f-text: var(--cb-sold-text); }
.chessboard-themed .cb-filter--installment { --cb-f-accent: var(--cb-installment-accent); --cb-f-bg: var(--cb-installment-bg); --cb-f-text: var(--cb-installment-text); }
.chessboard-themed .cb-filter--overdue { --cb-f-accent: var(--cb-overdue-accent); --cb-f-bg: var(--cb-overdue-bg); --cb-f-text: var(--cb-overdue-text); }
.chessboard-themed .cb-filter--reassignment { --cb-f-accent: var(--cb-reassignment-accent); --cb-f-bg: var(--cb-reassignment-bg); --cb-f-text: var(--cb-reassignment-text); }
.chessboard-themed .cb-filter--occupied { --cb-f-accent: var(--cb-occupied-accent); --cb-f-bg: var(--cb-occupied-bg); --cb-f-text: var(--cb-occupied-text); }
.chessboard-themed .cb-filter--archived { --cb-f-accent: var(--cb-archived-accent); --cb-f-bg: var(--cb-archived-bg); --cb-f-text: var(--cb-archived-text); }

.chessboard-themed .cb-filter[data-filter-status] .cb-filter__dot {
    background: var(--cb-f-accent);
}

.chessboard-themed .cb-filter[data-filter-status].is-active {
    background: var(--cb-f-bg);
    color: var(--cb-f-text);
    box-shadow: inset 0 0 0 1.5px var(--cb-f-accent);
}

.chessboard-themed .cb-filter[data-filter-status].is-active .cb-filter__count {
    color: inherit;
}

.chessboard-themed .cb-ribbon__seg--available { background: var(--cb-available-accent); }
.chessboard-themed .cb-ribbon__seg--reserved { background: var(--cb-reserved-accent); }
.chessboard-themed .cb-ribbon__seg--sold { background: var(--cb-sold-accent); }
.chessboard-themed .cb-ribbon__seg--installment { background: var(--cb-installment-accent); }
.chessboard-themed .cb-ribbon__seg--overdue { background: var(--cb-overdue-accent); }
.chessboard-themed .cb-ribbon__seg--reassignment { background: var(--cb-reassignment-accent); }
.chessboard-themed .cb-ribbon__seg--occupied { background: var(--cb-occupied-accent); }
.chessboard-themed .cb-ribbon__seg--archived { background: var(--cb-archived-accent); }

/* Compact legend (sales workspace) */
.cb-legend--compact {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.6rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.cb-legend--compact::-webkit-scrollbar {
    display: none;
}

.cb-legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex: 0 0 auto;
    font-size: 0.75rem;
    color: var(--cb-muted);
    white-space: nowrap;
}

.cb-legend-chip::before {
    content: "";
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.chessboard-themed .cb-legend-chip--available::before { background: var(--cb-available-accent); }
.chessboard-themed .cb-legend-chip--reserved::before { background: var(--cb-reserved-accent); }
.chessboard-themed .cb-legend-chip--occupied::before { background: var(--cb-occupied-accent); }
.chessboard-themed .cb-legend-chip--sold::before { background: var(--cb-sold-accent); }
.chessboard-themed .cb-legend-chip--installment::before { background: var(--cb-installment-accent); }
.chessboard-themed .cb-legend-chip--overdue::before { background: var(--cb-overdue-accent); }
.chessboard-themed .cb-legend-chip--reassignment::before { background: var(--cb-reassignment-accent); }
.chessboard-themed .cb-legend-chip--archived::before { background: var(--cb-archived-accent); }
.chessboard-themed .cb-legend-chip--empty::before {
    background: transparent;
    border: 1.5px dashed var(--cb-empty-border);
}

/* Map: башни */
.chessboard-map-wrap {
    --cb-unit-w: 5.25rem;
    --cb-unit-h: 4rem;
    --cb-unit-gap: 6px;
    --cb-floor-col: 2.5rem;
    --cb-tower-pad: 0.9rem;
    overflow-x: auto;
    overflow-y: visible;
    padding: 0 0 0.75rem;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--cb-faint) transparent;
}

.chessboard-map-wrap::-webkit-scrollbar {
    height: 8px;
}

.chessboard-map-wrap::-webkit-scrollbar-thumb {
    background: var(--cb-faint);
    border-radius: 999px;
}

.chessboard-map {
    display: grid;
    grid-template-columns: var(--cb-floor-col) repeat(var(--block-count, 1), max-content);
    column-gap: 1.25rem;
    row-gap: 0;
    align-items: stretch;
    width: max-content;
    min-width: 100%;
}

.chessboard-map__corner,
.chessboard-map__row-head {
    position: sticky;
    left: 0;
    z-index: 5;
    width: var(--cb-floor-col);
    box-sizing: border-box;
    background: var(--cb-mist);
}

.chessboard-map__corner {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 0.6rem;
    font-size: 0.72rem;
    color: var(--cb-faint);
}

.chessboard-map__col-head {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 1rem var(--cb-tower-pad) 0.7rem;
    border-radius: 24px 24px 0 0;
    background: var(--cb-surface);
    box-sizing: border-box;
    width: calc(var(--slot-count, 1) * (var(--cb-unit-w) + var(--cb-unit-gap)) - var(--cb-unit-gap) + 2 * var(--cb-tower-pad));
    min-width: calc(var(--slot-count, 1) * (var(--cb-unit-w) + var(--cb-unit-gap)) - var(--cb-unit-gap) + 2 * var(--cb-tower-pad));
}

.chessboard-map__block-name {
    font-size: 1.05rem;
    font-weight: 650;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.chessboard-map__entrance-name {
    font-size: 0.85rem;
    color: var(--cb-muted);
}

.chessboard-map__slot-nums {
    display: none;
}

.chessboard-map__row-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.chessboard-map__floor-num {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--cb-muted);
    transition: background-color 0.12s ease, color 0.12s ease;
}

.chessboard-map__floor-sub {
    font-size: 0.62rem;
    color: var(--cb-faint);
}

.chessboard-map__row-head.is-floor-hover .chessboard-map__floor-num {
    background: var(--cb-ink);
    color: var(--cb-surface);
}

.chessboard-map__row-head--muted .chessboard-map__floor-num {
    color: var(--cb-faint);
}

.chessboard-map__cell {
    position: relative;
    z-index: 0;
    padding: calc(var(--cb-unit-gap) / 2) var(--cb-tower-pad);
    background: var(--cb-surface);
    min-height: calc(var(--cb-unit-h) + var(--cb-unit-gap));
    box-sizing: border-box;
    width: calc(var(--slot-count, 1) * (var(--cb-unit-w) + var(--cb-unit-gap)) - var(--cb-unit-gap) + 2 * var(--cb-tower-pad));
    min-width: calc(var(--slot-count, 1) * (var(--cb-unit-w) + var(--cb-unit-gap)) - var(--cb-unit-gap) + 2 * var(--cb-tower-pad));
}

.chessboard-map__cell--last {
    padding-bottom: var(--cb-tower-pad);
    border-radius: 0 0 24px 24px;
}

.chessboard-map__cell:has(.cb-unit:hover:not(.cb-unit--empty)),
.chessboard-map__cell:has(.cb-unit:focus-visible:not(.cb-unit--empty)) {
    z-index: 120;
}

.chessboard-map__ground {
    grid-column: 1 / -1;
    height: 0.5rem;
    margin-top: 0.5rem;
    border-radius: 999px;
    background: #dde2eb;
}

.chessboard-map__cell--commercial {
    background: #faf9fd;
    padding-top: 1.35rem;
}

.chessboard-map__shop-badge {
    position: absolute;
    top: 0.3rem;
    left: var(--cb-tower-pad);
    font-size: 0.68rem;
    color: var(--cb-muted);
}

.chessboard-map__units {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--cb-unit-gap);
}

.chessboard-map__units > .cb-unit,
.chessboard-map__orphans > .cb-unit,
.cb-lot,
.chessboard-map__lots > .cb-lot {
    flex: 0 0 var(--cb-unit-w);
    width: var(--cb-unit-w);
    min-width: var(--cb-unit-w);
    max-width: var(--cb-unit-w);
    height: var(--cb-unit-h);
    min-height: var(--cb-unit-h);
}

.chessboard-map__orphans {
    display: flex;
    flex-wrap: wrap;
    gap: var(--cb-unit-gap);
    margin-top: var(--cb-unit-gap);
    padding-top: var(--cb-unit-gap);
    border-top: 1px dashed var(--cb-line);
}

.chessboard-map__lots {
    display: flex;
    flex-wrap: wrap;
    gap: var(--cb-unit-gap);
    align-content: flex-start;
    max-height: calc(var(--cb-unit-h) * 2 + var(--cb-unit-gap));
    overflow: auto;
}

.chessboard-map__no-floor {
    display: flex;
    align-items: center;
    min-height: var(--cb-unit-h);
    font-size: 0.8rem;
    color: var(--cb-faint);
}

/* Квартира — пастельное окно */
.cb-unit {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    min-width: 0;
    min-height: 4rem;
    padding: 0.45rem 0.55rem;
    border: 0;
    border-radius: 12px;
    background: var(--cb-mist);
    font: inherit;
    text-align: left;
    color: var(--cb-ink);
    cursor: pointer;
    overflow: hidden;
    container-type: inline-size;
    container-name: cb-unit;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s ease;
}

.cb-unit__number {
    max-width: calc(100% - 0.75rem);
    font-size: 0.95rem;
    font-weight: 650;
    line-height: 1.15;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cb-unit__area {
    max-width: 100%;
    font-size: 0.74rem;
    font-weight: 500;
    line-height: 1.3;
    opacity: 0.78;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cb-unit__subline {
    display: flex;
    width: 100%;
    min-width: 0;
    margin-top: auto;
}

.cb-unit__rooms,
.cb-unit__owner {
    max-width: 100%;
    font-size: 0.66rem;
    line-height: 1.3;
    opacity: 0.72;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cb-unit__rooms--placeholder {
    visibility: hidden;
}

.cb-unit__status-label,
.cb-unit__status-bar {
    display: none;
}

/* Метка «есть планировка» — маленький уголок */
.cb-unit__plan {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 0.5rem;
    height: 0.5rem;
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    border-radius: 0 3px 0 0;
    opacity: 0.45;
}

.cb-unit:hover,
.cb-unit:focus-visible {
    outline: none;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--cb-ring, var(--cb-ink)) 55%, transparent);
    z-index: 1;
}

.cb-unit:focus-visible {
    box-shadow: 0 0 0 2px var(--cb-surface), 0 0 0 4px var(--cb-ring, var(--cb-ink));
}

@container cb-unit (max-width: 4rem) {
    .cb-unit__subline {
        display: none;
    }
}

.chessboard-themed .cb-unit--available { background: var(--cb-available-bg); color: var(--cb-available-text); --cb-ring: var(--cb-available-accent); }
.chessboard-themed .cb-unit--reserved { background: var(--cb-reserved-bg); color: var(--cb-reserved-text); --cb-ring: var(--cb-reserved-accent); }
.chessboard-themed .cb-unit--sold { background: var(--cb-sold-bg); color: var(--cb-sold-text); --cb-ring: var(--cb-sold-accent); }
.chessboard-themed .cb-unit--installment { background: var(--cb-installment-bg); color: var(--cb-installment-text); --cb-ring: var(--cb-installment-accent); }
.chessboard-themed .cb-unit--overdue { background: var(--cb-overdue-bg); color: var(--cb-overdue-text); --cb-ring: var(--cb-overdue-accent); }
.chessboard-themed .cb-unit--reassignment { background: var(--cb-reassignment-bg); color: var(--cb-reassignment-text); --cb-ring: var(--cb-reassignment-accent); }
.chessboard-themed .cb-unit--occupied { background: var(--cb-occupied-bg); color: var(--cb-occupied-text); --cb-ring: var(--cb-occupied-accent); }
.chessboard-themed .cb-unit--archived { background: var(--cb-archived-bg); color: var(--cb-archived-text); --cb-ring: var(--cb-archived-accent); }

/* Пустая позиция */
.cb-unit--empty {
    cursor: default;
    pointer-events: none;
}

.chessboard-themed .cb-unit--empty {
    background: transparent;
    box-shadow: inset 0 0 0 1.5px var(--cb-empty-border);
    opacity: 0.6;
}

.cb-unit__empty-slot {
    font-size: 0.7rem;
    color: var(--cb-empty-text);
}

/* Swatches (превью в настройках) */
.cb-unit--legend {
    display: inline-block;
    width: 2.75rem;
    height: 2rem;
    min-height: 0;
    padding: 0;
    border-radius: 10px;
    pointer-events: none;
}

.settings-cb-colors__preview {
    gap: 6px;
}

/* Поиск и фильтры приглушают лишнее */
.cb-unit--search-dim,
.cb-unit--filter-dim {
    opacity: 0.14;
}

.chessboard-themed .cb-unit.cb-unit--search-hit {
    z-index: 10;
    box-shadow: 0 0 0 2px var(--cb-surface), 0 0 0 4px var(--cb-ink);
}

.chessboard-themed .cb-unit.is-selected {
    outline: none;
    box-shadow: 0 0 0 2px var(--cb-surface), 0 0 0 4px var(--cb-ink);
}

/* Tooltip (переносится в body скриптом) */
.cb-unit__tip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 0.6rem);
    transform: translateX(-50%);
    z-index: 2;
    min-width: 12rem;
    max-width: 17rem;
    padding: 0.85rem 0.95rem;
    border-radius: 16px;
    background: var(--cb-surface);
    box-shadow: 0 2px 6px rgb(31 36 51 / 0.06), 0 18px 40px rgb(31 36 51 / 0.16);
    color: var(--cb-muted);
    font-family: var(--cb-font);
    font-size: 0.8rem;
    line-height: 1.5;
    text-align: left;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
}

.cb-unit__tip::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: var(--cb-surface);
}

.cb-unit__tip-title {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 1rem;
    font-weight: 650;
    color: var(--cb-ink);
}

.cb-unit__tip-line {
    display: block;
}

.cb-unit__tip-line--reserve,
.cb-unit__tip-line--resident {
    margin-bottom: 0.2rem;
    font-weight: 500;
    color: var(--cb-ink);
    white-space: pre-wrap;
    word-break: break-word;
}

.cb-unit__tip-note {
    display: block;
    margin-top: 0.5rem;
    padding: 0.45rem 0.6rem;
    border-radius: 10px;
    background: var(--cb-mist);
    color: var(--cb-ink);
}

.cb-unit__tip-hint {
    display: block;
    margin-top: 0.55rem;
    font-size: 0.72rem;
    color: var(--cb-accent);
}

.cb-unit:hover .cb-unit__tip,
.cb-unit:focus-visible .cb-unit__tip {
    opacity: 1;
    visibility: visible;
}

html.js-cb-unit-tips .cb-unit .cb-unit__tip:not(.cb-unit__tip--floating) {
    opacity: 0 !important;
    visibility: hidden !important;
}

.cb-unit__tip--floating {
    opacity: 1 !important;
    visibility: visible !important;
    transition: none;
}

.cb-unit__tip--floating.cb-unit__tip--below::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: var(--cb-surface);
}

/* Skeleton */
.cb-map-skeleton {
    pointer-events: none;
}

.cb-map-skeleton .chessboard-map__col-head,
.cb-map-skeleton .chessboard-map__cell {
    min-height: calc(var(--cb-unit-h) + var(--cb-unit-gap));
}

.cb-map-skeleton__units {
    display: flex;
    gap: var(--cb-unit-gap);
}

.cb-map-skeleton__unit {
    flex: 0 0 var(--cb-unit-w);
    height: var(--cb-unit-h);
    border-radius: 12px;
    background: var(--cb-mist);
    animation: cb-skel-pulse 1.1s ease-in-out infinite alternate;
}

@keyframes cb-skel-pulse {
    from { opacity: 1; }
    to { opacity: 0.5; }
}

/* Empty state */
.chessboard-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
    padding: 4rem 1.5rem;
    border-radius: 24px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
    text-align: center;
}

.chessboard-empty__icon {
    color: var(--cb-faint);
}

.chessboard-empty__text {
    margin: 0;
    max-width: 26rem;
    font-size: 1rem;
    color: var(--cb-muted);
}

/* Список (мобильный) */
.cb-list {
    padding: 0.5rem;
    border-radius: 24px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
}

.cb-list[hidden] {
    display: none;
}

.cb-list__units {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cb-list__unit {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-height: 3.25rem;
    padding: 0.5rem 0.75rem;
    border: 0;
    border-radius: 14px;
    background: transparent;
    font: inherit;
    font-size: 0.95rem;
    text-align: left;
    color: var(--cb-ink);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.cb-list__unit:active {
    background: var(--cb-mist);
}

.cb-list__unit-status {
    flex-shrink: 0;
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 50%;
    background: var(--cb-faint);
}

.cb-list__unit-number {
    min-width: 3.5rem;
    font-weight: 600;
}

.cb-list__unit-rooms {
    font-size: 0.85rem;
    color: var(--cb-muted);
}

.cb-list__unit-area {
    margin-left: auto;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    color: var(--cb-muted);
}

.chessboard-themed .cb-list__unit--available .cb-list__unit-status { background: var(--cb-available-accent); }
.chessboard-themed .cb-list__unit--reserved .cb-list__unit-status { background: var(--cb-reserved-accent); }
.chessboard-themed .cb-list__unit--occupied .cb-list__unit-status { background: var(--cb-occupied-accent); }
.chessboard-themed .cb-list__unit--sold .cb-list__unit-status { background: var(--cb-sold-accent); }
.chessboard-themed .cb-list__unit--installment .cb-list__unit-status { background: var(--cb-installment-accent); }
.chessboard-themed .cb-list__unit--reassignment .cb-list__unit-status { background: var(--cb-reassignment-accent); }
.chessboard-themed .cb-list__unit--overdue .cb-list__unit-status { background: var(--cb-overdue-accent); }
.chessboard-themed .cb-list__unit--archived .cb-list__unit-status { background: var(--cb-archived-accent); }

@media (min-width: 769px) {
    .cb-list {
        display: none !important;
    }
}

/* Палитра по умолчанию (компания может переопределить в настройках) */
.chessboard-themed {
    --cb-available-accent: #2bb07f;
    --cb-available-bg: #dcf5e9;
    --cb-available-bg-end: #c8eedc;
    --cb-available-text: #0e6546;
    --cb-available-border: rgb(43 176 127 / 0.3);
    --cb-available-bar: #2bb07f;
    --cb-available-list-bar: #2bb07f;
    --cb-available-list-label-bg: #dcf5e9;
    --cb-available-list-label-text: #0e6546;

    --cb-reserved-accent: #f2a33a;
    --cb-reserved-bg: #ffecd2;
    --cb-reserved-bg-end: #ffdfb5;
    --cb-reserved-text: #8a4a06;
    --cb-reserved-border: rgb(242 163 58 / 0.3);
    --cb-reserved-bar: #f2a33a;
    --cb-reserved-list-bar: #f2a33a;
    --cb-reserved-list-label-bg: #ffecd2;
    --cb-reserved-list-label-text: #8a4a06;

    --cb-sold-accent: #6b74e8;
    --cb-sold-bg: #e4e6fd;
    --cb-sold-bg-end: #d2d6fb;
    --cb-sold-text: #353c9e;
    --cb-sold-border: rgb(107 116 232 / 0.3);
    --cb-sold-bar: #6b74e8;
    --cb-sold-list-bar: #6b74e8;
    --cb-sold-list-label-bg: #e4e6fd;
    --cb-sold-list-label-text: #353c9e;

    --cb-installment-accent: #a769e6;
    --cb-installment-bg: #f1e5fd;
    --cb-installment-bg-end: #e5d2fb;
    --cb-installment-text: #6a2fae;
    --cb-installment-border: rgb(167 105 230 / 0.3);
    --cb-installment-bar: #a769e6;
    --cb-installment-list-bar: #a769e6;
    --cb-installment-list-label-bg: #f1e5fd;
    --cb-installment-list-label-text: #6a2fae;

    --cb-overdue-accent: #ef5b73;
    --cb-overdue-bg: #ffe2e6;
    --cb-overdue-bg-end: #ffcdd5;
    --cb-overdue-text: #a11d35;
    --cb-overdue-border: rgb(239 91 115 / 0.3);
    --cb-overdue-bar: #ef5b73;
    --cb-overdue-list-bar: #ef5b73;
    --cb-overdue-list-label-bg: #ffe2e6;
    --cb-overdue-list-label-text: #a11d35;

    --cb-reassignment-accent: #2aa6d9;
    --cb-reassignment-bg: #dcf1fb;
    --cb-reassignment-bg-end: #c6e8f8;
    --cb-reassignment-text: #0c5a80;
    --cb-reassignment-border: rgb(42 166 217 / 0.3);
    --cb-reassignment-bar: #2aa6d9;
    --cb-reassignment-list-bar: #2aa6d9;
    --cb-reassignment-list-label-bg: #dcf1fb;
    --cb-reassignment-list-label-text: #0c5a80;

    --cb-occupied-accent: #8d95a8;
    --cb-occupied-bg: #eceef3;
    --cb-occupied-bg-end: #dfe2ea;
    --cb-occupied-text: #3f4658;
    --cb-occupied-border: rgb(141 149 168 / 0.3);
    --cb-occupied-bar: #8d95a8;
    --cb-occupied-list-bar: #8d95a8;
    --cb-occupied-list-label-bg: #eceef3;
    --cb-occupied-list-label-text: #3f4658;

    --cb-archived-accent: #c2c7d1;
    --cb-archived-bg: #f4f5f7;
    --cb-archived-bg-end: #eaecf0;
    --cb-archived-text: #8a90a0;
    --cb-archived-border: rgb(194 199 209 / 0.4);
    --cb-archived-bar: #c2c7d1;
    --cb-archived-list-bar: #c2c7d1;
    --cb-archived-list-label-bg: #f4f5f7;
    --cb-archived-list-label-text: #8a90a0;

    --cb-empty-accent: #c9ced8;
    --cb-empty-bg: #f7f8fa;
    --cb-empty-bg-end: #eef0f4;
    --cb-empty-text: rgb(163 169 184 / 0.9);
    --cb-empty-border: rgb(201 206 216 / 0.9);
    --cb-empty-bar: transparent;
    --cb-empty-list-bar: #c9ced8;
    --cb-empty-list-label-bg: #eef0f4;
    --cb-empty-list-label-text: #737a8c;
}

/* Responsive */
@media (max-width: 768px) {
    .chessboard-page {
        padding-top: 0;
    }

    .cb-head {
        gap: 0.9rem;
        margin-bottom: 1rem;
    }

    .cb-head__main {
        width: 100%;
    }

    .chessboard-select-label {
        font-size: 1.5rem;
    }

    .cb-head__tools {
        width: 100%;
    }

    .cb-search-wrap {
        flex: 1;
        min-width: 0;
    }

    .cb-search {
        width: 100%;
    }

    .cb-view-toggle {
        display: inline-flex;
    }

    .cb-scope__row {
        flex-wrap: wrap;
        gap: 0.4rem 0.5rem;
    }

    .cb-scope__label {
        flex: 1 1 auto;
    }

    .cb-scope__row .chessboard-chips-scroll {
        flex: 1 1 100%;
        order: 3;
    }

    .chessboard-chips {
        flex-wrap: nowrap;
    }

    .chessboard-chip {
        flex-shrink: 0;
    }

    .cb-summary {
        padding: 1rem;
        border-radius: 20px;
        margin-bottom: 1.25rem;
    }

    .cb-summary__statuses {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        margin: 0 -1rem;
        padding: 0 1rem;
    }

    .cb-summary__statuses::-webkit-scrollbar {
        display: none;
    }

    .cb-filter {
        flex-shrink: 0;
    }

    .chessboard-map-wrap {
        --cb-unit-w: 4.4rem;
        --cb-unit-h: 3.5rem;
        --cb-unit-gap: 5px;
        --cb-floor-col: 2.1rem;
        --cb-tower-pad: 0.6rem;
    }

    .chessboard-map {
        column-gap: 0.75rem;
    }

    .chessboard-map__col-head {
        border-radius: 18px 18px 0 0;
    }

    .chessboard-map__cell--last {
        border-radius: 0 0 18px 18px;
    }

    .cb-unit {
        min-height: 3.5rem;
        padding: 0.4rem 0.45rem;
        border-radius: 10px;
    }

    .cb-unit__number {
        font-size: 0.85rem;
    }
}

@media (hover: none) {
    .cb-unit:hover {
        transform: none;
        box-shadow: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cb-map-skeleton__unit {
        animation: none;
    }

    .cb-unit,
    .chessboard-chip,
    .cb-filter,
    .cb-ribbon__seg {
        transition: none;
    }

    .cb-unit:hover {
        transform: none;
    }
}

/* ═══════════════════════════════════════════════════════════
   DOCUMENTS MODULE
   ═══════════════════════════════════════════════════════════ */

/* Full-width documents module (list + editor) */
.app-content--documents-full,
.app-content:has(.doc-page),
.app-content:has(.doce-page) {
    max-width: none !important;
    width: 100%;
    min-width: 0;
    flex: 1;
    animation: none;
}

.app-content--documents-full:not(:has(.doce-page)) {
    padding: 1rem 1.35rem 2rem;
    overflow-x: hidden;
    overflow-y: auto;
}

.app-content:has(.doc-page) {
    padding: 1rem 1.35rem 2rem;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Page */
.doc-page {
    position: relative;
    width: 100%;
    max-width: none;
    min-height: min(100%, 100vh);
    padding: 1.25rem 0 3rem;
    box-sizing: border-box;
}
.doc-page__bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.doc-page__glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: .18;
}
.doc-page__glow--1 {
    width: 600px; height: 600px;
    background: var(--green-400, #4ade80);
    top: -200px; left: -100px;
}
.doc-page__glow--2 {
    width: 500px; height: 500px;
    background: var(--blue-400, #60a5fa);
    bottom: -150px; right: -100px;
}

/* Reveal */
.doc-reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .55s ease, transform .55s ease;
}
.doc-reveal.is-visible { opacity: 1; transform: none; }
.doc-reveal--d1 { transition-delay: .1s; }
.doc-reveal--d2 { transition-delay: .2s; }

/* Hero */
.doc-hero {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    width: 100%;
}
.doc-hero__title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -.03em;
    color: var(--text, #111);
    margin: 0 0 .25rem;
}
.doc-hero__sub {
    color: var(--text-muted, #6b7280);
    font-size: .95rem;
}
.doc-hero__actions {
    display: flex;
    gap: .75rem;
    flex-shrink: 0;
}
.doc-hero__btn svg { margin-right: .35rem; vertical-align: -.15em; }

/* Filter chips */
.doc-filters {
    position: relative;
    z-index: 1;
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
}
.doc-filter-chip {
    padding: .4rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--border, #e5e7eb);
    background: var(--surface, #fff);
    color: var(--text-muted, #6b7280);
    font-size: .85rem;
    cursor: pointer;
    transition: all .2s;
}
.doc-filter-chip:hover {
    border-color: var(--green-400, #4ade80);
    color: var(--text, #111);
}
.doc-filter-chip.is-active {
    background: var(--green-50, #f0fdf4);
    border-color: var(--green-400, #4ade80);
    color: var(--green-700, #15803d);
    font-weight: 600;
}

/* Grid */
.doc-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
    gap: 1.25rem;
    width: 100%;
}

/* Card */
.doc-card {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    transition: box-shadow .25s, border-color .25s, transform .25s;
}
.doc-card:hover {
    box-shadow: 0 8px 32px rgba(0,0,0,.07);
    border-color: var(--green-300, #86efac);
    transform: translateY(-2px);
}
.doc-card__header {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.doc-card__icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--green-50, #f0fdf4);
    border-radius: 12px;
    color: var(--green-600, #16a34a);
}
.doc-card__meta { flex: 1; min-width: 0; }
.doc-card__name {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 .15rem;
    color: var(--text, #111);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.doc-card__date {
    font-size: .8rem;
    color: var(--text-muted, #6b7280);
}
.doc-card__tags {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
}
.doc-tag {
    font-size: .75rem;
    padding: .2rem .65rem;
    border-radius: 999px;
    background: var(--blue-50, #eff6ff);
    color: var(--blue-700, #1d4ed8);
    font-weight: 500;
}
.doc-card__vars {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
}
.doc-var-pill {
    font-size: .72rem;
    padding: .15rem .55rem;
    border-radius: 6px;
    background: rgba(59, 130, 246, .08);
    color: var(--blue-600, #2563eb);
    font-family: monospace;
    white-space: nowrap;
}
.doc-var-pill--more {
    background: var(--border, #e5e7eb);
    color: var(--text-muted, #6b7280);
}
.doc-card__actions {
    display: flex;
    gap: .5rem;
    margin-top: auto;
    padding-top: .5rem;
    border-top: 1px solid var(--border-light, #f3f4f6);
}

/* Empty */
.doc-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
}
.doc-empty__icon {
    color: var(--text-muted, #6b7280);
    opacity: .35;
    margin-bottom: 1rem;
}
.doc-empty__title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text, #111);
    margin: 0 0 .35rem;
}
.doc-empty__text {
    color: var(--text-muted, #6b7280);
    margin-bottom: 1.25rem;
}

/* ── Doc Modals ────────────────────────────────────────── */
.doc-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0,0,0,.45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    backdrop-filter: blur(4px);
}
.doc-modal-overlay.is-open {
    display: flex;
}
.doc-modal {
    background: var(--surface, #fff);
    border-radius: 20px;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0,0,0,.18);
    animation: docModalIn .25s ease;
}
.doc-modal--sm { max-width: 400px; }
.doc-modal--wide { max-width: 800px; }

@keyframes docModalIn {
    from { opacity: 0; transform: translateY(20px) scale(.97); }
    to { opacity: 1; transform: none; }
}

.doc-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border, #e5e7eb);
}
.doc-modal__title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
}
.doc-modal__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted, #6b7280);
    line-height: 1;
}
.doc-modal__body {
    padding: 1.25rem 1.5rem;
}
.doc-modal__hint {
    font-size: .88rem;
    color: var(--text-muted, #6b7280);
    margin: 0 0 1rem;
}
.doc-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border, #e5e7eb);
}

/* Generate var rows */
.doc-gen-vars { display: flex; flex-direction: column; gap: .75rem; }
.doc-gen-var-row { display: flex; align-items: center; gap: .75rem; }
.doc-gen-var-row__label {
    flex-shrink: 0;
    width: 160px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--blue-600, #2563eb);
    font-family: monospace;
    background: rgba(59, 130, 246, .06);
    padding: .3rem .6rem;
    border-radius: 6px;
}
.doc-gen-var-row__input {
    flex: 1;
    padding: .5rem .75rem;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    font-size: .9rem;
    transition: border-color .2s;
}
.doc-gen-var-row__input:focus {
    outline: none;
    border-color: var(--green-400, #4ade80);
    box-shadow: 0 0 0 3px rgba(74,222,128,.15);
}

/* Preview content */
.doc-preview-content {
    background: #fff;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    padding: 20mm 18mm;
    min-height: 300px;
    max-width: 210mm;
    margin: 0 auto;
    font-family: "Times New Roman Tj", "Times New Roman", Times, serif;
    font-size: 12pt;
    line-height: 1.5;
    box-sizing: border-box;
}
.doc-preview-content table {
    border-collapse: collapse;
    width: 100% !important;
    table-layout: fixed;
    margin: .5rem 0;
}
.doc-preview-content th,
.doc-preview-content td {
    border: 1px solid #333;
    padding: 4px 6px;
    text-align: left;
    font-size: inherit;
}
.doc-preview-content * {
    max-width: 100%;
    box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════════
   DOCUMENT EDITOR PAGE (fullscreen)
   ═══════════════════════════════════════════════════════════ */

.app-content--documents-full:has(.doce-page),
.app-content:has(.doce-page) {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.doce-page {
    width: 100%;
    max-width: none;
    --doce-topbar-h: 52px;
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.doce-page__bg {
    display: none;
}

/* Top bar */
.doce-topbar {
    flex-shrink: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .55rem 1rem;
    background: var(--surface, #fff);
    border-bottom: 1px solid var(--border, #e5e7eb);
    gap: 1rem;
    min-height: var(--doce-topbar-h);
}
.doce-topbar__left {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex: 1;
    min-width: 0;
}
.doce-topbar__back {
    flex-shrink: 0;
}
.doce-topbar__back svg {
    vertical-align: -.1em;
    margin-right: .2rem;
}
.doce-topbar__name {
    flex: 1;
    min-width: 0;
    border: 1px solid transparent;
    background: transparent;
    font-size: 1.15rem;
    font-weight: 700;
    padding: .4rem .65rem;
    border-radius: 8px;
    color: var(--text, #111);
    transition: border-color .2s, background .2s;
}
.doce-topbar__name:hover { background: var(--gray-50, #f9fafb); }
.doce-topbar__name:focus {
    outline: none;
    border-color: var(--green-400, #4ade80);
    background: #fff;
}
.doce-topbar__right {
    display: flex;
    gap: .5rem;
    flex-shrink: 0;
    align-items: center;
    flex-wrap: wrap;
}
.doce-topbar__paper {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
}
.doce-topbar__paper-label {
    white-space: nowrap;
}
.doce-topbar__paper-select {
    min-width: 8.5rem;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
}

/* Layout */
.doce-layout {
    flex: 1;
    min-height: 0;
    min-width: 0;
    width: 100%;
    display: flex;
    gap: 0;
    overflow: hidden;
}

/* Sidebar */
.doce-sidebar {
    width: 300px;
    flex-shrink: 0;
    border-right: 1px solid var(--border, #e5e7eb);
    background: var(--gray-50, #f9fafb);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.doce-sidebar__top {
    flex-shrink: 0;
    padding: .75rem;
    display: flex;
    flex-direction: column;
    gap: .65rem;
    overflow-y: auto;
    max-height: 38%;
}
.doce-sidebar__top .doce-panel {
    padding: .85rem 1rem;
}
.doce-panel--compact .doce-purposes {
    max-height: 140px;
    overflow-y: auto;
}
.doce-panel--vars {
    flex: 1;
    min-height: 0;
    margin: 0 .75rem .75rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 14px;
    padding: 1rem 1.15rem;
}
.doce-panel--vars .doce-panel__hint {
    margin-bottom: .5rem;
}
.doce-sidebar-toggle {
    display: none;
}
.doce-panel {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 14px;
    padding: 1rem 1.15rem;
}
.doce-panel__title {
    font-size: .9rem;
    font-weight: 700;
    margin: 0 0 .35rem;
    color: var(--text, #111);
}
.doce-panel__hint {
    font-size: .78rem;
    color: var(--text-muted, #6b7280);
    margin: 0 0 .75rem;
}

/* Purposes */
.doce-purposes {
    display: flex;
    flex-direction: column;
    gap: .45rem;
}
.doce-purpose-check {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .85rem;
    cursor: pointer;
    padding: .3rem .45rem;
    border-radius: 8px;
    transition: background .15s;
}
.doce-purpose-check:hover { background: var(--gray-50, #f9fafb); }
.doce-purpose-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--green-500, #22c55e);
}

/* Fields */
.doce-field {
    margin-bottom: .75rem;
}
.doce-field__label {
    display: block;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-muted, #6b7280);
    margin-bottom: .25rem;
}
.doce-field__input {
    width: 100%;
    padding: .45rem .65rem;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    font-size: .85rem;
    background: var(--surface, #fff);
}
.doce-field__input:focus {
    outline: none;
    border-color: var(--green-400, #4ade80);
}

/* Variable list — always visible, scrolls inside panel */
.doce-var-list {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: .35rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: .15rem;
}
.doce-var-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .1rem;
    padding: .45rem .65rem;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: all .15s;
    width: 100%;
}
.doce-var-btn:hover {
    background: rgba(59, 130, 246, .06);
    border-color: rgba(59, 130, 246, .15);
}
.doce-var-btn__token {
    font-family: monospace;
    font-size: .82rem;
    font-weight: 600;
    color: var(--blue-600, #2563eb);
}
.doce-var-btn__desc {
    font-size: .72rem;
    color: var(--text-muted, #6b7280);
}
.doce-panel__hint--layout {
    margin-bottom: 0.5rem;
    line-height: 1.35;
}
.doce-panel__hint--layout code {
    font-size: 0.78rem;
}
.doce-var-btn--layout {
    margin-bottom: 0.5rem;
    background: rgba(124, 58, 237, 0.06);
    border-color: rgba(124, 58, 237, 0.2);
}
.doce-var-btn--layout:hover {
    background: rgba(124, 58, 237, 0.1);
    border-color: rgba(124, 58, 237, 0.35);
}
.doce-var-btn--layout .doce-var-btn__token {
    color: #7c3aed;
}
.doce-var-group {
    margin-bottom: .65rem;
}
.doce-var-group__title {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted, #6b7280);
    margin: 0 0 .35rem;
    padding-bottom: .25rem;
    border-bottom: 1px solid var(--border, #e5e7eb);
}
.doc-hero__actions {
    flex-wrap: wrap;
}
.doc-hero__form-inline {
    display: inline;
    margin: 0;
}
.doc-help {
    position: relative;
    z-index: 1;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}
.doc-help__title {
    font-size: .95rem;
    font-weight: 700;
    margin: 0 0 .5rem;
}
.doc-help__list {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--text-muted, #6b7280);
    font-size: .88rem;
    line-height: 1.55;
}
.doc-tag--property {
    background: var(--green-50, #f0fdf4);
    color: var(--green-800, #166534);
}
.doc-tag--all {
    background: var(--gray-100, #f3f4f6);
    color: var(--gray-600, #4b5563);
}

/* ── Editor area ──────────────────────────────────────── */
.doce-editor-wrap {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Toolbar */
.doce-toolbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: .25rem;
    padding: .4rem .75rem;
    background: var(--surface, #fff);
    border-bottom: 1px solid var(--border, #e5e7eb);
    flex-wrap: wrap;
    z-index: 50;
}
.doce-toolbar__group {
    display: flex;
    align-items: center;
    gap: .15rem;
}
.doce-toolbar__sep {
    width: 1px;
    height: 24px;
    background: var(--border, #e5e7eb);
    margin: 0 .35rem;
}
.doce-tb-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    color: var(--text, #111);
    font-size: .85rem;
    transition: all .15s;
}
.doce-tb-btn:hover {
    background: var(--gray-100, #f3f4f6);
    border-color: var(--border, #e5e7eb);
}
.doce-tb-select {
    padding: .3rem .5rem;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 6px;
    font-size: .82rem;
    background: var(--surface, #fff);
    cursor: pointer;
}

/* Paper */
.doce-paper {
    flex: 1;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: var(--gray-200, #e5e7eb);
    padding: 1.25rem;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.doce-pagebreak {
    user-select: none;
    cursor: default;
    margin: 1rem 0;
    padding: 0.4rem 0;
    text-align: center;
    color: #94a3b8;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-top: 2px dashed #cbd5e1;
    border-bottom: 2px dashed #cbd5e1;
    background: repeating-linear-gradient(
        90deg,
        rgba(203, 213, 225, 0.18),
        rgba(203, 213, 225, 0.18) 8px,
        transparent 8px,
        transparent 16px
    );
}

.doce-page-guide {
    position: absolute;
    left: 1.25rem;
    right: 1.25rem;
    height: 0;
    border-top: 1px dashed rgba(99, 102, 241, 0.45);
    pointer-events: none;
    z-index: 5;
}

.doce-page-guide__badge {
    position: absolute;
    right: 0;
    top: -10px;
    padding: 1px 8px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.6;
    color: #4338ca;
    background: rgba(238, 242, 255, 0.95);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Editor (contenteditable) — A4; padding matches @page margin used in print (18mm) */
.doce-editor {
    width: 210mm;
    min-height: 297mm;
    max-width: calc(100% - 1rem);
    box-sizing: border-box;
    background: #fff;
    box-shadow: 0 2px 24px rgba(0,0,0,.12);
    border-radius: 2px;
    padding: 18mm;
    font-family: "Times New Roman Tj", "Times New Roman", Times, serif;
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
    outline: none;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
/* A4 landscape (receipt KO-1): 297×210, tighter padding matches print margins */
.doce-editor.is-landscape {
    width: 297mm;
    min-height: 210mm;
    padding: 10mm;
}
.doce-editor.is-landscape.is-receipt {
    padding: 8mm;
    min-height: 210mm;
}
.doce-editor.is-receipt .doce-receipt-sheet {
    font-size: 9pt;
    line-height: 1.15;
}
.doce-editor.is-receipt .doce-receipt-sheet p {
    margin-top: 0;
    margin-bottom: 2px;
}
.doce-editor.is-paper-a5:not(.is-landscape) {
    width: 148mm;
    min-height: 210mm;
}
.doce-editor.is-paper-a5.is-landscape {
    width: 210mm;
    min-height: 148mm;
    padding: 10mm;
}
.doce-editor.is-paper-letter:not(.is-landscape) {
    width: 215.9mm;
    min-height: 279.4mm;
}
.doce-editor.is-paper-letter.is-landscape {
    width: 279.4mm;
    min-height: 215.9mm;
    padding: 10mm;
}
.doce-editor * {
    max-width: 100%;
    box-sizing: border-box;
}
.doce-editor img {
    height: auto !important;
}
.doce-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted, #aaa);
    pointer-events: none;
    position: absolute;
}
.doce-editor h1 { font-size: 24px; font-weight: 700; margin: .75em 0 .4em; }
.doce-editor h2 { font-size: 20px; font-weight: 700; margin: .65em 0 .35em; }
.doce-editor h3 { font-size: 17px; font-weight: 700; margin: .5em 0 .3em; }
.doce-editor p { margin: 0 0 .6em; }
.doce-editor ul, .doce-editor ol { padding-left: 1.5em; margin: .5em 0; }
.doce-editor hr { border: none; border-top: 1px solid #ccc; margin: 1em 0; }

/* Tables in editor */
/* окно просмотра документа (.scp__page) показывает шаблон как есть — со своими ширинами и шрифтами */
.doce-editor table,
.doce-table:not(.scp__page .doce-table) {
    border-collapse: collapse;
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed;
    margin: .5rem 0;
    font-size: inherit;
}
.doce-editor th,
.doce-editor td,
.doce-table:not(.scp__page .doce-table) th,
.doce-table:not(.scp__page .doce-table) td {
    border: 1px solid #333;
    padding: 4px 6px !important;
    text-align: left;
    vertical-align: top;
    min-width: 0;
    width: auto !important;
    font-size: inherit !important;
    line-height: 1.4 !important;
}
.doce-editor p,
.doce-editor div,
.doce-editor li {
    margin-top: 0;
    margin-bottom: 0.35em;
}
.doce-editor p[style],
.doce-editor span[style],
.doce-editor td[style] {
    line-height: 1.5 !important;
}
.doce-editor th,
.doce-table th {
    background: #f5f5f5;
    font-weight: 600;
}

/* Variable highlight in editor */
.doce-var {
    display: inline;
    background: rgba(59, 130, 246, .1);
    color: var(--blue-600, #2563eb);
    font-weight: 600;
    padding: .1em .4em;
    border-radius: 4px;
    border: 1px solid rgba(59, 130, 246, .2);
    font-family: monospace;
    font-size: .92em;
    white-space: nowrap;
    cursor: default;
    user-select: all;
}

/* Шаблоны: фиксированные таблицы, обрезка, подгонка текста */
table[data-doce-fixed] {
    table-layout: fixed !important;
}
.doce-editor table[data-doce-fixed] th,
.doce-editor table[data-doce-fixed] td {
    box-sizing: border-box !important;
    overflow: hidden !important;
}
.doce-editor [data-doce-fit="cell"] {
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.doce-editor .doce-receipt-sheet .doce-receipt-left {
    border-right: 1px dashed #c00 !important;
}

/* ── Toast ─────────────────────────────────────────────── */
.doc-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--green-600, #16a34a);
    color: #fff;
    padding: .65rem 1.5rem;
    border-radius: 12px;
    font-size: .9rem;
    font-weight: 600;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    opacity: 0;
    transition: opacity .25s, transform .25s;
    z-index: 9999;
}
.doc-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 900px) {
    .doc-page { padding: 1.25rem 1rem 3rem; }
    .doc-hero { flex-direction: column; }
    .doc-grid { grid-template-columns: 1fr; }

    .doce-sidebar-toggle {
        display: inline-flex;
        align-items: center;
        margin: .5rem .75rem 0;
        padding: .4rem .85rem;
        font-size: .82rem;
        font-weight: 600;
        border: 1px solid var(--border, #e5e7eb);
        border-radius: 8px;
        background: var(--surface, #fff);
        cursor: pointer;
        color: var(--blue-600, #2563eb);
    }
    .doce-sidebar {
        position: fixed;
        left: 0;
        top: var(--doce-topbar-h);
        bottom: 0;
        z-index: 200;
        width: min(320px, 92vw);
        transform: translateX(-105%);
        transition: transform .25s ease;
        box-shadow: 4px 0 24px rgba(0,0,0,.12);
    }
    .doce-sidebar.is-open {
        transform: translateX(0);
    }
    .doce-sidebar__top {
        max-height: 35%;
    }
    .doce-paper { padding: .75rem; }
    .doce-editor {
        width: 100%;
        min-height: 70vh;
        padding: 12mm 10mm;
        font-size: 11pt;
    }
    .doce-topbar__name { font-size: 1rem; }
    .doce-topbar__back span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .doc-reveal { opacity: 1; transform: none; transition: none; }
    .doc-card { transition: none; }
    .doc-toast { transition: none; }
}

/* ============================================================ */
/* Sales module (/sales)                                        */
/* ============================================================ */
.app-content:has(.sales-page),
.app-content:has(.sales-workspace),
.app-content:has(.sales-wizard) {
    background: linear-gradient(165deg, var(--gray-50) 0%, var(--white) 40%, var(--green-50) 100%);
}

/* Высота 100% для цепочки flex внутри shell (прокрутка workspace) */
html {
    height: 100%;
}

.app-content--sales-workspace {
    display: flex;
    flex-direction: column;
    flex: 1 1 0%;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    padding-bottom: 0.65rem;
}

.app-content:has(.sales-workspace),
.app-content--sales-wizard,
.app-content:has(.sales-wizard--sale-redesign),
.app-content:has(.sales-wizard--installment-redesign),
.app-content:has(.sales-wizard--reassignment-redesign) {
    display: flex;
    flex-direction: column;
    flex: 1 1 0%;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    padding-bottom: 0.65rem;
}

.app-content--sales-wizard,
.app-content:has(.sales-wizard--sale-redesign),
.app-content:has(.sales-wizard--installment-redesign),
.app-content:has(.sales-wizard--reassignment-redesign) {
    padding-top: 0.5rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.sales-reveal {
    opacity: 0;
    transform: translateY(0.75rem);
    transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
    transition-delay: var(--reveal-delay, 0s);
}
.sales-reveal.is-visible {
    opacity: 1;
    /* none, а не translateY(0): иначе нижние шторки (position: fixed) внутри привязываются к блоку, а не к экрану. */
    transform: none;
}
.sales-reveal--d1 { transition-delay: 0.08s; }
.sales-reveal--d2 { transition-delay: 0.14s; }

/* Hub */
.sales-page {
    position: relative;
    max-width: min(72rem, 100%);
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

@media (min-width: 1800px) {
    .sales-page {
        max-width: min(90rem, 100%);
    }
}

@media (min-width: 2400px) {
    .sales-page {
        max-width: min(110rem, 100%);
    }
}
.sales-page__bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}
.sales-page__glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.3;
}
.sales-page__glow--1 {
    width: 18rem;
    height: 18rem;
    top: -4rem;
    right: 5%;
    background: var(--green-400);
}
.sales-page__glow--2 {
    width: 12rem;
    height: 12rem;
    bottom: 10%;
    left: -2rem;
    background: #93c5fd;
}
.sales-hero {
    position: relative;
    z-index: 1;
    margin-bottom: 1.75rem;
}
.sales-hero__title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.sales-hero__sub {
    margin: 0.35rem 0 0;
    color: var(--gray-600);
    font-size: 1rem;
}
.sales-modes {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}
.sales-mode-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem 1.15rem;
    background: rgb(255 255 255 / 0.92);
    border: 1px solid rgb(0 0 0 / 0.06);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 20px rgb(0 0 0 / 0.04);
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s, border-color 0.2s;
}
.sales-mode-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgb(0 0 0 / 0.08);
}
.sales-mode-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 12px;
}
.sales-mode-card--sale .sales-mode-card__icon { background: #dcfce7; color: #15803d; }
.sales-mode-card--installment .sales-mode-card__icon { background: #dbeafe; color: #1d4ed8; }
.sales-mode-card--reserve .sales-mode-card__icon { background: #fef9c3; color: #a16207; }
.sales-mode-card--resident .sales-mode-card__icon { background: #f3f4f6; color: #4b5563; }
.sales-mode-card--return .sales-mode-card__icon { background: #fef3c7; color: #b45309; }
.sales-mode-card--reassignment .sales-mode-card__icon { background: #ede9fe; color: #6d28d9; }
.sales-mode-card--sale:hover { border-color: rgb(22 163 74 / 0.35); }
.sales-mode-card--installment:hover { border-color: rgb(37 99 235 / 0.35); }
.sales-mode-card--reserve:hover { border-color: rgb(202 138 4 / 0.35); }
.sales-mode-card--resident:hover { border-color: rgb(107 114 128 / 0.35); }
.sales-mode-card--return:hover { border-color: rgb(180 83 9 / 0.35); }
.sales-mode-card--reassignment:hover { border-color: rgb(109 40 217 / 0.35); }
.sales-mode-card__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}
.sales-mode-card__desc {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--gray-600);
    flex: 1;
}
.sales-mode-card__action {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--green-700);
}
.sales-recent {
    position: relative;
    z-index: 1;
    padding: 1.25rem;
    background: rgb(255 255 255 / 0.88);
    border: 1px solid rgb(22 163 74 / 0.12);
    border-radius: var(--radius);
}
.sales-recent__title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 700;
}
.sales-recent__empty {
    margin: 0;
    color: var(--gray-500);
    font-size: 0.9rem;
}
.sales-recent__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.sales-recent__item {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.75rem 0.85rem;
    border-radius: 8px;
    background: var(--gray-50);
    font-size: 0.88rem;
}
.sales-recent__item--incomplete {
    background: #fef2f2;
    border: 1px solid #fecaca;
}
.sales-recent__main {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 0.75rem 1rem;
    align-items: center;
}
.sales-recent__contract {
    color: var(--gray-600);
    font-size: 0.82rem;
    white-space: nowrap;
}
.sales-recent__docs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.85rem;
    padding-top: 0.35rem;
    border-top: 1px solid rgb(0 0 0 / 0.06);
}
.sales-recent__docs-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-600);
}
.sales-recent__doc-slots {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
}
.sales-recent__doc-slot {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.78rem;
    color: var(--gray-600);
}
.sales-recent__doc-slot.is-ok {
    color: #166534;
}
.sales-recent__doc-slot.is-missing {
    color: #b91c1c;
    font-weight: 600;
}
.sales-recent__doc-icon {
    font-size: 0.85rem;
    line-height: 1;
}
@media (max-width: 720px) {
    .sales-recent__main {
        grid-template-columns: 1fr 1fr;
    }
    .sales-recent__date {
        grid-column: 1 / -1;
    }
}
.sales-recent__badge {
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.sales-recent__badge--sale { background: #dcfce7; color: #166534; }
.sales-recent__badge--installment { background: #dbeafe; color: #1e40af; }
.sales-recent__badge--reserve { background: #fef9c3; color: #854d0e; }
.sales-recent__badge--resident { background: #f3f4f6; color: #374151; }
.sales-recent__badge--reassignment { background: #ede9fe; color: #5b21b6; }
.sales-recent__badge--return { background: #fef3c7; color: #92400e; }
.sales-recent__client { color: var(--gray-600); }
.sales-recent__date { color: var(--gray-500); font-size: 0.8rem; white-space: nowrap; }

/* Workspace: flex-basis 0% везде, иначе колонки растут по контенту и скролл не работает */
.sales-workspace {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 0%;
    min-height: 0;
    width: 100%;
    max-width: none;
    padding: 0;
    overflow: hidden;
}
/* Compact command bar */
.sales-ws-bar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
    margin-bottom: 0;
    padding: 0.45rem 0.65rem;
    background: rgb(255 255 255 / 0.92);
    border: 1px solid rgb(22 163 74 / 0.12);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    min-height: 48px;
}
.sales-ws-bar__start {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}
.sales-ws-bar__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--green-800);
    text-decoration: none;
    transition: background 0.15s ease;
}
.sales-ws-bar__back:hover {
    background: var(--green-50);
}
.sales-ws-mode-badge {
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}
.sales-ws-mode-badge--sale { background: #dcfce7; color: #166534; }
.sales-ws-mode-badge--installment { background: #dbeafe; color: #1e40af; }
.sales-ws-mode-badge--reserve { background: #fef9c3; color: #854d0e; }
.sales-ws-mode-badge--resident { background: #f3f4f6; color: #374151; }
.sales-ws-mode-badge--return { background: #fef3c7; color: #92400e; }

.sales-detail-return__lines {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}

.sales-detail-return__line {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.9375rem;
}

.sales-detail-return__total {
    font-size: 1rem;
    margin: 0.75rem 0 0;
}

.sales-detail-return__hint {
    font-size: 0.8125rem;
    color: var(--color-muted, #6b7280);
    margin: 0.5rem 0 0;
}

.sales-recent__badge--return { background: #fef3c7; color: #92400e; }
.sales-ws-mode-badge--reassignment { background: #ede9fe; color: #5b21b6; }
.sales-ws-bar__center {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex: 1;
    min-width: 0;
}
.sales-ws-bar__property {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
    cursor: pointer;
}
.sales-ws-bar__property-icon {
    flex-shrink: 0;
    color: var(--green-700);
}
.sales-ws-bar__select {
    min-width: 6rem;
    max-width: 11rem;
    padding: 0.3rem 1.5rem 0.3rem 0;
    border: none;
    background: transparent;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--green-950);
    cursor: pointer;
}
.sales-ws-bar__select:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgb(34 197 94 / 0.25);
    border-radius: 4px;
}
.sales-ws-bar__divider {
    width: 1px;
    height: 20px;
    background: rgb(22 163 74 / 0.15);
    flex-shrink: 0;
}
.sales-ws-bar__block-actions {
    display: flex;
    gap: 0.15rem;
    flex-shrink: 0;
}
.sales-ws-bar__link {
    padding: 0.2rem 0.35rem;
    border: none;
    background: transparent;
    font: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--green-700);
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}
.sales-ws-bar__link:hover {
    background: var(--green-50);
    color: var(--green-900);
}
.sales-ws-bar__link:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.sales-ws-bar__chips {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.3rem;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0.1rem 0;
}
.sales-ws-bar__chips::-webkit-scrollbar {
    display: none;
}
.sales-ws-chip {
    flex: 0 0 auto;
    padding: 0.22rem 0.55rem;
    border: 1px solid rgb(22 163 74 / 0.2);
    border-radius: 999px;
    background: var(--white);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    white-space: nowrap;
    transition:
        background 0.15s,
        border-color 0.15s,
        color 0.15s,
        box-shadow 0.15s;
}
.sales-ws-chip:hover {
    border-color: var(--green-500);
    color: var(--green-800);
}
.sales-ws-chip.is-active {
    background: linear-gradient(135deg, var(--green-500), var(--green-700));
    border-color: var(--green-700);
    color: var(--white);
    box-shadow: 0 2px 8px rgb(22 163 74 / 0.22);
}
.sales-ws-bar__meta {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--gray-500);
    white-space: nowrap;
}
.sales-ws-meta__sep { margin: 0 0.25rem; opacity: 0.55; }
.sales-workspace .chessboard-map-panel {
    padding: 0.5rem 0.65rem 0.65rem;
    border-radius: 0;
    border: none;
    box-shadow: none;
    background: transparent;
}
.sales-workspace .chessboard-map-wrap {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
}
.sales-workspace .chessboard-map__corner,
.sales-workspace .chessboard-map__row-head {
    position: sticky;
    left: 0;
    width: var(--cb-floor-col, 2.6rem);
    background: var(--white);
    z-index: 5;
}
/* Slide stage: map full width ↔ detail expands */
/* Stage должен быть flex-колонкой, иначе flex у .sales-ws-layout игнорируется и высота «убегает» в контент — скролла нет */
.sales-ws-stage {
    display: flex;
    flex-direction: column;
    flex: 1 1 0%;
    min-height: 0;
    width: 100%;
    overflow: hidden;
}
.sales-ws-layout {
    display: flex;
    align-items: stretch;
    gap: 0;
    flex: 1 1 0%;
    width: 100%;
    min-height: 0;
    overflow: hidden;
    border-radius: 0 0 var(--radius) var(--radius);
    border: 1px solid rgb(22 163 74 / 0.12);
    border-top: none;
    background: rgb(255 255 255 / 0.6);
}
.sales-ws-map-pane {
    position: relative;
    flex: 1 1 0%;
    min-width: 0;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    transition: flex 0.38s var(--ease-out), opacity 0.3s ease;
}
/* Absolute inset: контент карты не раздувает высоту flex-строки — скролл обязателен внутри */
.sales-ws-map-pane__inner {
    position: absolute;
    inset: 0;
    padding: 0.5rem 0.65rem;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-behavior: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.sales-ws-map-pane__inner::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
    background: transparent;
}
.sales-ws-map-pane.is-fetching .sales-ws-map-pane__inner {
    opacity: 0.55;
    pointer-events: none;
}
.sales-ws-map-pane.is-fetching::after {
    content: '';
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 22px;
    height: 22px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--green-600);
    border-radius: 50%;
    animation: sales-spin 0.55s linear infinite;
    z-index: 4;
}
@keyframes sales-spin { to { transform: rotate(360deg); } }

.sales-ws-detail-pane {
    position: relative;
    flex: 0 0 0;
    width: 0;
    min-width: 0;
    opacity: 0;
    overflow: hidden;
    background: rgb(255 255 255 / 0.98);
    border-left: 0 solid transparent;
    transition: flex 0.38s var(--ease-out), opacity 0.32s ease, border-color 0.3s;
}
.sales-workspace.is-detail .sales-ws-map-pane {
    flex: 0 0 40%;
    max-width: 42%;
    min-height: 0;
    overflow: hidden;
}
.sales-workspace.is-detail .sales-ws-detail-pane {
    flex: 1 1 0%;
    min-width: min(60%, 420px);
    min-height: 0;
    width: auto;
    max-width: none;
    opacity: 1;
    overflow: hidden;
    visibility: visible;
    border-left-color: rgb(22 163 74 / 0.12);
    border-left-width: 1px;
}
.sales-ws-detail-pane__scroll {
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    padding: 0.65rem 1rem 0.75rem;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-behavior: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.sales-ws-detail-pane__scroll::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
    background: transparent;
}
.sales-detail__plan {
    margin-top: 0.75rem;
}
.sales-detail-actions {
    margin-top: 1rem;
    padding-bottom: 0.25rem;
}
.sales-detail-cta {
    display: block;
    width: 100%;
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 10px;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 4px 16px rgb(22 163 74 / 0.22);
}
.sales-detail-reserve-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}
.sales-detail-reserve-form__field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.sales-detail-reserve-form__label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
}
.sales-detail-reserve-form__req {
    color: #dc2626;
}
.sales-detail-reserve-form__input {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    font: inherit;
    background: var(--surface, #fff);
    color: inherit;
    resize: vertical;
}
.sales-detail-reserve-form__input--text {
    resize: none;
}
.sales-detail-reserve-form__input:focus {
    outline: 2px solid var(--accent, #2563eb);
    outline-offset: 1px;
}
.sales-detail-reserve-view {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}
.sales-detail-reserve-view__label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary, #64748b);
    margin: 0 0 0.25rem;
}
.sales-detail-reserve-view__text {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.45;
    white-space: pre-wrap;
}
.sales-detail-reserve-view__until {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary, #64748b);
}

.sales-detail-cta-warn {
    margin: 0.85rem 0 0;
    text-align: center;
    font-size: 0.85rem;
    color: #b45309;
}

/* Detail content */
.sales-detail__toolbar {
    margin: 0 0 0.85rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid rgb(22 163 74 / 0.12);
}
.sales-detail-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.55rem 1rem 0.55rem 0.75rem;
    border: 1px solid rgb(22 163 74 / 0.28);
    border-radius: 10px;
    background: linear-gradient(180deg, rgb(255 255 255), rgb(240 253 244));
    font: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--green-900);
    cursor: pointer;
    box-shadow: 0 2px 10px rgb(22 163 74 / 0.12);
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}
.sales-detail-back:hover {
    border-color: var(--green-600);
    background: var(--green-50);
}
.sales-detail-back:focus-visible {
    outline: 2px solid rgb(34 197 94 / 0.45);
    outline-offset: 2px;
}
.sales-detail-back__icon {
    flex-shrink: 0;
    display: block;
    color: var(--green-800);
}
.sales-detail-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}
.sales-detail-hero__mode {
    margin: 0 0 0.25rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
}
.sales-detail-hero__number {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.sales-detail-hero__status {
    flex-shrink: 0;
    padding: 0.35rem 0.65rem;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
}
.sales-detail-facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem 1rem;
    margin: 0;
    padding: 0.75rem 0.9rem;
    background: var(--gray-50);
    border-radius: 12px;
    border: 1px solid rgb(22 163 74 / 0.08);
}
.sales-detail-facts dt {
    margin: 0 0 0.15rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
}
.sales-detail-facts dd {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
}
.sales-detail-plan {
    margin: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgb(22 163 74 / 0.12);
    background: var(--white);
}
.sales-detail-plan__link {
    display: block;
}
.sales-detail-plan__img {
    display: block;
    width: 100%;
    max-height: min(52vh, 420px);
    object-fit: contain;
    background: #f8fafc;
}
.sales-detail-plan--empty,
.sales-detail-plan--pdf {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 12rem;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--gray-500);
    font-size: 0.9rem;
}
.sales-detail-plan__empty-icon {
    color: var(--gray-300);
}

/* Toast */
.sales-ws-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(1rem);
    z-index: 100;
    max-width: min(24rem, 92vw);
    padding: 0.65rem 1.1rem;
    border-radius: 10px;
    background: rgb(30 41 59 / 0.92);
    color: var(--white);
    font-size: 0.88rem;
    font-weight: 500;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s var(--ease-out);
}
.sales-ws-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.cb-unit.cb-unit--disabled {
    cursor: not-allowed;
}
.cb-unit.is-selected {
    outline: 2px solid var(--green-600);
    outline-offset: 2px;
    z-index: 2;
}
.cb-unit--disabled,
.cb-unit.cb-unit--disabled {
    opacity: 0.38;
    cursor: not-allowed;
    filter: grayscale(0.4);
}
.cb-unit.cb-unit--disabled[aria-disabled="true"] {
    pointer-events: auto;
}
.cb-unit--disabled .cb-unit__tip-hint { color: var(--gray-500); }

/* Wizard */
.sales-wizard {
    max-width: 42rem;
    margin: 0 auto;
    padding: 1.25rem 1rem 3rem;
}
.sales-wizard__head {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.sales-wizard__title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
}
.sales-wizard__sub {
    margin: 0.25rem 0 0;
    font-size: 0.88rem;
    color: var(--gray-600);
}
.sales-wizard__steps {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    list-style: none;
    margin: 0 0 0.5rem;
    padding: 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-400);
}
.sales-wizard__step.is-active { color: var(--gray-900); }
.sales-wizard__step.is-done { color: var(--green-700); }
.sales-wizard__alert {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: #fff8e6;
    border: 1px solid #f5d78e;
    font-size: 0.9rem;
    line-height: 1.45;
}
.sales-wizard__alert a { font-weight: 700; }
.sales-wizard--sale .sales-wizard__step.is-active { color: #15803d; }
.sales-wizard--installment .sales-wizard__step.is-active { color: #1d4ed8; }
.sales-wizard--reserve .sales-wizard__step.is-active { color: #a16207; }
/* Мастер переоформления: без is-visible от JS блоки sales-reveal остаются opacity:0 */
.sales-wizard--reassignment .sales-reveal {
    opacity: 1;
    transform: translateY(0);
}

.sales-wizard--reassignment .sales-wizard__step.is-active { color: #6d28d9; }
.sales-wizard__progress-bar {
    height: 4px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1.25rem;
}
.sales-wizard--sale .sales-wizard__progress-fill { background: #22c55e; }
.sales-wizard--installment .sales-wizard__progress-fill { background: #3b82f6; }
.sales-wizard--reserve .sales-wizard__progress-fill { background: #eab308; }
.sales-wizard--reassignment .sales-wizard__progress-fill { background: #8b5cf6; }
.sales-wizard__progress-fill {
    display: block;
    height: 100%;
    transition: width 0.3s var(--ease-out);
}
.sales-wizard__form {
    padding: 1.25rem;
    background: rgb(255 255 255 / 0.95);
    border: 1px solid rgb(0 0 0 / 0.06);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgb(0 0 0 / 0.05);
}
.sales-wizard__panel-title {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    font-weight: 700;
}
.sales-wizard-fields { display: flex; flex-direction: column; gap: 0.85rem; }
.sales-wizard-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.sales-wizard-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}
.sales-wizard-req { color: #dc2626; }
.sales-wizard-input {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.9rem;
}
.sales-wizard-input--area { resize: vertical; min-height: 4rem; }
.sales-wizard-hint {
    margin: 0.35rem 0 0;
    font-size: 0.78rem;
    color: var(--gray-500);
}
.sales-wizard-readonly {
    margin: 0;
    padding: 0.5rem 0.65rem;
    background: var(--gray-50);
    border-radius: 8px;
    font-weight: 600;
}
.sales-wizard-unit-card {
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 10px;
}
.sales-wizard-unit-card--with-layout .sales-wizard-unit-card__body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
    margin-bottom: 0.75rem;
}
@media (max-width: 720px) {
    .sales-wizard-unit-card--with-layout .sales-wizard-unit-card__body {
        grid-template-columns: 1fr;
    }
}
.sales-wizard-unit-card__layout {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 160px;
    padding: 0.65rem;
    background: #fff;
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 8px;
}
.sales-wizard-unit-card__layout-title {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gray-600, #475569);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.sales-wizard-unit-card__layout-link {
    display: block;
    flex: 1;
}
.sales-wizard-unit-card__layout-img {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: 4px;
}
.sales-wizard-unit-card__layout-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--gray-400, #94a3b8);
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem;
}
.sw-contract-number {
    margin: 1.25rem 0;
    padding: 1rem 1.15rem;
    background: var(--gray-50, #f8fafc);
    border: 1px solid var(--gray-200, #e2e8f0);
    border-radius: 10px;
}
.sw-contract-number__title {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    font-weight: 700;
}
.sw-contract-number__fields {
    display: grid;
    grid-template-columns: 1fr 120px;
    gap: 0.75rem;
    margin-top: 0.75rem;
}
@media (max-width: 520px) {
    .sw-contract-number__fields { grid-template-columns: 1fr; }
}
.sw-contract-number__preview {
    margin: 0.75rem 0;
    font-size: 1.05rem;
}
.sw-finish .sales-wizard__submit {
    width: 100%;
    margin-top: 0.5rem;
}
#sw-before-sale .sw-congrats__icon,
#sw-before-sale .sw-congrats__title,
#sw-before-sale .sw-congrats__sub { display: none; }
.sw-contract-registry__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    margin-bottom: 0.75rem;
}
.sw-contract-registry__toolbar .sales-wizard-input { min-width: 220px; }
.sw-contract-registry__table-wrap {
    max-height: 360px;
    overflow: auto;
    border: 1px solid var(--gray-200, #e2e8f0);
    border-radius: 8px;
}
.sw-contract-registry__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.sw-contract-registry__table th,
.sw-contract-registry__table td {
    padding: 0.5rem 0.65rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-100, #f1f5f9);
}
.sw-contract-registry__table th {
    background: var(--gray-50, #f8fafc);
    font-weight: 600;
    position: sticky;
    top: 0;
}
.sw-contract-registry__table tr:hover td {
    background: #f0fdf4;
}
.sales-wizard-unit-card__main {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.sales-wizard-unit-card__number { font-size: 1.2rem; font-weight: 700; }
.sales-wizard-unit-card__status {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-600);
}
.sales-wizard-unit-card__meta {
    display: grid;
    gap: 0.3rem;
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
}
.sales-wizard-unit-card__meta dt { color: var(--gray-500); }
.sales-wizard-unit-card__meta dd { margin: 0; font-weight: 600; }
.sales-wizard__link {
    font-size: 0.85rem;
    font-weight: 600;
}
.sales-wizard-preview {
    padding: 0.75rem;
    background: #eff6ff;
    border-radius: 8px;
    border: 1px solid #bfdbfe;
}
.sales-wizard-preview__title {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #1e40af;
}
.sales-wizard-preview__list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.82rem;
}
.sales-wizard-preview__list li {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    border-bottom: 1px solid rgb(191 219 254 / 0.5);
}
.sales-wizard-preview__more {
    color: var(--gray-500);
    font-style: italic;
    justify-content: center !important;
}
.sales-wizard-docs-lead {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: var(--gray-600);
    line-height: 1.5;
}
.sales-wizard-summary__list {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.9rem;
}
.sales-wizard-summary__list dt {
    color: var(--gray-500);
    font-weight: 500;
}
.sales-wizard-summary__list dd {
    margin: 0;
    font-weight: 600;
}

/* Шаг «Проверка» — продажа / рассрочка */
.sales-wizard__panel--review {
    max-width: 52rem;
}
.sw-review-step {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.sw-review-step__head {
    margin-bottom: 0.15rem;
}
.sw-review-step__head .sales-wizard__panel-title {
    margin-bottom: 0.35rem;
}
.sw-review-step__body {
    flex: 0 0 auto;
    width: 100%;
    min-height: 2rem;
}

.sw-review-step__body:empty::before {
    content: 'Загрузка сводки…';
    display: block;
    padding: 1rem;
    color: var(--gray-500);
    font-size: 0.9rem;
}

.sw-review-step__body:not(:empty)::before {
    content: none;
}
.sw-review-step__notes {
    padding: 0.85rem 1rem;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
}
.sw-review {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.sw-review__hero {
    padding: 1rem 1.1rem;
    border-radius: 12px;
    border: 1px solid transparent;
}
.sw-review--sale .sw-review__hero {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 55%, #fff 100%);
    border-color: #bbf7d0;
}
.sw-review--installment .sw-review__hero {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 45%, #fff 100%);
    border-color: #ddd6fe;
}
.sw-review__eyebrow {
    margin: 0 0 0.25rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--gray-500);
}
.sw-review--sale .sw-review__eyebrow { color: #15803d; }
.sw-review--installment .sw-review__eyebrow { color: #6d28d9; }
.sw-review__title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
}
.sw-review__sub {
    margin: 0.35rem 0 0;
    font-size: 0.88rem;
    color: var(--gray-600);
    line-height: 1.4;
}
.sw-review__kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}
@media (min-width: 640px) {
    .sw-review__kpis {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
.sw-review-kpi {
    padding: 0.55rem 0.65rem;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.sw-review-kpi--highlight {
    border-color: var(--green-300, #86efac);
    background: var(--green-50, #f0fdf4);
}
.sw-review--installment .sw-review-kpi--highlight {
    border-color: #c4b5fd;
    background: #f5f3ff;
}
.sw-review-kpi__label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.sw-review-kpi__value {
    font-size: 0.88rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
    word-break: break-word;
}
.sw-review__section {
    padding: 0.75rem 0.9rem;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
}
.sw-review__section--schedule {
    padding: 0;
    overflow: hidden;
}
.sw-review__section-title {
    margin: 0 0 0.55rem;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
}
.sw-review__section--schedule .sw-review__section-title {
    padding: 0.65rem 0.9rem 0;
    margin-bottom: 0.35rem;
}
.sw-review__grid {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0;
}
.sw-review__row {
    display: grid;
    grid-template-columns: minmax(6.5rem, 36%) 1fr;
    gap: 0.25rem 0.75rem;
    align-items: baseline;
}
@media (min-width: 520px) {
    .sw-review__row {
        grid-template-columns: minmax(7rem, 38%) 1fr;
    }
}
.sw-review__dt {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-500);
}
.sw-review__dd {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: #0f172a;
    word-break: break-word;
}
.sw-review-schedule-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.85rem;
    padding: 0 0.9rem 0.65rem;
    font-size: 0.82rem;
    color: var(--gray-600);
}
.sw-review-schedule-meta__curr {
    width: 100%;
    font-size: 0.75rem;
    color: #6d28d9;
    font-weight: 600;
}
.sw-review-schedule-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.sw-review-schedule-table th,
.sw-review-schedule-table td {
    padding: 0.45rem 0.9rem;
    text-align: left;
    border-top: 1px solid var(--gray-100);
}
.sw-review-schedule-table th {
    background: #f8fafc;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
}
.sw-review-schedule-table tbody tr:nth-child(even) {
    background: #fafafa;
}
.sales-wizard__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-100);
}

/* Sale wizard v2 — pricing, owner grid, documents */
.sales-wizard--v2 {
    width: 100%;
    max-width: min(100%, 72rem);
    margin: 0 auto;
}
.sales-wizard--sale-redesign {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    height: 100%;
}
.sales-wizard--sale-redesign .sales-wizard__shell {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-width: none;
    width: 100%;
    background: #f8fafc;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgb(15 23 42 / 0.08);
    padding: 0;
    overflow: hidden;
}
.sales-wizard--sale-redesign .sales-wizard__head {
    flex-shrink: 0;
    margin-bottom: 0;
    padding: 0.85rem 1.25rem 0.5rem;
}
.sales-wizard--sale-redesign .sales-wizard__alert {
    flex-shrink: 0;
    margin: 0 1.25rem 0.75rem;
}
.sales-wizard--sale-redesign .sales-wizard__progress {
    flex-shrink: 0;
    padding: 0 1.25rem 0.75rem;
}
.sales-wizard--sale-redesign .sales-wizard__steps {
    justify-content: space-between;
    width: 100%;
    gap: 0.5rem 1rem;
    font-size: 0.82rem;
}
@media (min-width: 900px) {
    .sales-wizard--installment-redesign .sw-pricing {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        align-items: start;
    }
    .sales-wizard--installment-redesign .sw-pricing-total,
    .sales-wizard--installment-redesign .sw-installment-schedule-card {
        grid-column: 1 / -1;
    }
    .sales-wizard--sale-redesign .sw-pricing {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        align-items: start;
    }
    .sales-wizard--sale-redesign .sw-pricing-total {
        grid-column: 1 / -1;
    }
    .sales-wizard--sale-redesign .sales-wizard-unit-card--with-layout .sales-wizard-unit-card__body {
        grid-template-columns: minmax(12rem, 1fr) minmax(16rem, 1.2fr);
    }
}
.sales-wizard--sale-redesign .sales-wizard__progress-bar {
    margin-bottom: 0;
}
.sales-wizard--sale-redesign .sales-wizard__form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}
.sales-wizard--sale-redesign .sales-wizard__panel {
    display: none;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0.25rem 1.25rem 1rem;
    -webkit-overflow-scrolling: touch;
}
.sales-wizard--sale-redesign .sales-wizard__panel.is-active {
    display: flex;
    flex-direction: column;
}
.sales-wizard--sale-redesign .sales-wizard__footer {
    flex-shrink: 0;
    margin-top: 0;
    padding: 0.85rem 1.25rem;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}
.sales-wizard--sale-redesign.is-congrats .sales-wizard__footer,
.sales-wizard--sale-redesign.is-congrats #sw-footer {
    display: none !important;
}
.sales-wizard--sale-redesign.is-congrats .sales-wizard__progress {
    display: none;
}
.sales-wizard--sale-redesign.is-congrats .sales-wizard__panel.is-active {
    justify-content: center;
}
.sales-wizard--sale-redesign #sw-after-sale,
.sales-wizard--installment-redesign #sw-after-sale {
    width: 100%;
    max-width: 40rem;
    margin: 0 auto;
}

/* Installment wizard — fullscreen (mirrors sale-redesign) */
.sales-wizard--installment-redesign {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    height: 100%;
}
.sales-wizard--installment-redesign .sales-wizard__shell {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-width: none;
    width: 100%;
    background: #f8fafc;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgb(15 23 42 / 0.08);
    padding: 0;
    overflow: hidden;
}
.sales-wizard--installment-redesign .sales-wizard__head,
.sales-wizard--installment-redesign .sales-wizard__progress,
.sales-wizard--installment-redesign .sales-wizard__form,
.sales-wizard--installment-redesign .sales-wizard__panel,
.sales-wizard--installment-redesign .sales-wizard__footer {
    /* inherits from sale-redesign shared rules below */
}
.sales-wizard--installment-redesign.sales-wizard--v2 .sales-wizard__shell { padding: 0; }
.sales-wizard--installment-redesign .sales-wizard__head { flex-shrink: 0; margin-bottom: 0; padding: 0.85rem 1.25rem 0.5rem; }
.sales-wizard--installment-redesign .sales-wizard__progress { flex-shrink: 0; padding: 0 1.25rem 0.75rem; }
.sales-wizard--installment-redesign .sales-wizard__steps { justify-content: space-between; width: 100%; }
.sales-wizard--installment-redesign .sales-wizard__form {
    display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden;
    margin: 0; padding: 0; background: transparent; border: none; box-shadow: none;
}
.sales-wizard--installment-redesign .sales-wizard__panel { display: none; flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0.25rem 1.25rem 1rem; }
.sales-wizard--installment-redesign .sales-wizard__panel.is-active { display: flex; flex-direction: column; }
.sales-wizard--installment-redesign .sales-wizard__footer {
    flex-shrink: 0; margin-top: 0; padding: 0.85rem 1.25rem; background: #fff; border-top: 1px solid #e2e8f0;
}
.sales-wizard--installment-redesign.is-congrats .sales-wizard__footer,
.sales-wizard--installment-redesign.is-congrats #sw-footer { display: none !important; }
.sales-wizard--installment-redesign.is-congrats .sales-wizard__progress { display: none; }
.sales-wizard--installment-redesign.is-congrats .sales-wizard__panel.is-active { justify-content: center; }
.sales-wizard--installment-redesign .sw-card { margin-bottom: 1rem; padding: 1rem 1.1rem; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; }
.sales-wizard--installment-redesign .sales-wizard-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.18);
}
.sales-wizard--installment-redesign .sw-back-link { color: #1d4ed8; }
.sales-wizard--installment-redesign .sw-back-link:hover { color: #1e3a8a; }

/* Reassignment wizard — fullscreen + прокрутка панелей (как продажа/рассрочка) */
.sales-wizard--reassignment-redesign {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    height: 100%;
}
.sales-wizard--reassignment-redesign .sales-wizard__shell {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-width: none;
    width: 100%;
    background: #f8fafc;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgb(15 23 42 / 0.08);
    padding: 0;
    overflow: hidden;
}
.sales-wizard--reassignment-redesign.sales-wizard--v2 .sales-wizard__shell {
    padding: 0;
}
.sales-wizard--reassignment-redesign .sales-wizard__head {
    flex-shrink: 0;
    margin-bottom: 0;
    padding: 0.85rem 1.25rem 0.5rem;
}
.sales-wizard--reassignment-redesign .sales-wizard__alert {
    flex-shrink: 0;
    margin: 0 1.25rem 0.75rem;
}
.sales-wizard--reassignment-redesign .sales-wizard__progress {
    flex-shrink: 0;
    padding: 0 1.25rem 0.75rem;
}
.sales-wizard--reassignment-redesign .sales-wizard__steps {
    justify-content: space-between;
    width: 100%;
    gap: 0.5rem 1rem;
    font-size: 0.82rem;
}
.sales-wizard--reassignment-redesign .sales-wizard__form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}
.sales-wizard--reassignment-redesign .sales-wizard__panel {
    display: none;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.25rem 1.25rem 1rem;
    -webkit-overflow-scrolling: touch;
}
.sales-wizard--reassignment-redesign .sales-wizard__panel.is-active {
    display: flex;
    flex-direction: column;
}
.sales-wizard--reassignment-redesign .sales-wizard__footer {
    flex-shrink: 0;
    margin-top: 0;
    padding: 0.85rem 1.25rem;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}
.sales-wizard--reassignment-redesign.is-congrats .sales-wizard__footer,
.sales-wizard--reassignment-redesign.is-congrats #sw-footer {
    display: none !important;
}
.sales-wizard--reassignment-redesign.is-congrats .sales-wizard__progress {
    display: none;
}
.sales-wizard--reassignment-redesign.is-congrats .sales-wizard__panel.is-active {
    justify-content: center;
}
.sales-wizard--reassignment-redesign .sw-card {
    margin-bottom: 1rem;
    padding: 1rem 1.1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}
.sales-wizard--reassignment-redesign .sw-client-picker__results {
    max-height: 12rem;
    overflow-y: auto;
}
.sales-wizard--reassignment-redesign .sales-wizard-input:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgb(124 58 237 / 0.18);
}

.sw-installment-summary {
    margin-top: 0.75rem;
    padding: 0.75rem 0.9rem;
    background: #eff6ff;
    border: 1px solid rgb(37 99 235 / 0.2);
    border-radius: 10px;
    font-size: 0.9rem;
}
.sw-installment-summary p { margin: 0.35rem 0; }
.sw-installment-summary__label { color: #64748b; margin-right: 0.35rem; }
.sw-installment-schedule-wrap { overflow-x: auto; max-height: 22rem; overflow-y: auto; }
.sw-installment-schedule {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.sw-installment-schedule th,
.sw-installment-schedule td {
    padding: 0.5rem 0.65rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
.sw-installment-schedule th {
    position: sticky;
    top: 0;
    background: #f1f5f9;
    font-weight: 700;
    color: #475569;
    z-index: 1;
}
.sw-installment-schedule__empty {
    color: #64748b;
    text-align: center;
    padding: 1rem;
}
/* ── Installments page ───────────────────────────────────── */
.app-content:has(.inst-page),
.app-content:has(.crm-page),
.app-content:has(.archive-page) {
    max-width: none;
    background: linear-gradient(165deg, var(--gray-50) 0%, var(--white) 42%, #f5f3ff 100%);
}

.app-content:has(.archive-page) {
    background: linear-gradient(165deg, var(--green-50) 0%, var(--white) 48%, var(--gray-50) 100%);
}

.inst-page,
.crm-page,
.archive-page {
    position: relative;
    max-width: 100%;
}

/* Блоки внутри страницы всегда видимы (sales-reveal без JS-анимации) */
.inst-page .sales-reveal,
.crm-page .sales-reveal,
.archive-page .sales-reveal {
    opacity: 1;
    transform: translateY(0);
}
.inst-page__bg {
    position: absolute;
    inset: -1rem -0.5rem auto;
    height: 12rem;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}
.inst-page__orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(48px);
    opacity: 0.45;
}
.inst-page__orb--1 {
    width: 220px;
    height: 220px;
    background: #c4b5fd;
    top: -60px;
    right: 10%;
}
.inst-page__orb--2 {
    width: 160px;
    height: 160px;
    background: #a5f3fc;
    top: 0;
    left: 5%;
}
.inst-hero,
.inst-stats,
.inst-toolbar,
.inst-table-card,
.inst-empty,
.cashbox-balance-bar,
.cashbox-stats,
.cashbox-toolbar,
.cashbox-feed,
.cashbox-load-more {
    position: relative;
    z-index: 1;
}
.inst-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.inst-hero__title {
    margin: 0 0 0.35rem;
    font-size: 1.65rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}
.inst-hero__lead {
    margin: 0;
    max-width: 36rem;
    color: #64748b;
    font-size: 0.92rem;
    line-height: 1.5;
}
.inst-hero__lead a { color: #7c3aed; font-weight: 600; }
.inst-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.inst-stat {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    box-shadow: 0 1px 3px rgb(15 23 42 / 0.04);
}
.inst-stat--warn {
    border-color: #fecaca;
    background: linear-gradient(135deg, #fff 0%, #fef2f2 100%);
}
.inst-stat__value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
}
.inst-stat--warn .inst-stat__value { color: #b91c1c; }
.inst-stat__label {
    font-size: 0.78rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.inst-toolbar { margin-bottom: 0.85rem; }
.inst-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 22rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.45rem 0.75rem;
    box-shadow: 0 1px 2px rgb(15 23 42 / 0.04);
}
.inst-search__icon { color: #94a3b8; display: flex; }
.inst-search__input {
    border: 0;
    outline: none;
    width: 100%;
    font-size: 0.9rem;
    background: transparent;
}
.inst-table-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgb(15 23 42 / 0.06);
    overflow: hidden;
}
.inst-table-wrap { overflow-x: auto; }
.inst-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.inst-table th {
    padding: 0.55rem 0.75rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}
.inst-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.inst-table__row {
    cursor: pointer;
    transition: background 0.15s ease;
}
.inst-table__row:hover { background: #f5f3ff; }
.inst-table__row.is-active {
    background: #ede9fe;
    box-shadow: inset 3px 0 0 #7c3aed;
}
.inst-table__row.is-hidden { display: none; }
.inst-table__contract strong {
    display: block;
    color: #0f172a;
    font-weight: 700;
}
.inst-table__muted {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.1rem;
}
.inst-table__client {
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    color: #0f172a;
}
.inst-table__client strong {
    font-weight: 700;
}
.inst-table__unit {
    color: #334155;
    max-width: 15rem;
    vertical-align: middle;
}
.inst-table__unit-line {
    display: block;
    font-size: 0.78rem;
    line-height: 1.35;
    letter-spacing: -0.01em;
}
.inst-table__progress { min-width: 7rem; }
.inst-progress {
    height: 5px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 0.2rem;
}
.inst-progress__fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
    border-radius: 99px;
    transition: width 0.3s ease;
}
.inst-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}
.inst-badge--ok {
    background: #ecfdf5;
    color: #047857;
}
.inst-badge--warn {
    background: #fef2f2;
    color: #b91c1c;
}
.inst-badge--paid {
    background: #ecfdf5;
    color: #047857;
}
.inst-badge--planned {
    background: #f1f5f9;
    color: #475569;
}
.inst-badge--partial {
    background: #fffbeb;
    color: #b45309;
}
.inst-table__hint {
    margin: 0;
    padding: 0.75rem 1rem;
    color: #64748b;
    font-size: 0.85rem;
}
.inst-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    background: #fff;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
}
.inst-empty__title {
    margin: 0 0 0.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
}
.inst-empty__text {
    margin: 0 0 1.25rem;
    color: #64748b;
}

/* Drawer / mobile sheet */
.inst-page.is-drawer-open,
.crm-page.is-drawer-open,
.cashbox-page.is-drawer-open { overflow: hidden; }
.inst-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgb(15 23 42 / 0.35);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}
.inst-drawer-overlay[hidden] {
    display: none !important;
    pointer-events: none;
}
.inst-drawer-overlay:not([hidden]) {
    display: block;
    opacity: 1;
    pointer-events: auto;
}
.inst-drawer {
    position: fixed;
    z-index: 210;
    background: #fff;
    flex-direction: column;
    box-shadow: -8px 0 40px rgb(15 23 42 / 0.12);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.inst-drawer[hidden] {
    display: none !important;
    pointer-events: none;
}
.inst-drawer:not([hidden]) {
    display: flex;
}
.inst-drawer__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.inst-drawer__eyebrow {
    margin: 0 0 0.2rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #7c3aed;
    font-weight: 700;
}
.inst-drawer__title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    color: #0f172a;
}
.inst-drawer__sub {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
    color: #64748b;
}
.inst-drawer__close {
    border: 0;
    background: #f1f5f9;
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    color: #475569;
    flex-shrink: 0;
}
.inst-drawer__close:hover { background: #e2e8f0; }
.inst-drawer__body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 1.1rem 1.25rem;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.inst-detail {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: min-content;
}
.inst-detail__section--schedule {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 14rem;
}
.inst-schedule-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}
.inst-schedule-table-wrap {
    flex: 1;
    min-height: 10rem;
    max-height: min(52vh, 32rem);
    overflow: auto;
}
.inst-drawer .inst-schedule-table {
    font-size: 0.84rem;
}
.inst-drawer .inst-schedule-table th,
.inst-drawer .inst-schedule-table td {
    padding: 0.55rem 0.75rem;
    white-space: nowrap;
}
.inst-drawer .inst-schedule-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f1f5f9;
}
.inst-drawer__loading {
    color: #64748b;
    text-align: center;
    padding: 2rem;
}
.inst-drawer__foot {
    flex-shrink: 0;
    padding: 0.85rem 1.1rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.inst-accept-panel {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.inst-accept-panel__hint {
    margin: 0;
    font-size: 0.82rem;
    color: #64748b;
}
.inst-accept-form__lead {
    margin: 0;
    font-size: 0.88rem;
    color: #0f172a;
}
.inst-accept-form__row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.inst-accept-form__preview {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #7c3aed;
}
.inst-accept-form__status {
    margin: 0;
    font-size: 0.8rem;
    color: #64748b;
    min-height: 1.1em;
}
.inst-accept-form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.inst-schedule-row--selectable {
    cursor: pointer;
}
.inst-schedule-row--selectable:hover td {
    background: #f1f5f9;
}
.inst-schedule-row--selectable.is-selected td {
    background: #ede9fe;
}
.inst-schedule-row--overdue.inst-schedule-row--selectable.is-selected td {
    background: #f8fafc !important;
}
.inst-drawer__foot-hint {
    font-size: 0.75rem;
    color: #94a3b8;
}
.inst-detail__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.inst-reconcile-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.65rem;
}
.inst-reconcile-head .inst-detail__section-title {
    margin: 0;
}
.inst-detail__actions--reconcile {
    margin-bottom: 0;
    align-items: center;
}
.inst-call-btn__phone {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 600;
}
.inst-call-btn--disabled {
    font-size: 0.8rem;
}
/* ── Clients (CRM) page ─────────────────────────────────── */
.crm-table-card .inst-table th,
.crm-table-card .inst-table td {
    padding: 0.45rem 0.55rem;
    font-size: 0.8rem;
}
.crm-table__num {
    text-align: center;
    width: 4.5rem;
}
.inst-th-sort {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}
.inst-th-sort--left {
    justify-content: flex-start;
}
.inst-th-sort__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.inst-th-sort__btn:hover {
    background: #ede9fe;
    color: #7c3aed;
}
.inst-th-sort__btn:focus-visible {
    outline: 2px solid #a78bfa;
    outline-offset: 1px;
}
.inst-th-sort__icon {
    display: block;
}
.inst-th-sort__chev {
    transition: opacity 0.15s ease, stroke 0.15s ease;
}
.inst-th-sort__btn[data-sort=''] .inst-th-sort__chev,
.inst-th-sort__btn:not([data-sort]) .inst-th-sort__chev {
    opacity: 0.45;
}
.inst-th-sort__btn[data-sort='asc'] .inst-th-sort__chev--up,
.inst-th-sort__btn[data-sort='desc'] .inst-th-sort__chev--down {
    opacity: 1;
    stroke: #7c3aed;
}
.inst-th-sort__btn[data-sort='asc'] .inst-th-sort__chev--down,
.inst-th-sort__btn[data-sort='desc'] .inst-th-sort__chev--up {
    opacity: 0.2;
}
.crm-table__phone {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: #475569;
}
.crm-table__contracts {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.72rem;
}
.crm-table .inst-table__client strong {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: #0f172a;
}
.crm-drawer__head {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.75rem;
}
.crm-drawer__head-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    flex: 1 1 12rem;
    min-width: 10rem;
    max-width: 100%;
    margin-right: 2rem;
}
.crm-phone-edit {
    width: 100%;
}
.crm-phone-edit__label {
    display: block;
}
.crm-phone-edit__caption {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    margin-bottom: 0.2rem;
}
.crm-phone-edit__row {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}
.crm-phone-edit__input {
    flex: 1;
    min-width: 0;
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
}
.crm-phone-edit__input:focus {
    outline: none;
    border-color: #a78bfa;
    box-shadow: 0 0 0 2px rgb(167 139 250 / 0.2);
}
.crm-phone-edit__error {
    margin: 0.25rem 0 0;
    font-size: 0.75rem;
    color: #b91c1c;
}
.crm-units-summary {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.crm-units-summary__total {
    font-size: 0.85rem;
    color: #475569;
}
.crm-status-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.crm-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}
.crm-status-chip--available { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.crm-status-chip--reserved { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.crm-status-chip--sold { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.crm-status-chip--installment { background: #fef9c3; border-color: #fde047; color: #854d0e; }
.crm-status-chip--overdue { background: #fff1f2; border-color: #fda4af; color: #9f1239; }
.crm-status-chip--reassignment { background: #f5f3ff; border-color: #ddd6fe; color: #6d28d9; }
.crm-status-chip--archived { background: #f8fafc; border-color: #cbd5e1; color: #64748b; }
.crm-deals-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.8rem;
    color: #64748b;
}
.crm-deals-totals__debt {
    color: #9f1239;
    font-weight: 600;
}
.crm-deals-table-wrap {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
}
.crm-deals-table {
    margin: 0;
    font-size: 0.78rem;
}
.crm-deals-table .inst-table__muted {
    display: block;
    font-size: 0.68rem;
}
.crm-deals-row__debt {
    font-weight: 700;
    white-space: nowrap;
}
.crm-deals-row--overdue td {
    background: transparent;
}
.crm-deals-row__action {
    white-space: nowrap;
}
.crm-deal-link {
    padding: 0.15rem 0.45rem !important;
    font-size: 0.72rem !important;
}
@media (max-width: 720px) {
    .crm-drawer__head-actions {
        flex: 1 1 100%;
        margin-right: 0;
        align-items: stretch;
    }
}
.inst-detail__section {
    margin-bottom: 1.1rem;
}
.inst-detail__section-title {
    margin: 0 0 0.5rem;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}
.inst-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}
.inst-kpi {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
}
.inst-kpi__label {
    display: block;
    font-size: 0.68rem;
    color: #94a3b8;
    margin-bottom: 0.15rem;
}
.inst-kpi__value {
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}
.inst-dl {
    margin: 0;
    display: grid;
    gap: 0.35rem;
}
.inst-dl__row {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: 0.5rem;
    font-size: 0.82rem;
    align-items: baseline;
}
.inst-dl__dt {
    margin: 0;
    color: #94a3b8;
    font-weight: 500;
}
.inst-dl__dd {
    margin: 0;
    color: #0f172a;
    font-weight: 600;
    word-break: break-word;
}
.inst-schedule-totals {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.inst-schedule-total {
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    background: #f8fafc;
}
.inst-schedule-total--accent {
    background: #ede9fe;
    grid-column: 1 / -1;
}
.inst-schedule-total__label {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    margin-bottom: 0.15rem;
}
.inst-schedule-total__value {
    display: block;
    font-size: 0.9rem;
    color: #0f172a;
}
.inst-schedule-total__sub {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.1rem;
}
.inst-schedule-row--overdue td,
.inst-table__row--overdue td,
.crm-deals-row--overdue td {
    background: transparent !important;
    box-shadow: none !important;
    color: #dc2626;
    font-weight: 600;
    text-shadow: 0 0 5px rgb(220 38 38 / 0.22);
}
.inst-schedule-row--overdue:hover td,
.inst-table__row--overdue:hover td,
.crm-deals-row--overdue:hover td {
    background: transparent !important;
    color: #b91c1c;
}
.inst-table__row--overdue .inst-table__client,
.inst-table__row--overdue .inst-table__client strong {
    color: #0f172a;
    font-weight: 700;
    text-shadow: none;
}
.inst-table__row--overdue .inst-table__remaining,
.inst-table__row--overdue .crm-table__contracts,
.crm-deals-row--overdue .crm-deals-row__debt {
    color: #dc2626;
    text-shadow: 0 0 5px rgb(220 38 38 / 0.22);
}
.inst-table__row--overdue.is-active td {
    background: #f8fafc !important;
    color: #dc2626;
}
.inst-table__row--overdue.is-active .inst-table__muted {
    color: #e11d48;
    text-shadow: none;
    font-weight: 500;
}
.inst-table__row--overdue.is-active .inst-table__remaining {
    color: #dc2626;
    text-shadow: 0 0 5px rgb(220 38 38 / 0.22);
}
.inst-table__remaining { font-weight: 700; color: #0f172a; white-space: nowrap; }
.inst-table__comment {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 11rem;
}
.inst-table__comment-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #64748b;
    font-size: 0.78rem;
}
.inst-comment-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.inst-comment-btn:hover {
    border-color: #c4b5fd;
    color: #7c3aed;
    background: #f5f3ff;
}
.inst-toolbar--filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}
.inst-toolbar--filters .inst-search {
    flex: 1 1 12rem;
    max-width: 16rem;
    min-height: 2.1rem;
    padding: 0.3rem 0.6rem;
}
.inst-toolbar--filters .inst-search__input { font-size: 0.82rem; }
.inst-filter-chip {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}
.inst-filter-chip__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.inst-filter-chip__label {
    display: inline-block;
    padding: 0.32rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #fff;
    color: #475569;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.inst-filter-chip__input:checked + .inst-filter-chip__label {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}
.inst-filter-select {
    height: 2.1rem;
    padding: 0 0.55rem;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #475569;
    cursor: pointer;
}
.inst-reconcile-kpi {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.inst-reconcile-kpi__item {
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}
.inst-reconcile-kpi__item--accent {
    background: #ede9fe;
    border-color: #ddd6fe;
}
.inst-reconcile-kpi__item--warn {
    background: #fef2f2;
    border-color: #fecaca;
}
.inst-reconcile-kpi__label {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    margin-bottom: 0.2rem;
}
.inst-reconcile-kpi__value {
    display: block;
    font-size: 0.95rem;
    font-weight: 800;
    color: #0f172a;
}
.inst-ledger-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.inst-ledger-item {
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 0.8rem;
}
.inst-ledger-item__top {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-weight: 700;
    color: #0f172a;
}
.inst-ledger-item__meta {
    margin-top: 0.2rem;
    color: #64748b;
    font-size: 0.75rem;
    line-height: 1.4;
}
.inst-reconcile-actions {
    margin-top: 0.75rem;
}
.inst-add-payment-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 8px;
    border: 1px solid #c4b5fd;
    background: #f5f3ff;
    color: #6d28d9;
    cursor: pointer;
    white-space: nowrap;
}
.inst-add-payment-btn:hover { background: #ede9fe; }
.inst-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgb(15 23 42 / 0.45);
}
.inst-modal {
    position: fixed;
    z-index: 1201;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(22rem, calc(100vw - 2rem));
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgb(15 23 42 / 0.2);
    border: 1px solid #e2e8f0;
}
.inst-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
}
.inst-modal__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    color: #0f172a;
}
.inst-modal__close {
    border: 0;
    background: transparent;
    font-size: 1.35rem;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
}
.inst-modal__body { padding: 0.85rem 1rem; }
.inst-modal__foot {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    border-top: 1px solid #f1f5f9;
}
.inst-modal__hint {
    margin: 0 0 0.65rem;
    font-size: 0.8rem;
    color: #64748b;
}
.inst-modal__field { display: block; margin-bottom: 0.55rem; }
.inst-modal__label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.2rem;
}
.inst-modal__input,
.inst-modal__textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.45rem 0.55rem;
    font-size: 0.88rem;
}
.inst-modal__textarea { resize: vertical; min-height: 5rem; }
.inst-modal__error {
    margin: 0.35rem 0 0;
    font-size: 0.8rem;
    color: #b91c1c;
    white-space: pre-wrap;
}
.inst-modal__preview {
    margin: 0 0 0.5rem;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    font-size: 0.8rem;
    color: #5b21b6;
    line-height: 1.35;
}
.inst-debt-after-plan {
    margin-top: 0.5rem;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    font-size: 0.8rem;
    color: #92400e;
}
/* Окно сверки рассрочки: цена, оплачено, остаток */
.inst-drawer--sv,
#sv-print {
    --sv-ink: #18212b;
    --sv-soft: #5f6b78;
    --sv-faint: #8a95a1;
    --sv-line: #e4e8ec;
    --sv-track: #eef1f3;
    --sv-down: #0e6b47;
    --sv-repaid: #4cbf8a;
    --sv-bad: #c0281b;
    --sv-warn: #a85f00;
}
.inst-drawer--sv .inst-drawer__eyebrow { display: none; }
.inst-drawer--sv .inst-drawer__head { align-items: center; }
.inst-drawer--sv .inst-drawer__head-text { min-width: 0; }
.inst-sv .sv-print-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 46px;
    margin-top: 0.75rem;
    border: 1px dashed var(--sv-line);
    border-radius: 10px;
    background: #fff;
    color: var(--sv-soft);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}
.inst-sv .sv-print-btn:hover { color: var(--sv-ink); border-color: var(--sv-faint); }
.inst-sv .sv-print-btn:focus-visible { outline: 2px solid var(--sv-down); outline-offset: 2px; }
#sv-print { display: none; }
@media (max-width: 768px) {
    /* компактная шапка: ручка шторки не сдвигает текст, заголовок меньше;
       не висит над суммами — уходит вверх вместе с содержимым */
    .inst-drawer--sv .inst-drawer__head { position: relative; top: auto; padding: 0.95rem 1rem 0.6rem; gap: 0.5rem; }
    .inst-drawer--sv .inst-drawer__head::before {
        position: absolute;
        top: 0.35rem;
        left: 50%;
        margin: 0;
        transform: translateX(-50%);
    }
    .inst-drawer--sv .inst-drawer__title { font-size: 1.02rem; line-height: 1.3; }
    .inst-drawer--sv .inst-drawer__sub { margin-top: 0.15rem; font-size: 0.8rem; gap: 0; line-height: 1.35; }
}
/* Печатная сверка: компактно, на один лист A4 */
#sv-print .pp { font-size: 9pt; line-height: 1.35; color: var(--sv-ink); }
#sv-print .pp h1 { margin: 0; font-size: 13pt; }
#sv-print .pp h2 { margin: 0 0 1.5mm; font-size: 10pt; }
#sv-print .pp h2 small { font-weight: 400; color: var(--sv-soft); }
#sv-print .pp-head { display: flex; justify-content: space-between; gap: 4mm; padding-bottom: 2mm; margin-bottom: 3mm; border-bottom: 1px solid #cfd5db; }
#sv-print .pp-head p { margin: 0.5mm 0 0; color: var(--sv-soft); }
#sv-print .pp-date { white-space: nowrap; }
#sv-print .pp-sums { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--sv-line); border-radius: 2mm; overflow: hidden; }
#sv-print .pp-sums > div { display: flex; flex-direction: column; gap: 0.5mm; padding: 2mm 3mm; }
#sv-print .pp-sums > div + div { border-left: 1px solid var(--sv-line); }
#sv-print .pp-sums span { color: var(--sv-soft); }
#sv-print .pp-sums b { font-size: 12pt; }
#sv-print .pp-sums small { color: var(--sv-soft); }
#sv-print .pp-nw { white-space: nowrap; }
#sv-print .pp-rest { background: #fafbfb; }
#sv-print .pp-rest.is-bad { background: #fdf4f3; }
#sv-print .pp-rest.is-bad b { color: var(--sv-bad); }
#sv-print .k-down, #sv-print .k-repaid { display: inline-block; width: 2.2mm; height: 2.2mm; margin: 0 1mm 0 0; vertical-align: -0.2mm; }
#sv-print .k-down { background: var(--sv-down); }
#sv-print .k-repaid { background: var(--sv-repaid); margin-left: 2mm; }
#sv-print .pp-bar { display: flex; height: 2mm; margin: 2mm 0; background: var(--sv-track); border-radius: 1mm; overflow: hidden; }
#sv-print .pp-bar i { display: block; height: 100%; margin: 0; }
#sv-print .pp-state { display: flex; flex-wrap: wrap; gap: 1mm 5mm; margin: 0 0 3mm; padding-left: 2mm; border-left: 2px solid currentColor; }
#sv-print .pp-state span { color: var(--sv-soft); }
#sv-print .pp-state--ok { color: var(--sv-down); }
#sv-print .pp-state--warn { color: var(--sv-warn); }
#sv-print .pp-state--bad { color: var(--sv-bad); }
#sv-print .pp-two { display: grid; grid-template-columns: 1.35fr 1fr; gap: 5mm; margin-bottom: 3mm; }
#sv-print table { width: 100%; border-collapse: collapse; }
#sv-print th { text-align: left; font-weight: 600; color: var(--sv-soft); background: #f3f5f7; }
#sv-print th, #sv-print td { padding: 0.7mm 1.2mm; border-bottom: 1px solid var(--sv-line); white-space: nowrap; font-variant-numeric: tabular-nums; }
#sv-print .n { text-align: right; }
#sv-print .pp-pays td small { color: var(--sv-soft); white-space: normal; }
#sv-print .pp-pays tr.is-down td { background: #eef6f1; color: var(--sv-down); font-weight: 600; }
#sv-print .pp-kv { display: grid; grid-template-columns: auto 1fr; gap: 0.8mm 3mm; margin: 0; }
#sv-print .pp-kv div { display: contents; }
#sv-print .pp-kv dt { color: var(--sv-soft); }
#sv-print .pp-kv dd { margin: 0; font-weight: 600; }
#sv-print .pp-sched-wrap { display: grid; gap: 3mm; align-items: start; }
#sv-print .pp-cols-2 { grid-template-columns: repeat(2, 1fr); }
#sv-print .pp-cols-3 { grid-template-columns: repeat(3, 1fr); }
#sv-print .pp-cols-3 th, #sv-print .pp-cols-3 td { padding: 0.5mm 0.8mm; font-size: 7.5pt; }
#sv-print .pp-sched td { font-size: 8.5pt; }
#sv-print .pp-sched tr.m-paid td:last-child,
#sv-print .pp-sched tr.m-ahead td:last-child { color: var(--sv-down); }
#sv-print .pp-sched tr.m-unpaid td:last-child { color: var(--sv-warn); font-weight: 600; }
#sv-print .pp-sched tr.m-closed td { color: var(--sv-faint); }
#sv-print .pp-sched tr.m-next td { background: #eef6f1; font-weight: 600; }
#sv-print .pp-note { margin: 2mm 0 0; color: var(--sv-soft); font-size: 7.5pt; }
@media print {
    body.sv-printing > *:not(#sv-print) { display: none !important; }
    body.sv-printing { background: #fff !important; margin: 0 !important; }
    body.sv-printing #sv-print {
        display: block;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

.inst-drawer--sv .inst-drawer__title { letter-spacing: -0.01em; }
.inst-drawer--sv .inst-drawer__sub { display: flex; flex-direction: column; gap: 0.15rem; }
.inst-drawer--sv .sv-client { color: var(--sv-ink); font-weight: 600; }
.inst-drawer--sv .sv-unit { color: var(--sv-soft); }

.inst-sv { color: var(--sv-ink); }
.inst-sv .sv-eq {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 0.75rem;
    border: 1px solid var(--sv-line);
    border-radius: 10px;
    overflow: hidden;
}
.inst-sv .sv-eq__term {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    padding: 0.8rem 0.95rem;
}
.inst-sv .sv-eq__term + .sv-eq__term { border-left: 1px solid var(--sv-line); }
.inst-sv .sv-eq__name { font-size: 0.82rem; color: var(--sv-soft); }
.inst-sv .sv-eq__sum {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.inst-sv .sv-eq__term--rest { background: #fafbfb; }
.inst-sv .sv-eq__term--rest.is-overdue { background: #fdf4f3; }
.inst-sv .sv-eq__term--rest.is-overdue .sv-eq__sum { color: var(--sv-bad); }
.inst-sv .sv-eq__split {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    margin-top: 0.15rem;
    font-size: 0.78rem;
    color: var(--sv-soft);
    font-variant-numeric: tabular-nums;
}
.inst-sv .sv-eq__split span { white-space: nowrap; }
.inst-sv .sv-key {
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    margin-right: 0.35rem;
    border-radius: 2px;
    vertical-align: 0;
}
.inst-sv .sv-key--down { background: var(--sv-down); }
.inst-sv .sv-key--repaid { background: var(--sv-repaid); }
.inst-sv .sv-bar {
    display: flex;
    height: 12px;
    border-radius: 3px;
    background: var(--sv-track);
    overflow: hidden;
}
.inst-sv .sv-bar span { display: block; height: 100%; }
.inst-sv .sv-bar__down { background: var(--sv-down); }
.inst-sv .sv-bar__repaid { background: var(--sv-repaid); }

.inst-sv .sv-state {
    margin: 0.9rem 0 0;
    padding-left: 0.75rem;
    border-left: 3px solid currentColor;
    font-size: 0.92rem;
    line-height: 1.45;
}
.inst-sv .sv-state b { font-weight: 700; font-variant-numeric: tabular-nums; }
.inst-sv .sv-state--ok { color: var(--sv-down); }
.inst-sv .sv-state--warn { color: var(--sv-warn); }
.inst-sv .sv-state--bad { color: var(--sv-bad); }
.inst-sv .sv-next {
    margin: 0.35rem 0 0;
    padding-left: calc(0.75rem + 3px);
    font-size: 0.84rem;
    color: var(--sv-soft);
}

.inst-sv .sv-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.1rem 0 1.6rem;
}
.inst-sv .sv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 1.1rem;
    border-radius: 8px;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.inst-sv .sv-btn--pay {
    border: 1px solid var(--sv-down);
    background: var(--sv-down);
    color: #fff;
}
.inst-sv .sv-btn--pay:hover { background: #0a5a3b; }
.inst-sv .sv-btn--line {
    border: 1px solid var(--sv-line);
    background: #fff;
    color: var(--sv-ink);
}
.inst-sv .sv-btn--line:hover { border-color: var(--sv-faint); }
.inst-sv .sv-btn:focus-visible { outline: 2px solid var(--sv-down); outline-offset: 2px; }

.inst-sv .sv-block { margin-bottom: 1.6rem; }
.inst-sv .sv-h {
    margin: 0 0 0.6rem;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    color: var(--sv-ink);
}
.inst-drawer--sv .sv-table th {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--sv-soft);
    background: #f7f8f9;
}
.inst-drawer--sv .sv-table td { vertical-align: top; font-variant-numeric: tabular-nums; }
.inst-drawer--sv .sv-month--unpaid td:nth-child(5) { color: var(--sv-warn); font-weight: 600; }
.inst-drawer--sv .sv-month--next td { background: #f0f8f4; }
.inst-drawer--sv .sv-month--next td:nth-child(5) { font-weight: 600; }
.inst-drawer--sv .sv-month--closed td { color: var(--sv-faint); }
.inst-sv .sv-month__parts { display: block; font-size: 0.75rem; color: var(--sv-soft); }
.inst-sv .sv-month__none,
.inst-sv .sv-month__muted { color: var(--sv-faint); }
.inst-sv .sv-month__ok { color: var(--sv-down); font-weight: 600; }
.inst-sv .sv-month__note { display: block; font-size: 0.75rem; font-weight: 500; color: var(--sv-down); }
.inst-sv .sv-month__note--warn { color: var(--sv-warn); }
.inst-sv .sv-note { margin: 0.6rem 0 0; font-size: 0.8rem; line-height: 1.5; color: var(--sv-soft); max-width: 70ch; }

.inst-sv .sv-pays { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--sv-line); }
.inst-sv .sv-pay {
    display: grid;
    grid-template-columns: 6.5rem minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: baseline;
    padding: 0.65rem 0 0.65rem 0.75rem;
    border-bottom: 1px solid var(--sv-line);
    border-left: 3px solid var(--sv-repaid);
    font-size: 0.9rem;
}
.inst-sv .sv-pay__date { color: var(--sv-soft); font-variant-numeric: tabular-nums; }
.inst-sv .sv-pay__what small { display: block; margin-top: 0.1rem; font-size: 0.78rem; color: var(--sv-soft); }
.inst-sv .sv-pay__sum { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; padding-right: 0.25rem; }
.inst-sv .sv-pay--down { border-left-color: var(--sv-down); background: #f2f7f4; }
.inst-sv .sv-pay--down .sv-pay__what { font-weight: 700; color: var(--sv-down); }
.inst-sv .sv-pay--down .sv-pay__what small { font-weight: 400; }

.inst-sv .sv-fold {
    margin-bottom: 0.75rem;
    border: 1px solid var(--sv-line);
    border-radius: 10px;
    background: #fff;
}
.inst-sv .sv-fold__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 52px;
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    list-style: none;
    border-radius: 10px;
}
.inst-sv .sv-fold__head::-webkit-details-marker { display: none; }
.inst-sv .sv-fold__head:hover { background: #f7f8f9; }
.inst-sv .sv-fold__head:focus-visible { outline: 2px solid var(--sv-down); outline-offset: 2px; }
.inst-sv .sv-fold__title { display: flex; flex-direction: column; gap: 0.1rem; font-weight: 700; font-size: 0.95rem; color: var(--sv-ink); }
.inst-sv .sv-fold__title small { font-weight: 400; font-size: 0.8rem; color: var(--sv-soft); }
.inst-sv .sv-fold__act {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--sv-line);
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--sv-down);
}
.inst-sv .sv-fold__act svg { transition: transform 0.18s ease; }
.inst-sv .sv-fold__hide { display: none; }
.inst-sv .sv-fold[open] .sv-fold__show { display: none; }
.inst-sv .sv-fold[open] .sv-fold__hide { display: inline; }
.inst-sv .sv-fold[open] .sv-fold__act svg { transform: rotate(180deg); }
.inst-sv .sv-fold[open] .sv-fold__head { border-bottom: 1px solid var(--sv-line); border-radius: 10px 10px 0 0; }
.inst-sv .sv-fold__body { padding: 0.75rem 0.9rem 0.9rem; }
.inst-sv .sv-fold .inst-schedule-table-wrap { margin: 0 -0.9rem; max-height: none; }
@media (prefers-reduced-motion: reduce) {
    .inst-sv .sv-fold__act svg { transition: none; }
}

@media (max-width: 760px) {
    /* блоки сверки столбиком: название слева, сумма справа */
    .inst-sv .sv-eq { grid-template-columns: 1fr; }
    .inst-sv .sv-eq__term {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: baseline;
        column-gap: 0.5rem;
        padding: 0.65rem 0.8rem;
    }
    .inst-sv .sv-eq__term + .sv-eq__term { border-left: 0; border-top: 1px solid var(--sv-line); }
    .inst-sv .sv-eq__name { font-size: 0.88rem; color: var(--sv-ink); }
    .inst-sv .sv-eq__sum { font-size: 1.05rem; text-align: right; }
    .inst-sv .sv-eq__split { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 0.1rem 0.9rem; }
    .inst-sv .sv-actions {
        position: sticky;
        bottom: 0;
        z-index: 2;
        margin-left: -1rem;
        margin-right: -1rem;
        padding: 0.6rem 1rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
        background: #fff;
        border-top: 1px solid var(--sv-line);
    }
    .inst-sv .sv-btn { flex: 1 1 0; padding: 0 0.6rem; font-size: 0.86rem; }
    .inst-sv .sv-pay { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0.1rem; }
    .inst-sv .sv-pay__date { grid-column: 1 / -1; font-size: 0.8rem; }

    .inst-drawer--sv table.sv-table tbody { gap: 0; padding: 0; }
    .inst-drawer--sv table.sv-table tbody tr {
        display: grid;
        grid-template-columns: auto 1fr auto;
        column-gap: 0.6rem;
        row-gap: 0.2rem;
        padding: 0.6rem 0.7rem;
        border: 0;
        border-bottom: 1px solid var(--sv-line);
        border-radius: 0;
    }
    .inst-drawer--sv table.sv-table td { display: block; padding: 0 !important; background: none !important; font-size: 0.86rem; line-height: 1.35; }
    .inst-drawer--sv table.sv-table td::before { content: none !important; }
    .inst-drawer--sv table.sv-table td::before {
        min-width: 0 !important;
        font-size: inherit !important;
        font-weight: 400 !important;
        text-transform: none !important;
        letter-spacing: 0 !important;
        color: var(--sv-faint) !important;
    }
    .inst-drawer--sv table.sv-table td:nth-child(1) { color: var(--sv-faint); }
    .inst-drawer--sv table.sv-table td:nth-child(2) { font-weight: 600; }
    .inst-drawer--sv table.sv-table td:nth-child(3) { text-align: right; color: var(--sv-soft); }
    .inst-drawer--sv table.sv-table td:nth-child(3)::before { content: "план " !important; }
    .inst-drawer--sv table.sv-table td:nth-child(4) { grid-column: 1 / span 2; }
    .inst-drawer--sv table.sv-table td:nth-child(4)::before { content: "оплачено " !important; color: var(--sv-faint); }
    .inst-drawer--sv table.sv-table td:nth-child(5) { text-align: right; }
    .inst-drawer--sv table.sv-table tr.sv-month--next { background: #f0f8f4; }
    .inst-drawer--sv table.sv-table td:nth-child(1)::before { content: "№" !important; }
}
.inst-doc-notice {
    margin: 0 0 0.75rem;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    font-size: 0.82rem;
    line-height: 1.4;
}
.inst-doc-notice--ok {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
}
.inst-doc-notice--warn {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}
.inst-doc-notice--error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}
.inst-unit-card {
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}
.inst-unit-card__line {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.35;
}
.inst-dl--compact .inst-dl__row {
    grid-template-columns: 6.5rem 1fr;
    gap: 0.15rem 0.5rem;
    padding: 0.15rem 0;
}
.inst-dl--compact .inst-dl__dt {
    font-size: 0.72rem;
}
.inst-dl--compact .inst-dl__dd {
    font-size: 0.82rem;
    font-weight: 600;
}

@media (min-width: 769px) {
    .inst-drawer {
        top: 0;
        right: 0;
        bottom: 0;
        width: max(50vw, 36rem);
        max-width: 92vw;
        transform: translateX(100%);
    }
    .inst-drawer.is-open {
        transform: translateX(0);
    }
    .inst-page.is-drawer-open .inst-table-card {
        margin-right: 0;
    }
}

@media (max-width: 768px) {
    .inst-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    .inst-stat { padding: 0.65rem 0.5rem; }
    .inst-stat__value { font-size: 1.2rem; }
    .inst-search { max-width: none; }
    .inst-drawer.inst-drawer--sheet {
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }
    .inst-drawer.inst-drawer--sheet.is-open {
        transform: translateY(0);
    }
    .inst-dl__row {
        grid-template-columns: 1fr;
        gap: 0.1rem;
    }
}

.sales-wizard--v2 .sales-wizard__shell {
    max-width: none;
    width: 100%;
    background: #f8fafc;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgb(15 23 42 / 0.08);
    padding: 1.25rem 1.5rem 1.5rem;
}
.sales-wizard--sale-redesign.sales-wizard--v2 .sales-wizard__shell,
.sales-wizard--reassignment-redesign.sales-wizard--v2 .sales-wizard__shell {
    padding: 0;
}
.sales-wizard--v2 .sales-wizard__panel.is-active {
    animation: none;
}
.sales-wizard--v2 .sales-wizard-input {
    min-height: 2.75rem;
    background: #fff;
    color: var(--gray-900, #0f172a);
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
}
.sales-wizard--v2 .sales-wizard-input::placeholder {
    color: #94a3b8;
}
.sales-wizard--v2 .sales-wizard-input:focus {
    outline: none;
    border-color: var(--green-600);
    box-shadow: 0 0 0 3px rgb(22 163 74 / 0.18);
}
.sales-wizard--v2 .sales-wizard-label {
    font-weight: 700;
    color: var(--gray-800, #1e293b);
    margin-bottom: 0.35rem;
}
.sales-wizard--sale-redesign .sw-card {
    margin-bottom: 1rem;
    padding: 1rem 1.1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgb(15 23 42 / 0.04);
}
.sales-wizard--sale-redesign .sw-card__title {
    margin: 0 0 0.75rem;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--gray-800, #1e293b);
    letter-spacing: 0.01em;
}
.sw-hint-muted {
    margin: 0 0 0.65rem;
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.45;
}
.sw-hint-muted--warn { color: #b45309; }
.sw-back-link {
    display: inline-flex;
    align-items: center;
    margin: 0 0 1rem;
    padding: 0;
    border: none;
    background: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--green-700);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.sw-back-link:hover { color: var(--green-800); }
.sw-client-picker__search-wrap {
    position: relative;
    margin-bottom: 0.65rem;
}
.sw-client-picker__results {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    margin: 0;
    padding: 0.35rem 0;
    list-style: none;
    max-height: 14rem;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgb(15 23 42 / 0.12);
}
.sw-client-picker__pick {
    display: block;
    width: 100%;
    padding: 0.55rem 0.85rem;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.9rem;
    color: var(--gray-800);
    cursor: pointer;
}
.sw-client-picker__pick:hover {
    background: var(--green-50);
    color: var(--green-900);
}
.sw-client-picker__empty {
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
    color: #64748b;
}
.sw-client-picker__selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
    padding: 0.75rem 0.9rem;
    background: var(--green-50);
    border: 1px solid rgb(22 163 74 / 0.25);
    border-radius: 10px;
}
.sw-client-picker__selected-label {
    display: block;
    font-weight: 700;
    color: var(--green-900);
}
.sw-client-picker__selected-phone {
    display: block;
    font-size: 0.85rem;
    color: #64748b;
}
.sw-client-picker__new { margin-top: 0.25rem; }
.sw-docs-progress {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin: 1rem 0;
    text-align: left;
}
.sw-doc-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}
.sw-doc-card__icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--gray-100);
}
.sw-doc-card__title {
    display: block;
    font-weight: 700;
    color: var(--gray-800);
}
.sw-doc-card__status {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.85rem;
    color: #64748b;
}
.sw-doc-card.is-loading .sw-doc-card__icon {
    background: conic-gradient(from 0deg, var(--green-600) 0 25%, #e2e8f0 25% 100%);
    animation: sw-doc-spin 0.8s linear infinite;
}
.sw-doc-card.is-done {
    border-color: rgb(22 163 74 / 0.35);
    background: #f0fdf4;
}
.sw-doc-card.is-done .sw-doc-card__icon {
    background: var(--green-600) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.sw-doc-card.is-done .sw-doc-card__status { color: var(--green-800); }
.sw-doc-card.is-error {
    border-color: #fecaca;
    background: #fef2f2;
}
.sw-doc-card.is-error .sw-doc-card__icon { background: #fecaca; }
.sw-doc-card.is-error .sw-doc-card__status { color: #b91c1c; }
/* «Посмотреть» — только у готового документа (после подтверждения сделки) */
.sw-doc-card { align-items: center; }
.sw-doc-card__body { flex: 1; min-width: 0; }
.sw-doc-card__open {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
    min-height: 40px;
    background: #fff;
}
.sw-doc-card:not(.is-done) .sw-doc-card__open { display: none; }

/* Скан паспорта: кнопка в форме, полноэкранный сканер, запасная шторка, плашка результата */
.sw-scan {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid #d7e5dc;
    border-radius: 14px;
    background: #f3faf6;
    color: #14231b;
    font: inherit;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
/* общие правила кнопок мастера задают фиксированную высоту — у этой кнопки два ряда текста */
.sales-wizard .sw-scan,
.sw-scan {
    height: auto !important;
    min-height: 72px !important;
    line-height: 1.3;
    white-space: normal;
}
.sw-scan:hover { border-color: #16a34a; }
.sw-scan:active { transform: scale(0.99); }
.sw-scan:focus-visible { outline: 2px solid #16a34a; outline-offset: 2px; }
.sw-scan__icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #16a34a;
    color: #fff;
}
.sw-scan__text { display: flex; flex-direction: column; gap: 0.1rem; flex: 1; min-width: 0; }
.sw-scan__text b { font-size: 1rem; font-weight: 700; }
.sw-scan__text small { font-size: 0.82rem; color: #5b6b62; }
.sw-scan__chevron { flex-shrink: 0; color: #7c8a82; }

.sales-wizard-input.sw-scan-ok { border-color: #16a34a; background: #f3faf6; }
.sales-wizard-input.sw-scan-check { border-color: #d97706; background: #fffaf0; }
.sw-scan-note { display: block; margin-top: 0.3rem; font-size: 0.78rem; color: #a85f00; }
html.pscan-open { overflow: hidden; }

/* полноэкранный сканер */
.pscam {
    position: fixed;
    inset: 0;
    z-index: 460;
    background: #0b0d0c;
    color: #fff;
    overflow: hidden;
}
.pscam[hidden] { display: none; }
.pscam__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pscam[data-mode="review"] .pscam__video,
.pscam[data-mode="busy"] .pscam__video,
.pscam[data-mode="failed"] .pscam__video { visibility: hidden; }
.pscam__top {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: calc(0.5rem + env(safe-area-inset-top, 0px)) 0.75rem 0.5rem;
}
.pscam__icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgb(255 255 255 / 0.14);
    color: #fff;
    cursor: pointer;
}
.pscam__title { margin: 0 auto 0 0.25rem; display: flex; flex-direction: column; line-height: 1.25; }
.pscam__title b { font-size: 1rem; }
.pscam__title span { font-size: 0.8rem; color: rgb(255 255 255 / 0.7); }
.pscam__frame {
    position: absolute;
    left: 50%;
    top: 45%;
    width: min(88vw, calc(62vh * 1.585));
    aspect-ratio: 85.6 / 54;
    transform: translate(-50%, -50%);
    border-radius: 14px;
    box-shadow: 0 0 0 200vmax rgb(11 13 12 / 0.62);
}
.pscam[data-mode="busy"] .pscam__frame,
.pscam[data-mode="failed"] .pscam__frame { opacity: 0.25; }
.pscam__shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 14px; }
.pscam__frame i { position: absolute; width: 30px; height: 30px; border: 3px solid #fff; }
.pscam__frame i:nth-of-type(1) { left: -3px; top: -3px; border-right: 0; border-bottom: 0; border-radius: 14px 0 0 0; }
.pscam__frame i:nth-of-type(2) { right: -3px; top: -3px; border-left: 0; border-bottom: 0; border-radius: 0 14px 0 0; }
.pscam__frame i:nth-of-type(3) { left: -3px; bottom: -3px; border-right: 0; border-top: 0; border-radius: 0 0 0 14px; }
.pscam__frame i:nth-of-type(4) { right: -3px; bottom: -3px; border-left: 0; border-top: 0; border-radius: 0 0 14px 0; }
.pscam__hint {
    position: absolute;
    left: 50%;
    top: calc(45% + min(88vw, calc(62vh * 1.585)) * 54 / 85.6 / 2 + 1rem);
    width: min(520px, calc(100% - 32px));
    margin: 0;
    transform: translateX(-50%);
    font-size: 0.92rem;
    line-height: 1.4;
    text-align: center;
    color: rgb(255 255 255 / 0.9);
}
.pscam__hint[hidden] { display: none; }
.pscam__hint.is-error {
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: #3b1212;
    color: #fecaca;
}
.pscam__busy {
    position: absolute;
    left: 50%;
    top: 45%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}
.pscam__busy[hidden] { display: none; }
.pscam__busy b { font-size: 1.05rem; }
.pscam__busy small { color: rgb(255 255 255 / 0.65); }
.pscam__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgb(255 255 255 / 0.2);
    border-top-color: #22c55e;
    border-radius: 50%;
    animation: pscam-spin 0.8s linear infinite;
}
@keyframes pscam-spin { to { transform: rotate(360deg); } }
.pscam__bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 1rem 1rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
}
.pscam__bar [hidden] { display: none !important; }
.pscam__live { display: flex; justify-content: center; }
.pscam__shutter {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    border: 4px solid #fff;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}
.pscam__shutter span { width: 60px; height: 60px; border-radius: 50%; background: #fff; transition: transform 0.12s ease; }
.pscam__shutter:active span { transform: scale(0.9); }
.pscam__review, .pscam__failed { display: flex; gap: 0.75rem; max-width: 520px; margin: 0 auto; }
.pscam__btn {
    flex: 1;
    min-height: 52px;
    border: 0;
    border-radius: 14px;
    background: #16a34a;
    color: #fff;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}
.pscam__btn--ghost { background: rgb(255 255 255 / 0.14); }
.pscam__icon:focus-visible, .pscam__btn:focus-visible, .pscam__shutter:focus-visible { outline: 3px solid #22c55e; outline-offset: 3px; }
.pscam.is-flash::after { content: ""; position: absolute; inset: 0; z-index: 3; background: #fff; opacity: 0.6; }

/* запасная шторка, когда камера на странице недоступна (http://) */
.pscan {
    position: fixed;
    inset: 0;
    z-index: 450;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgb(15 23 42 / 0.45);
}
.pscan[hidden] { display: none; }
.pscan__box {
    width: min(520px, 100%);
    padding: 1.1rem 1.1rem 1rem;
    border-radius: 18px;
    background: #fff;
}
.pscan__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.9rem; }
.pscan__head h2 { margin: 0; font-size: 1.1rem; }
.pscan__close {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: #f1f4f2;
    color: #14231b;
    cursor: pointer;
}
.pscan__note { margin: -0.4rem 0 0.8rem; font-size: 0.84rem; color: #a85f00; }
.pscan__tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.pscan__tile { display: flex; flex-direction: column; gap: 0.4rem; cursor: pointer; }
.pscan__thumb {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 85.6 / 54;
    border: 1.5px dashed #c5d3ca;
    border-radius: 12px;
    background: #f6f9f7;
    color: #5b6b62;
    overflow: hidden;
}
.pscan__tile.is-set .pscan__thumb { border-style: solid; border-color: #16a34a; }
.pscan__thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pscan__tile-title { font-size: 0.88rem; font-weight: 600; text-align: center; }
.pscan__tile:focus-within .pscan__thumb { outline: 2px solid #16a34a; outline-offset: 2px; }
.pscan__error { margin: 0.8rem 0 0; font-size: 0.86rem; color: #b91c1c; }
.pscan__error[hidden] { display: none; }
.pscan__run { width: 100%; min-height: 50px; margin-top: 1rem; border-radius: 14px; }
.pscan__run.is-busy { opacity: 0.75; }
@media (max-width: 640px) {
    .pscan { align-items: flex-end; padding: 0; }
    .pscan__box { border-radius: 20px 20px 0 0; padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); }
}

/* плашка результата сканирования */
.pscan-toast {
    position: fixed;
    left: 50%;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    z-index: 470;
    width: min(440px, calc(100% - 32px));
    padding: 0.8rem 1rem;
    border-radius: 12px;
    background: #14231b;
    color: #fff;
    font-size: 0.9rem;
    line-height: 1.35;
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.25);
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.pscan-toast.is-shown { opacity: 1; transform: translate(-50%, 0); }
.pscan-toast.is-warn { background: #3a2a06; }
.pscan-toast.is-info { background: #13294b; }
@media (prefers-reduced-motion: reduce) {
    .pscam__spinner { animation-duration: 2s; }
    .pscan-toast, .pscam__shutter span { transition: none; }
}
@keyframes sw-doc-spin {
    to { transform: rotate(360deg); }
}
.sales-wizard--sale-redesign .sw-contract-number__preview {
    margin: 0.85rem 0 0;
    font-size: 1.15rem;
}
.sales-wizard--sale-redesign .sw-contract-number__preview strong {
    font-size: 1.35rem;
    color: var(--green-900);
}
.sales-wizard__link {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--green-700);
    text-decoration: underline;
    text-underline-offset: 2px;
}
@media (max-width: 767px) {
    .sales-wizard--v2:not(.sales-wizard--sale-redesign) .sales-wizard__shell {
        padding: 1rem;
    }
    .sales-wizard--sale-redesign .sales-wizard__head,
    .sales-wizard--sale-redesign .sales-wizard__progress,
    .sales-wizard--sale-redesign .sales-wizard__panel.is-active,
    .sales-wizard--sale-redesign .sales-wizard__footer {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }
    .sales-wizard-fields--grid {
        grid-template-columns: 1fr;
    }
    .sw-pricing-total {
        position: static;
    }
}
.sales-wizard-fields--grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem 1rem;
}
.sales-wizard-field--full { grid-column: 1 / -1; }
.sw-pricing {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.sw-pricing__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.65rem 0.85rem;
    background: var(--gray-50);
    border-radius: 10px;
    border: 1px solid rgb(22 163 74 / 0.1);
}
.sw-pricing__label { font-weight: 600; color: var(--gray-600); }
.sw-pricing__value { font-size: 1.1rem; font-weight: 800; color: var(--green-900); }
.sw-currency-toggle {
    border: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.sw-currency-toggle__legend {
    flex: 1 1 100%;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
    margin-bottom: 0.35rem;
}
.sw-currency-toggle__opt {
    flex: 1;
    min-width: 8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 0.75rem;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: border-color 0.15s, background 0.15s;
}
.sw-currency-toggle__opt:has(input:checked) {
    border-color: var(--green-600);
    background: var(--green-50);
    color: var(--green-900);
}
.sw-currency-toggle__opt input { accent-color: var(--green-600); }
.sw-pricing__hint-secondary {
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
    color: var(--gray-500);
}
.sw-pricing-total {
    position: sticky;
    bottom: 0;
    padding: 1rem 1.1rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid rgb(22 163 74 / 0.2);
    box-shadow: 0 4px 20px rgb(22 163 74 / 0.12);
}
.sw-pricing-total__label {
    margin: 0 0 0.25rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--green-800);
}
.sw-pricing-total__primary {
    margin: 0;
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--green-950);
    line-height: 1.15;
}
.sw-pricing-total__secondary {
    margin: 0.35rem 0 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--green-800);
    opacity: 0.85;
}
.sales-wizard-hint--warn { color: #b45309; }
.sw-custom-fields__title {
    margin: 1.25rem 0 0.65rem;
    font-size: 0.95rem;
    font-weight: 700;
}
.sw-docs-folder {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: 10px;
}
.sw-docs-folder__label { font-size: 0.85rem; color: var(--gray-600); }
.sw-docs-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.sw-docs-generated {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    font-size: 0.85rem;
    color: var(--green-800);
}
.sw-congrats {
    text-align: center;
    padding: 1.5rem 1rem 1rem;
}
.sw-congrats__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #fff;
    margin: 0 auto 1rem;
    box-shadow: 0 12px 28px rgba(22, 163, 74, 0.25);
}
.sw-congrats__title {
    margin: 0 0 0.35rem;
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--gray-900, #0f172a);
}
.sw-congrats__sub {
    margin: 0 0 1.25rem;
    color: var(--gray-600, #475569);
    font-size: 0.95rem;
}
.sw-congrats .sw-docs-folder,
.sw-congrats .sw-docs-actions,
.sw-congrats .sw-docs-generated,
.sw-congrats .sales-wizard-hint {
    text-align: left;
}
.sw-congrats .sw-docs-actions { justify-content: center; }
.sw-congrats__finish {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
}
.sales-wizard-hint.is-error { color: #b91c1c; }
.btn--lg {
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
}
.doc-custom-fields {
    margin-bottom: 1.5rem;
    padding: 1rem 1.15rem;
    background: rgb(255 255 255 / 0.9);
    border: 1px solid rgb(22 163 74 / 0.12);
    border-radius: var(--radius);
}
.doc-custom-fields__title { margin: 0 0 0.35rem; font-size: 1.05rem; }
.doc-custom-fields__sub { margin: 0 0 0.85rem; font-size: 0.85rem; color: var(--gray-600); }
.doc-custom-fields__row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.doc-custom-fields__row .sales-wizard-input { flex: 1; min-width: 8rem; }
.doc-custom-fields__check {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    white-space: nowrap;
}
.doc-custom-fields__list {
    list-style: none;
    margin: 0.85rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.doc-custom-fields__item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    background: var(--gray-50);
    border-radius: 8px;
}
.doc-custom-fields__token {
    font-family: ui-monospace, monospace;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--green-800);
}
.doc-custom-fields__label { flex: 1; font-weight: 600; }
.doc-custom-fields__empty { color: var(--gray-500); font-size: 0.88rem; }

.doc-page-tabs {
    display: flex;
    gap: 0.35rem;
    margin: 0 0 1.25rem;
    padding: 0.25rem;
    background: rgb(255 255 255 / 0.7);
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    width: fit-content;
}
.doc-page-tabs__tab {
    padding: 0.5rem 1.1rem;
    border-radius: 9px;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--gray-600);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.doc-page-tabs__tab.is-active {
    background: var(--green-600);
    color: #fff;
}
.doc-files-panel { margin-top: 0.5rem; }
.doc-files-empty {
    text-align: center;
    padding: 2.5rem 1.5rem;
    background: #fff;
    border-radius: 14px;
    border: 1px dashed var(--gray-300);
}
.doc-files-empty__text { margin: 0 0 1rem; color: var(--gray-600); }
.doc-files-browser {
    background: #fff;
    border-radius: 14px;
    border: 1px solid var(--gray-200);
    box-shadow: 0 6px 24px rgb(15 23 42 / 0.06);
    overflow: hidden;
}
.doc-files-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    background: var(--gray-50);
}
.doc-files-toolbar__path { font-weight: 600; }
.doc-files-toolbar__label { color: var(--gray-500); margin-right: 0.35rem; }
.doc-files-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.88rem;
}
.doc-files-crumb {
    border: none;
    background: transparent;
    color: var(--green-700);
    font-weight: 600;
    cursor: pointer;
    padding: 0.15rem 0.35rem;
    border-radius: 6px;
}
.doc-files-crumb:hover { background: var(--green-50); }
.doc-files-crumb-sep { color: var(--gray-400); }
.doc-files-layout {
    display: grid;
    grid-template-columns: 1fr min(18rem, 35%);
    min-height: 280px;
}
.doc-files-list {
    list-style: none;
    margin: 0;
    padding: 0.5rem;
    overflow: auto;
    max-height: min(60vh, 520px);
}
.doc-files-list__btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
}
.doc-files-list__btn:hover { background: var(--gray-50); }
.doc-files-list__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.doc-files-list__empty {
    padding: 1.5rem;
    color: var(--gray-500);
    text-align: center;
}
.doc-files-preview {
    border-left: 1px solid var(--gray-100);
    padding: 1rem;
    background: var(--gray-50);
}
.doc-files-preview__title {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    word-break: break-word;
}
.doc-files-preview__meta {
    margin: 0 0 0.85rem;
    font-size: 0.82rem;
    color: var(--gray-500);
}
.doc-files-preview__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.doc-files-hint { margin-top: 1rem; }
.doce-layout--local { grid-template-columns: 1fr; }
.doce-layout--local .doce-editor-wrap { max-width: none; }
.doce-topbar__hint {
    font-size: 0.82rem;
    color: var(--gray-500);
    font-style: italic;
}

@media (max-width: 768px) {
    .doc-files-layout { grid-template-columns: 1fr; }
    .doc-files-preview { border-left: none; border-top: 1px solid var(--gray-100); }
}

/* ── Documents: folder finder + templates stage ───────────── */
.doc-page--v2 {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - 3.5rem);
    padding: 0;
}
.doc-page--v2 > .doc-page__bg { opacity: 0.55; }

.doc-topbar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid rgb(15 23 42 / 0.06);
    background: rgb(255 255 255 / 0.82);
    backdrop-filter: blur(12px);
}
.doc-topbar__main { min-width: 0; flex: 1; }
.doc-topbar__title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--gray-900);
}
.doc-topbar__sub {
    margin: 0.15rem 0 0;
    font-size: 0.82rem;
    color: var(--gray-500);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.doc-topbar__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.doc-topbar__icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.65rem;
    height: 2.65rem;
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    background: #fff;
    color: var(--gray-700);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.15s, color 0.15s;
    text-decoration: none;
}
.doc-topbar__icon-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgb(15 23 42 / 0.08);
    color: var(--green-700);
    border-color: var(--green-200);
}
.doc-topbar__icon-btn.is-active {
    background: var(--green-600);
    border-color: var(--green-600);
    color: #fff;
}
.doc-topbar__icon-btn--primary {
    background: var(--green-600);
    border-color: var(--green-600);
    color: #fff;
}
.doc-topbar__icon-btn--primary:hover {
    background: var(--green-700);
    color: #fff;
}
.doc-topbar__icon-btn.is-open {
    background: var(--green-50);
    border-color: var(--green-300);
    color: var(--green-800);
}

.doc-folder-popover {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 1.25rem;
    z-index: 20;
    width: min(320px, calc(100vw - 2rem));
    padding: 1rem 1.1rem 1.1rem;
    border-radius: 14px;
    border: 1px solid var(--gray-200);
    background: #fff;
    box-shadow: 0 12px 40px rgb(15 23 42 / 0.12);
    animation: docColumnIn 0.22s ease both;
}
.doc-folder-popover[hidden] { display: none !important; }
.doc-folder-popover__title {
    margin: 0 0 0.4rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-900);
}
.doc-folder-popover__text {
    margin: 0 0 0.75rem;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--gray-600);
}
.doc-folder-popover__warn {
    margin: 0 0 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    font-size: 0.8rem;
    line-height: 1.45;
    color: #92400e;
    background: #fff8e6;
    border: 1px solid #f5d78e;
}
.doc-folder-popover__warn[hidden] { display: none !important; }
.doc-folder-popover__current {
    margin: 0 0 0.85rem;
    font-size: 0.82rem;
    color: var(--gray-700);
}
.doc-folder-popover__label {
    color: var(--gray-500);
    margin-right: 0.25rem;
}
.doc-folder-popover__btn {
    width: 100%;
}

.doc-stage {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.doc-stage[hidden] { display: none !important; }

/* File finder */
.doc-finder {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
}
.doc-finder__main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}
.doc-finder__columns-wrap {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.doc-finder__columns {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1rem 1.25rem 1.25rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    min-height: calc(100dvh - 9rem);
}
.doc-finder__column {
    flex: 0 0 min(280px, 78vw);
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    min-height: min(420px, calc(100dvh - 10rem));
    max-height: calc(100dvh - 9rem);
    background: rgb(255 255 255 / 0.92);
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    box-shadow: 0 8px 28px rgb(15 23 42 / 0.06);
    animation: docColumnIn 0.35s ease both;
}
@keyframes docColumnIn {
    from { opacity: 0; transform: translateX(14px); }
    to { opacity: 1; transform: none; }
}
.doc-finder__column-head {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.doc-finder__column-list {
    list-style: none;
    margin: 0;
    padding: 0.5rem;
    overflow-y: auto;
    flex: 1;
    min-height: 200px;
}
.doc-finder__item { margin: 0; }
.doc-finder__btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
    cursor: pointer;
    font: inherit;
    color: var(--gray-800);
    transition: background 0.15s, transform 0.15s;
}
.doc-finder__btn:hover {
    background: var(--gray-50);
    transform: translateX(2px);
}
.doc-finder__btn.is-active {
    background: var(--green-50);
    color: var(--green-800);
    font-weight: 600;
}
.doc-finder__btn-icon {
    font-size: 1.35rem;
    line-height: 1;
    flex-shrink: 0;
}
.doc-finder__btn-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.doc-finder__empty-col {
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--gray-500);
    font-size: 0.88rem;
}

.doc-finder__preview {
    flex: 0 0 min(300px, 32vw);
    border-left: 1px solid var(--gray-200);
    background: var(--gray-50);
    padding: 1.1rem 1.15rem;
    overflow-y: auto;
    animation: docColumnIn 0.3s ease both;
}
.doc-finder__preview[hidden] { display: none !important; }
.doc-finder__preview-title {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    font-weight: 700;
    word-break: break-word;
}
.doc-finder__preview-meta {
    margin: 0 0 1rem;
    font-size: 0.82rem;
    color: var(--gray-500);
}
.doc-finder__preview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.doc-finder__placeholder {
    margin: 0;
    padding: 2rem 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--gray-500);
    line-height: 1.5;
}
.doc-finder__placeholder[hidden] { display: none !important; }
.doc-finder-empty {
    display: none !important;
}
.doc-finder-unsupported {
    padding: 1.25rem;
    margin: 1rem 1.25rem 0;
    border-radius: 12px;
    background: #fff8e6;
    border: 1px solid #f5d78e;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--gray-700);
}
.doc-finder-fallback {
    margin: 0.85rem 1.25rem 1rem;
    padding: 1.15rem 1.25rem;
    border-radius: 12px;
    background: rgb(240 253 244 / 0.85);
    border: 1px solid rgb(22 163 74 / 0.18);
}
.doc-finder-fallback[hidden] { display: none !important; }
.doc-finder-fallback__title {
    margin: 0 0 0.65rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--green-900);
}
.doc-finder-fallback__list {
    margin: 0;
    padding-left: 1.15rem;
    font-size: 0.86rem;
    line-height: 1.55;
    color: var(--gray-700);
}
.doc-finder-fallback__list li + li {
    margin-top: 0.45rem;
}

/* Templates stage */
.doc-templates-stage {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
}
.doc-flash {
    margin: 0 1rem 0.75rem;
    padding: 0.65rem 1rem;
    border-radius: 10px;
    background: var(--green-50);
    border: 1px solid var(--green-200);
    font-size: 0.9rem;
}
.doc-orphan-banner {
    margin: 0 1rem 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: #fff8e6;
    border: 1px solid #f5d78e;
    font-size: 0.88rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem 1rem;
}
.doc-orphan-banner__text {
    margin: 0;
    line-height: 1.45;
}
.doc-orphan-banner__form {
    margin: 0;
    flex-shrink: 0;
}
.doc-properties-sidebar {
    flex: 0 0 min(240px, 30vw);
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 1rem;
    overflow-y: auto;
    border-right: 1px solid var(--gray-200);
    background: rgb(255 255 255 / 0.72);
}
.doc-properties-sidebar__title {
    margin: 0 0 0.35rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gray-500);
}
.doc-properties-sidebar__empty {
    margin: 0;
    font-size: 0.85rem;
    color: var(--gray-600);
    line-height: 1.4;
}
.doc-property-tile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    text-align: left;
    text-decoration: none;
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    background: #fff;
    padding: 0.75rem 0.9rem;
    color: var(--gray-800);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.15s;
}
.doc-property-tile:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgb(15 23 42 / 0.07);
    border-color: var(--green-200);
}
.doc-property-tile.is-active {
    border-color: var(--green-500);
    background: linear-gradient(135deg, var(--green-50), #fff);
    box-shadow: 0 6px 18px rgb(22 163 74 / 0.1);
}
.doc-property-tile__icon { font-size: 1.5rem; line-height: 1; flex-shrink: 0; }
.doc-property-tile__body { min-width: 0; flex: 1; }
.doc-property-tile__label {
    display: block;
    font-weight: 700;
    font-size: 0.92rem;
    line-height: 1.25;
}
.doc-property-tile__count {
    display: block;
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-top: 0.1rem;
}
.doc-templates-content__head-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
}
.doc-templates-content__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.doc-templates-content__warn {
    margin: 0.5rem 0 0;
    font-size: 0.88rem;
    color: #b45309;
}
.doc-tpl-toolbar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.65rem;
    flex-wrap: wrap;
}
.doc-tpl-toolbar__label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-500);
    white-space: nowrap;
}
.doc-tpl-select {
    flex: 1;
    min-width: 12rem;
    max-width: 22rem;
    padding: 0.45rem 2rem 0.45rem 0.65rem;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.55rem center;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--gray-800);
    appearance: none;
    cursor: pointer;
}
.doc-tpl-select:focus {
    outline: none;
    border-color: var(--green-400);
    box-shadow: 0 0 0 3px rgb(34 197 94 / 0.12);
}
.doc-tpl-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.doc-tpl-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.doc-tpl-row:hover {
    border-color: var(--green-200);
    box-shadow: 0 2px 8px rgb(15 23 42 / 0.04);
}
.doc-tpl-row__main {
    display: flex;
    align-items: center;
    gap: 0.5rem 0.75rem;
    min-width: 0;
    flex: 1;
    flex-wrap: wrap;
}
.doc-tpl-row__name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 14rem;
}
.doc-tpl-row__purpose {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    background: var(--blue-50, #eff6ff);
    color: var(--blue-700, #1d4ed8);
    white-space: nowrap;
}
.doc-tpl-row__date {
    font-size: 0.72rem;
    color: var(--gray-500);
    white-space: nowrap;
}
.doc-tpl-row__actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}
.doc-tpl-row__btn {
    border: 1px solid var(--gray-200);
    background: #fff;
    border-radius: 8px;
    padding: 0.28rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
    transition: background 0.12s, border-color 0.12s;
}
.doc-tpl-row__btn:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}
.doc-tpl-row__btn--primary {
    border-color: var(--green-300);
    color: var(--green-800);
    background: var(--green-50);
}
.doc-tpl-row__btn--primary:hover {
    background: var(--green-100);
}
.doc-tpl-row__btn--danger {
    min-width: 1.75rem;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
    color: #b91c1c;
    border-color: #fecaca;
}
.doc-tpl-row__btn--danger:hover {
    background: #fef2f2;
}
.doc-tpl-list .doc-empty {
    border: 1px dashed var(--gray-200);
    border-radius: 12px;
    padding: 2rem 1rem;
}
.doc-empty__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.75rem;
}
.doc-empty--stage {
    padding: 3rem 1.5rem;
    text-align: center;
}
.doce-field__readonly {
    margin: 0;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    font-weight: 600;
    font-size: 0.9rem;
}
.doc-templates-folders {
    flex: 0 0 min(260px, 32vw);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    overflow-y: auto;
    border-right: 1px solid var(--gray-200);
    background: rgb(255 255 255 / 0.65);
}
.doc-folder-tile {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    text-align: left;
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    background: #fff;
    padding: 0.85rem 1rem;
    cursor: pointer;
    font: inherit;
    color: var(--gray-800);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.15s, background 0.15s;
}
.doc-folder-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgb(15 23 42 / 0.08);
    border-color: var(--green-200);
}
.doc-folder-tile.is-active {
    border-color: var(--green-500);
    background: linear-gradient(135deg, var(--green-50), #fff);
    box-shadow: 0 8px 20px rgb(22 163 74 / 0.12);
}
.doc-folder-tile__icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}
.doc-folder-tile__body { min-width: 0; flex: 1; }
.doc-folder-tile__label {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
}
.doc-folder-tile__count {
    display: block;
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-top: 0.15rem;
}

.doc-templates-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}
.doc-templates-content__head {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
}
.doc-templates-content__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
}
.doc-templates-content__scroll {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem 1.5rem;
}
.doc-templates-grid .doc-card[hidden],
.doc-tpl-list .doc-tpl-row[hidden] { display: none !important; }

.doc-settings-drawer {
    border-top: 1px solid var(--gray-200);
    background: rgb(255 255 255 / 0.7);
}
.doc-settings-drawer__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.75rem 1.25rem;
    border: none;
    background: transparent;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    color: var(--gray-700);
}
.doc-settings-drawer__body {
    padding: 0 1.25rem 1.25rem;
    max-height: 40vh;
    overflow-y: auto;
}
.doc-settings-drawer__body[hidden] { display: none !important; }

@media (max-width: 900px) {
    .doc-finder { flex-direction: column; }
    .doc-finder__preview {
        flex: none;
        border-left: none;
        border-top: 1px solid var(--gray-200);
        max-height: 40vh;
    }
    .doc-templates-stage { flex-direction: column; }
    .doc-templates-folders {
        flex: none;
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
        scroll-snap-type: x proximity;
    }
    .doc-folder-tile {
        flex: 0 0 min(200px, 70vw);
        scroll-snap-align: start;
    }
}
@media (max-width: 768px) {
    .doc-topbar { padding: 0.65rem 0.85rem; }
    .doc-topbar__title { font-size: 1.15rem; }
}
@media (prefers-reduced-motion: reduce) {
    .doc-finder__column,
    .doc-finder__preview,
    .doc-folder-tile { animation: none; transition: none; }
    .doc-folder-tile:hover { transform: none; }
}

@media (max-width: 900px) {
    .sales-ws-bar {
        flex-wrap: wrap;
        align-items: stretch;
        gap: 0.4rem;
        padding: 0.4rem 0.5rem;
    }
    .sales-ws-bar__center {
        order: 3;
        flex: 1 1 100%;
        flex-wrap: wrap;
    }
    .sales-ws-bar__chips {
        flex: 1 1 100%;
        order: 4;
    }
    .sales-ws-bar__meta {
        margin-left: auto;
    }
}
@media (max-width: 1100px) {
    .sales-modes { grid-template-columns: repeat(2, 1fr); }
    .sales-ws-layout {
        flex-direction: column;
        flex: 1 1 0%;
        min-height: 0;
    }
    .sales-workspace.is-detail .sales-ws-map-pane {
        flex: 0 0 42%;
        max-width: none;
        min-height: 0;
        overflow: hidden;
    }
    .sales-workspace.is-detail .sales-ws-detail-pane {
        flex: 1 1 0%;
        min-height: 0;
        width: 100%;
        overflow: hidden;
        border-left: none;
        border-top: 1px solid rgb(22 163 74 / 0.12);
    }
    .sales-detail-facts { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .sales-modes { grid-template-columns: 1fr; }
    .sales-recent__item {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }
    .sales-wizard-field-row { grid-template-columns: 1fr; }
    .sales-wizard-fields--grid { grid-template-columns: 1fr; }
}

/* ── Document editor: печать только содержимого (резерв для Ctrl+P) ── */
@media print {
    body:has(.doce-page) .flash,
    body:has(.doce-page) .sidebar,
    body:has(.doce-page) .app-shell > .sidebar,
    body:has(.doce-page) .app-content__head,
    body:has(.doce-page) .doce-page__bg,
    body:has(.doce-page) .doce-topbar,
    body:has(.doce-page) .doce-sidebar,
    body:has(.doce-page) .doce-sidebar-toggle,
    body:has(.doce-page) .doce-toolbar,
    body:has(.doce-page) .doc-modal-overlay,
    body:has(.doce-page) .doc-toast {
        display: none !important;
    }

    body:has(.doce-page) .app-shell,
    body:has(.doce-page) .app-content,
    body:has(.doce-page) .doce-page,
    body:has(.doce-page) .doce-layout,
    body:has(.doce-page) .doce-editor-wrap,
    body:has(.doce-page) .doce-paper {
        display: block !important;
        position: static !important;
        width: auto !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        box-shadow: none !important;
        border: none !important;
    }

    body:has(.doce-page) .doce-editor {
        width: 100% !important;
        max-width: none !important;
        min-height: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    body:has(.doce-page) .doce-editor:empty::before {
        display: none !important;
    }

    body:has(.doce-page) .doce-var {
        background: none !important;
        border: none !important;
        color: inherit !important;
        font-family: inherit !important;
        font-weight: inherit !important;
        padding: 0 !important;
    }

    body:has(.doce-page) .doce-page-guide {
        display: none !important;
    }

    body:has(.doce-page) .doce-pagebreak {
        page-break-after: always;
        break-after: page;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        color: transparent !important;
        background: none !important;
        font-size: 0 !important;
    }
}

/* ============================================================
   CASHBOX PAGE
   Крупный баланс, две главные кнопки, лента операций по дням.
   ============================================================ */
.app-content:has(.cashbox-page) {
    background: var(--cb-mist);
}

.cashbox-page {
    max-width: 72rem;
    margin: 0 auto;
    --cash-in: #0e6546;
    --cash-in-soft: #dcf5e9;
    --cash-in-strong: #2bb07f;
    --cash-out: #a11d35;
    --cash-out-soft: #ffe2e6;
    padding-bottom: 3rem;
    font-family: var(--cb-font);
    color: var(--cb-ink);
}

/* Hero: баланс + действия */
.cashbox-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem 2rem;
    margin-bottom: 1.25rem;
    padding: 1.75rem 2rem;
    border-radius: 28px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
}

.cashbox-hero__label {
    font-size: 0.95rem;
    color: var(--cb-muted);
}

.cashbox-hero__value {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.35rem 0 0;
    line-height: 1;
}

.cashbox-balance-bar__value {
    font-size: 3.25rem;
    font-weight: 650;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    color: var(--cb-ink);
}

.cashbox-balance-bar__value--negative {
    color: var(--cash-out);
}

.cashbox-hero__currency {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--cb-faint);
}

.cashbox-hero__side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}

.cashbox-hero__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Buttons */
.cashbox-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    height: 2.75rem;
    padding: 0 1.25rem;
    border: 0;
    border-radius: 999px;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.cashbox-btn[hidden] {
    display: none;
}

.cashbox-btn:focus-visible,
.cashbox-icon-btn:focus-visible,
.cashbox-tab:focus-visible {
    outline: 2px solid var(--cb-accent);
    outline-offset: 2px;
}

.cashbox-btn--income {
    background: var(--cb-ink);
    color: #fff;
}

.cashbox-btn--income:hover {
    background: #343a4d;
}

.cashbox-btn--expense {
    background: var(--cash-out-soft);
    color: var(--cash-out);
}

.cashbox-btn--expense:hover {
    background: #ffd2d9;
}

.cashbox-btn--ghost {
    background: var(--cb-mist);
    color: var(--cb-ink);
}

.cashbox-btn--ghost:hover {
    background: #e3e7ef;
}

.cashbox-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.cashbox-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: var(--cb-mist);
    color: var(--cb-muted);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.cashbox-icon-btn:hover {
    background: #e3e7ef;
    color: var(--cb-ink);
}

/* Select pill */
.cashbox-select {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.cashbox-select__input {
    appearance: none;
    -webkit-appearance: none;
    height: 2.5rem;
    max-width: 18rem;
    padding: 0 2.4rem 0 1.1rem;
    border: 0;
    border-radius: 999px;
    background: var(--cb-mist);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--cb-ink);
    text-overflow: ellipsis;
    cursor: pointer;
}

.cashbox-select__input:focus-visible {
    outline: 2px solid var(--cb-accent);
    outline-offset: 2px;
}

.cashbox-select__chevron {
    position: absolute;
    right: 0.95rem;
    color: var(--cb-faint);
    pointer-events: none;
}

.cashbox-select--sm .cashbox-select__input {
    background: var(--cb-surface);
    box-shadow: inset 0 0 0 1px var(--cb-line);
}

/* Tabs */
.cashbox-tabs {
    display: inline-flex;
    gap: 2px;
    margin: 0 0 1rem;
    padding: 4px;
    border-radius: 999px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
}

.cashbox-tab {
    height: 2.25rem;
    padding: 0 1.1rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--cb-muted);
    cursor: pointer;
}

.cashbox-tab.is-active {
    background: var(--cb-ink);
    color: #fff;
}

/* Toolbar */
.cashbox-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.cashbox-search {
    position: relative;
    flex: 1 1 16rem;
    display: flex;
    align-items: center;
}

.cashbox-search__icon {
    position: absolute;
    left: 1rem;
    color: var(--cb-faint);
    pointer-events: none;
}

.cashbox-search__input {
    width: 100%;
    height: 2.75rem;
    padding: 0 1rem 0 2.75rem;
    border: 0;
    border-radius: 999px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
    font: inherit;
    font-size: 0.95rem;
    color: var(--cb-ink);
    outline: none;
}

.cashbox-search__input::placeholder {
    color: var(--cb-faint);
}

.cashbox-search__input:focus {
    box-shadow: var(--cb-lift), 0 0 0 2px var(--cb-accent);
}

.cashbox-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.cashbox-range {
    display: inline-flex;
    align-items: center;
    height: 2.5rem;
    padding: 0 0.35rem 0 0.9rem;
    border-radius: 999px;
    background: var(--cb-surface);
    box-shadow: inset 0 0 0 1px var(--cb-line);
}

.cashbox-range__field {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.cashbox-range__label {
    font-size: 0.85rem;
    color: var(--cb-muted);
}

.cashbox-range__input {
    height: 2rem;
    padding: 0 0.35rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font: inherit;
    font-size: 0.875rem;
    color: var(--cb-ink);
}

.cashbox-range__input:focus-visible {
    outline: 2px solid var(--cb-accent);
}

/* Feed */
.cashbox-feed {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0.75rem;
    border-radius: 24px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
}

.cashbox-date-group {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 1rem 0.5rem 0.4rem;
    background: var(--cb-surface);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--cb-muted);
}

.cashbox-entry {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.7rem 0.5rem;
    border-radius: 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.cashbox-entry:hover {
    background: var(--cb-mist);
}

.cashbox-entry:focus-visible {
    outline: 2px solid var(--cb-accent);
    outline-offset: -2px;
}

.cashbox-entry__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
}

.cashbox-entry__icon svg {
    width: 18px;
    height: 18px;
}

.cashbox-entry--income .cashbox-entry__icon {
    background: var(--cash-in-soft);
    color: var(--cash-in);
}

.cashbox-entry--expense .cashbox-entry__icon {
    background: var(--cash-out-soft);
    color: var(--cash-out);
}

.cashbox-entry__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.cashbox-entry__desc {
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cashbox-entry__meta {
    font-size: 0.8rem;
    color: var(--cb-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cashbox-entry__amount {
    flex-shrink: 0;
    font-size: 1.05rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.cashbox-entry--income .cashbox-entry__amount {
    color: var(--cash-in);
}

.cashbox-entry--expense .cashbox-entry__amount {
    color: var(--cash-out);
}

.cashbox-entry--reversed {
    opacity: 0.6;
}

.cashbox-entry--reversed .cashbox-entry__desc,
.cashbox-entry--reversed .cashbox-entry__amount {
    text-decoration: line-through;
    text-decoration-color: rgb(115 122 140 / 0.6);
}

.cashbox-entry__reversed {
    color: #8a4a06;
    font-weight: 500;
}

.cashbox-page .inst-empty {
    padding: 3rem 1rem;
    text-align: center;
    background: none;
    border: 0;
}

.cashbox-page .inst-empty__title {
    margin: 0 0 0.35rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--cb-ink);
}

.cashbox-page .inst-empty__text {
    margin: 0 auto;
    max-width: 26rem;
    color: var(--cb-muted);
}

.cashbox-load-more {
    display: flex;
    justify-content: center;
    padding: 1rem 0 0;
}

/* Сдачи кассы */
.cashbox-handovers {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0.75rem;
    border-radius: 24px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
}

.cashbox-handover-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.9rem 0.5rem;
}

.cashbox-handover-row + .cashbox-handover-row {
    border-top: 1px solid var(--cb-line);
}

.cashbox-handover-row__amount {
    display: block;
    font-size: 1.1rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.cashbox-handover-row__meta,
.cashbox-handover-row__note,
.cashbox-handover-row__time {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.85rem;
    color: var(--cb-muted);
}

.cashbox-handover-row__time {
    flex-shrink: 0;
    white-space: nowrap;
}

/* Детали операции — боковая панель */
.cashbox-drawer {
    font-family: var(--cb-font);
    color: var(--cb-ink);
}

.cashbox-drawer .inst-drawer__head {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 0;
}

.cashbox-drawer .inst-drawer__eyebrow {
    margin: 0 0 0.3rem;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--cb-muted);
}

.cashbox-drawer .inst-drawer__title {
    font-size: 1.6rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--cb-ink);
}

.cashbox-drawer .inst-drawer__sub {
    font-size: 0.9rem;
    color: var(--cb-muted);
}

.cashbox-drawer .inst-drawer__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--cb-mist);
    color: var(--cb-ink);
}

.cashbox-drawer .inst-drawer__body {
    padding: 0 1.5rem 1.5rem;
}

.cashbox-drawer .inst-detail__section {
    margin: 0 0 1rem;
    padding: 1rem 1.1rem;
    border-radius: 18px;
    background: var(--cb-mist);
}

.cashbox-drawer .inst-detail__section-title {
    margin: 0 0 0.6rem;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--cb-ink);
}

.cashbox-drawer .inst-dl {
    gap: 0.55rem;
}

.cashbox-drawer .inst-dl__row {
    grid-template-columns: 8rem 1fr;
    font-size: 0.9rem;
}

.cashbox-drawer .inst-dl__dt {
    color: var(--cb-muted);
    font-weight: 400;
}

.cashbox-drawer .inst-dl__dd {
    color: var(--cb-ink);
    font-weight: 500;
}

@media (min-width: 769px) {
    .inst-drawer.cashbox-drawer {
        top: 0.75rem;
        right: 0.75rem;
        bottom: 0.75rem;
        width: min(30rem, calc(100vw - 1.5rem));
        border-radius: 28px;
        box-shadow: 0 30px 80px rgb(31 36 51 / 0.25);
        transform: translateX(calc(100% + 1rem));
    }

    .inst-drawer.cashbox-drawer.is-open {
        transform: translateX(0);
    }
}

#cb-drawer-overlay {
    background: rgb(31 36 51 / 0.28);
}

/* Добавить операцию — окно */
.cashbox-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgb(31 36 51 / 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.cashbox-modal-overlay[hidden] {
    display: none !important;
}

.cashbox-modal-overlay:not([hidden]) {
    display: flex;
}

.cashbox-modal-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.cashbox-modal {
    width: 100%;
    max-width: 28rem;
    overflow: hidden;
    border-radius: 28px;
    background: var(--cb-surface);
    box-shadow: 0 30px 80px rgb(31 36 51 / 0.25);
    font-family: var(--cb-font);
    color: var(--cb-ink);
    transform: translateY(12px);
    transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.cashbox-modal-overlay.is-open .cashbox-modal {
    transform: translateY(0);
}

.cashbox-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.5rem 1rem;
}

.cashbox-modal__title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.cashbox-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--cb-mist);
    color: var(--cb-ink);
    cursor: pointer;
}

.cashbox-modal__form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0 1.5rem 1.5rem;
}

.cashbox-modal__type-switch {
    display: flex;
    gap: 2px;
    padding: 4px;
    border-radius: 999px;
    background: var(--cb-mist);
}

.cashbox-type-btn {
    flex: 1;
    height: 2.5rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--cb-muted);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.cashbox-type-btn.is-active.cashbox-type-btn--income {
    background: var(--cb-surface);
    color: var(--cash-in, #0e6546);
    box-shadow: 0 1px 3px rgb(31 36 51 / 0.08);
}

.cashbox-type-btn.is-active.cashbox-type-btn--expense {
    background: var(--cb-surface);
    color: #a11d35;
    box-shadow: 0 1px 3px rgb(31 36 51 / 0.08);
}

.cashbox-modal__field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.cashbox-modal__field > span {
    font-size: 0.85rem;
    color: var(--cb-muted);
}

.cashbox-modal__field input,
.cashbox-modal__field textarea,
.cashbox-modal__field select {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 0;
    border-radius: 14px;
    background: var(--cb-mist);
    font: inherit;
    font-size: 0.95rem;
    color: var(--cb-ink);
    resize: vertical;
    transition: box-shadow 0.15s ease, background-color 0.15s ease;
}

.cashbox-modal__field input:focus,
.cashbox-modal__field textarea:focus,
.cashbox-modal__field select:focus {
    outline: none;
    background: var(--cb-surface);
    box-shadow: 0 0 0 2px var(--cb-accent);
}

.cashbox-modal__field .cashbox-modal__amount {
    padding: 0.6rem 0.9rem;
    font-size: 1.75rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.cashbox-modal__amount::-webkit-outer-spin-button,
.cashbox-modal__amount::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cashbox-modal__amount {
    -moz-appearance: textfield;
}

.cashbox-modal__error {
    margin: 0;
    padding: 0.65rem 0.9rem;
    border-radius: 12px;
    background: #ffe2e6;
    font-size: 0.875rem;
    color: #a11d35;
}

.cashbox-modal__submit {
    width: 100%;
    height: 3rem;
    margin-top: 0.25rem;
}

.cashbox-modal:has(.cashbox-type-btn--expense.is-active) .cashbox-modal__submit {
    background: #a11d35;
}

/* Mobile */
@media (max-width: 720px) {
    .cashbox-hero {
        flex-direction: column;
        align-items: stretch;
        padding: 1.35rem;
        border-radius: 24px;
    }

    .cashbox-balance-bar__value {
        font-size: 2.5rem;
    }

    .cashbox-hero__side {
        align-items: stretch;
    }

    .cashbox-select__input {
        width: 100%;
        max-width: none;
    }

    .cashbox-hero__actions {
        justify-content: stretch;
    }

    .cashbox-hero__actions .cashbox-btn--income,
    .cashbox-hero__actions .cashbox-btn--expense {
        flex: 1;
    }

    .cashbox-tabs {
        display: flex;
    }

    .cashbox-tab {
        flex: 1;
    }

    .cashbox-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .cashbox-search {
        flex: none;
    }

    .cashbox-filters {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .cashbox-filters .cashbox-select__input {
        width: 100%;
    }

    .cashbox-range {
        grid-column: 1 / -1;
        justify-content: space-between;
    }

    .cashbox-feed,
    .cashbox-handovers {
        padding: 0.25rem 0.5rem;
        border-radius: 20px;
    }

    .cashbox-entry {
        gap: 0.7rem;
        padding: 0.65rem 0.35rem;
    }

    .cashbox-entry__amount {
        font-size: 0.95rem;
    }

    .cashbox-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .cashbox-modal {
        max-width: none;
        border-radius: 26px 26px 0 0;
    }
}

/* ═══════════════════════════════════════════════════════════
   REPORTS MODULE (/reports)
   Одна лента карточек: деньги → динамика → пульс → структура → площади.
   ═══════════════════════════════════════════════════════════ */
.app-content:has(.reports-page) {
    max-width: none !important;
    background: var(--cb-mist);
}

.rp {
    --rp-in: #2bb07f;
    --rp-in-ink: #0e6546;
    --rp-out: #ef5b73;
    --rp-out-ink: #a11d35;
    --rp-net: #6b74e8;
    --rp-net-ink: #353c9e;
    --rp-res: #f2a33a;
    position: relative;
    max-width: 90rem;
    margin: 0 auto;
    padding-bottom: 3rem;
    font-family: var(--cb-font);
    color: var(--cb-ink);
}

.rp.is-loading .rp-card {
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

/* Фильтры */
.rp-bar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.rp-bar__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
}

.rp-bar__scope,
.rp-bar__period {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.rp-bar__badge {
    font-size: 0.9rem;
    color: var(--cb-muted);
}

.rp-pill-select {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.rp-pill-select__input {
    appearance: none;
    -webkit-appearance: none;
    height: 2.75rem;
    max-width: 18rem;
    padding: 0 2.5rem 0 1.15rem;
    border: 0;
    border-radius: 999px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--cb-ink);
    text-overflow: ellipsis;
    cursor: pointer;
}

.rp-pill-select__chevron {
    position: absolute;
    right: 1rem;
    color: var(--cb-faint);
    pointer-events: none;
}

.rp-seg {
    display: inline-flex;
    gap: 2px;
    padding: 4px;
    border-radius: 999px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
}

.rp-seg__btn {
    height: 2.25rem;
    padding: 0 1rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--cb-muted);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.rp-seg__btn:hover {
    color: var(--cb-ink);
}

.rp-seg__btn.is-active {
    background: var(--cb-ink);
    color: #fff;
}

.rp-nav {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 2.75rem;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
}

.rp-nav[hidden] {
    display: none;
}

.rp-nav__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--cb-muted);
    cursor: pointer;
}

.rp-nav__btn:hover {
    background: var(--cb-mist);
    color: var(--cb-ink);
}

.rp-nav__field {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.rp-nav__label {
    font-size: 0.85rem;
    color: var(--cb-muted);
}

.rp-nav__input {
    height: 2.25rem;
    padding: 0 0.4rem;
    border: 0;
    border-radius: 10px;
    background: transparent;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--cb-ink);
}

.rp-nav__apply {
    height: 2.25rem;
    padding: 0 1rem;
    border: 0;
    border-radius: 999px;
    background: var(--cb-ink);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
}

.rp-nav__apply:disabled {
    opacity: 0.5;
}

.rp-bar__blocks {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.rp-bar__blocks[hidden] {
    display: none;
}

.rp-bar__blocks-label {
    margin-right: 0.35rem;
    font-size: 0.875rem;
    color: var(--cb-muted);
}

.rp-bar__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.reports-scope__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 2.25rem;
    padding: 0 1rem;
    border: 0;
    border-radius: 999px;
    background: rgb(255 255 255 / 0.6);
    box-shadow: inset 0 0 0 1px var(--cb-line);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--cb-muted);
    cursor: pointer;
}

.reports-scope__chip.is-active {
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
    color: var(--cb-ink);
}

.reports-scope__chip.is-active::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--cb-accent);
}

.rp-link {
    padding: 0.3rem 0.6rem;
    border: 0;
    border-radius: 999px;
    background: none;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--cb-accent);
    text-decoration: none;
    cursor: pointer;
}

.rp-link:hover:not(:disabled) {
    background: var(--cb-accent-soft);
}

.rp-link:disabled {
    opacity: 0.4;
    cursor: default;
}

.rp-bar__note {
    margin: 0;
    padding: 0.7rem 1rem;
    border-radius: 14px;
    background: #fff4e0;
    font-size: 0.875rem;
    color: #8a4a06;
}

.rp-bar__note[hidden],
.rp-error[hidden] {
    display: none;
}

.rp-error {
    margin: 0 0 1rem;
    padding: 0.7rem 1rem;
    border-radius: 14px;
    background: #ffe2e6;
    font-size: 0.9rem;
    color: var(--rp-out-ink);
}

.rp-seg__btn:focus-visible,
.rp-nav__btn:focus-visible,
.rp-nav__apply:focus-visible,
.rp-link:focus-visible,
.reports-scope__chip:focus-visible,
.rp-pill-select__input:focus-visible,
.rp-nav__input:focus-visible {
    outline: 2px solid var(--cb-accent);
    outline-offset: 2px;
}

/* Карточки */
.rp-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 1.5rem;
    border-radius: 24px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
}

.rp-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 1.1rem;
}

.rp-card__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.rp-card__sub {
    margin: 0.2rem 0 0;
    font-size: 0.875rem;
    color: var(--cb-muted);
}

.rp-card__foot {
    margin: 0.75rem 0 0;
    font-size: 0.8rem;
    color: var(--cb-faint);
}

.rp-card__empty {
    margin: auto 0;
    padding: 2rem 0;
    font-size: 0.9rem;
    text-align: center;
    color: var(--cb-muted);
}

.rp-card__empty[hidden],
.rp-chart[hidden] {
    display: none;
}

.rp-grid {
    display: grid;
    gap: 1.25rem;
    margin-top: 1.25rem;
}

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

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

.rp-chart {
    position: relative;
    min-width: 0;
}

.rp-chart--flow { height: 18rem; }
.rp-chart--line { height: 17rem; }
.rp-chart--radar { height: 16rem; }
.rp-chart--bars { height: 14rem; }

.rp-dot {
    display: inline-block;
    flex-shrink: 0;
    width: 0.55rem;
    height: 0.55rem;
    margin-right: 0.45rem;
    border-radius: 50%;
    background: var(--cb-faint);
}

/* Деньги */
.rp-money__figures {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin: 0 0 1.5rem;
}

.rp-figure {
    padding: 1rem 1.15rem;
    border-radius: 18px;
    background: var(--cb-mist);
}

.rp-figure dt {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--cb-muted);
}

.rp-figure dd {
    margin: 0.35rem 0 0;
    font-size: 2rem;
    font-weight: 650;
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.rp-figure dd small {
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--cb-faint);
}

.rp-figure--income .rp-dot { background: var(--rp-in); }
.rp-figure--expense .rp-dot { background: var(--rp-out); }
.rp-figure--net .rp-dot { background: var(--rp-net); }
.rp-figure--income dd { color: var(--rp-in-ink); }
.rp-figure--net dd { color: var(--rp-net-ink); }
.rp-figure--net.is-negative dd { color: var(--rp-out-ink); }

.rp-delta {
    display: inline-flex;
    margin-top: 0.5rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--cb-surface);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--cb-muted);
}

.rp-delta[hidden] {
    display: none;
}

.rp-delta.is-up { color: var(--rp-in-ink); background: #dcf5e9; }
.rp-delta.is-down { color: var(--rp-out-ink); background: #ffe2e6; }
.rp-delta--inverse.is-up { color: var(--rp-out-ink); background: #ffe2e6; }
.rp-delta--inverse.is-down { color: var(--rp-in-ink); background: #dcf5e9; }

/* Эффективность */
.rp-gauge {
    position: relative;
    height: 10rem;
    margin: 0 auto 1rem;
    width: 100%;
    max-width: 18rem;
}

.rp-gauge__center {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.rp-gauge__value {
    font-size: 2rem;
    font-weight: 650;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.rp-gauge__label {
    font-size: 0.8rem;
    color: var(--cb-muted);
}

.rp-list {
    display: flex;
    flex-direction: column;
    margin: 0;
}

.rp-list > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 0;
    border-top: 1px solid var(--cb-line);
}

.rp-list > div:first-child {
    border-top: 0;
}

.rp-list dt {
    font-size: 0.9rem;
    color: var(--cb-muted);
}

.rp-list dd {
    margin: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.rp-list dd small {
    font-weight: 500;
    color: var(--cb-muted);
}

.rp-bar:has(#rp-blocks-wrap[hidden]) .rp-bar__badge {
    display: none;
}

.rp-list dd {
    white-space: nowrap;
}

.rp-list--big dd {
    font-size: 1.2rem;
    letter-spacing: -0.01em;
}

.rp-list dd.is-warn {
    color: #8a4a06;
}

/* Пульс периода */
.rp-pulse__list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin: 0;
}

.rp-pulse__item {
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: var(--cb-mist);
}

.rp-pulse__item dt {
    font-size: 0.85rem;
    color: var(--cb-muted);
}

.rp-pulse__item dd {
    margin: 0.2rem 0 0;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: none;
}

.rp-pulse__item p {
    margin: 0.1rem 0 0;
    font-size: 0.875rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.rp-pulse__item:nth-child(1) p { color: var(--rp-in-ink); }
.rp-pulse__item:nth-child(2) p { color: var(--rp-out-ink); }

.rp-meter {
    height: 0.4rem;
    margin-top: 0.6rem;
    border-radius: 999px;
    background: var(--cb-surface);
    overflow: hidden;
}

.rp-meter span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--rp-in);
}

/* Доходы: кольцо + легенда */
.rp-donut {
    display: grid;
    grid-template-columns: 11rem minmax(0, 1fr);
    align-items: center;
    gap: 1.5rem;
}

.rp-donut__chart {
    position: relative;
    height: 11rem;
}

.rp-donut__center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.rp-donut__value {
    font-size: 1.35rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.rp-donut__label {
    font-size: 0.8rem;
    color: var(--cb-muted);
}

.rp-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rp-legend__item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
}

.rp-legend__dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
}

.rp-legend__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rp-legend__pct {
    color: var(--cb-muted);
    font-variant-numeric: tabular-nums;
}

.rp-legend__value {
    min-width: 5.5rem;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.rp-legend__empty {
    color: var(--cb-muted);
    font-size: 0.9rem;
}

.rp-split {
    margin: 1.25rem 0 0.5rem;
}

.rp-split__row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.45rem;
    font-size: 0.875rem;
    color: var(--cb-muted);
}

.rp-split__row strong {
    color: var(--cb-ink);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.rp-split__bar {
    height: 0.5rem;
    border-radius: 999px;
    background: #d8dcfb;
    overflow: hidden;
}

.rp-split__bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--rp-net);
    transition: width 0.4s ease;
}

/* Площади */
.rp-stock {
    display: grid;
    grid-template-columns: 9rem minmax(0, 1fr);
    align-items: center;
    gap: 1.5rem;
}

.rp-ring {
    --p: 0;
    --r: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 9rem;
    aspect-ratio: 1;
    border-radius: 50%;
    background: conic-gradient(
        var(--rp-net) 0 calc(var(--p) * 1%),
        var(--rp-res) calc(var(--p) * 1%) calc((var(--p) + var(--r)) * 1%),
        #dcf5e9 calc((var(--p) + var(--r)) * 1%) 100%
    );
}

.rp-ring::before {
    content: "";
    position: absolute;
    inset: 0.9rem;
    border-radius: 50%;
    background: var(--cb-surface);
}

.rp-ring__value,
.rp-ring__label {
    position: relative;
}

.rp-ring__value {
    font-size: 1.6rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.rp-ring__label {
    font-size: 0.8rem;
    color: var(--cb-muted);
}

.rp-stock__rows {
    display: flex;
    flex-direction: column;
    margin: 0;
}

.rp-stock__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 0 1rem;
    padding: 0.55rem 0;
    border-top: 1px solid var(--cb-line);
}

.rp-stock__row:first-child {
    border-top: 0;
}

.rp-stock__row dt {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--cb-muted);
}

.rp-stock__row dd {
    margin: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.rp-stock__row p {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 0.8rem;
    color: var(--cb-faint);
    padding-left: 1rem;
}

.rp-stock__row--total dd {
    font-size: 1.15rem;
}

.rp-stock__row--sold .rp-dot { background: var(--rp-net); }
.rp-stock__row--reserved .rp-dot { background: var(--rp-res); }
.rp-stock__row--free .rp-dot { background: var(--rp-in); }

.rp-ribbon {
    display: flex;
    gap: 3px;
    height: 0.5rem;
    margin-top: 1.1rem;
    border-radius: 999px;
    overflow: hidden;
    background: var(--cb-mist);
}

.rp-ribbon__seg {
    flex: none;
    min-width: 0;
    transition: width 0.4s ease;
}

.rp-ribbon__seg--sold { background: var(--rp-net); }
.rp-ribbon__seg--reserved { background: var(--rp-res); }
.rp-ribbon__seg--free { background: var(--rp-in); }

/* Загрузка */
.reports-loading {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 100;
    pointer-events: none;
}

.reports-loading[hidden] {
    display: none !important;
}

.reports-loading__spinner {
    display: block;
    width: 1.75rem;
    height: 1.75rem;
    border: 3px solid var(--cb-line);
    border-top-color: var(--cb-accent);
    border-radius: 50%;
    animation: reports-spin 0.7s linear infinite;
}

@keyframes reports-spin {
    to { transform: rotate(360deg); }
}

/* Адаптив */
@media (max-width: 1200px) {
    .rp-grid--3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rp-grid--3 > :last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 960px) {
    .rp-grid--2,
    .rp-grid--3 {
        grid-template-columns: minmax(0, 1fr);
    }

    .rp-grid--3 > :last-child {
        grid-column: auto;
    }
}

@media (max-width: 720px) {
    .rp-bar__row,
    .rp-bar__period {
        flex-direction: column;
        align-items: stretch;
    }

    .rp-pill-select__input {
        width: 100%;
        max-width: none;
    }

    .rp-seg {
        display: flex;
    }

    .rp-seg__btn {
        flex: 1;
        padding: 0 0.5rem;
    }

    .rp-nav {
        justify-content: space-between;
    }

    .rp-nav--range {
        flex-wrap: wrap;
        height: auto;
        padding: 4px;
        border-radius: 22px;
    }

    .rp-card {
        padding: 1.25rem;
        border-radius: 22px;
    }

    .rp-money__figures {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.5rem;
    }

    .rp-figure dd {
        font-size: 1.6rem;
    }

    .rp-chart--flow { height: 15rem; }

    .rp-donut,
    .rp-stock {
        grid-template-columns: minmax(0, 1fr);
        justify-items: center;
    }

    .rp-legend,
    .rp-stock__rows {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .reports-loading__spinner {
        animation: none;
    }
}

/* ═══════════════════════════════════════════════
   Employees page
   ═══════════════════════════════════════════════ */

.emp-page {
    max-width: 1200px;
}

.emp-empty {
    text-align: center;
    padding: 4rem 1rem;
}

.emp-empty__icon {
    margin-bottom: 1rem;
}

.emp-empty__text {
    color: var(--gray-500);
    font-size: .95rem;
    max-width: 360px;
    margin: 0 auto;
}

.emp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.emp-card {
    position: relative;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-soft);
    transition: box-shadow .2s, transform .2s;
}

.emp-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.emp-card__avatar {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green-500), var(--green-700));
    display: flex;
    align-items: center;
    justify-content: center;
}

.emp-card__initials {
    color: var(--white);
    font-weight: 700;
    font-size: 1.15rem;
    text-transform: uppercase;
}

.emp-card__body {
    flex: 1;
    min-width: 0;
}

.emp-card__name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 .25rem;
    color: var(--gray-900);
}

.emp-card__role {
    display: inline-block;
    font-size: .75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    margin-bottom: .35rem;
    background: var(--green-100);
    color: var(--green-800);
}

.emp-card__role--owner { background: #fef3c7; color: #92400e; }
.emp-card__role--admin { background: #dbeafe; color: #1e40af; }
.emp-card__role--manager { background: var(--green-100); color: var(--green-800); }
.emp-card__role--cashier { background: #fce7f3; color: #9d174d; }
.emp-card__role--accountant { background: #ede9fe; color: #5b21b6; }
.emp-card__role--viewer { background: var(--gray-100); color: var(--gray-700); }

.emp-card__phone {
    font-size: .85rem;
    color: var(--gray-500);
    margin: 0 0 .4rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.emp-card__props {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
}

.emp-card__prop-badge {
    display: inline-block;
    font-size: .7rem;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--gray-100);
    color: var(--gray-700);
}

.emp-card__prop-badge--all {
    background: var(--green-100);
    color: var(--green-800);
}

.emp-card__prop-badge--none {
    background: #fef2f2;
    color: #991b1b;
}

.emp-card__settings-btn {
    position: absolute;
    top: .75rem;
    right: .75rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-500);
    padding: 4px;
    border-radius: 6px;
    transition: color .15s, background .15s;
}

.emp-card__settings-btn:hover {
    color: var(--green-700);
    background: var(--green-50);
}

/* ── Modal overlay ── */

.emp-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(15, 23, 42, .45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s var(--ease-out);
}

.emp-modal-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.emp-modal {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .25);
    width: 95%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(.97);
    transition: transform .25s var(--ease-out);
}

.emp-modal-overlay.is-open .emp-modal {
    transform: translateY(0) scale(1);
}

.emp-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.emp-modal__title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: var(--gray-900);
}

.emp-modal__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
    padding: 0 4px;
    line-height: 1;
    transition: color .15s;
}

.emp-modal__close:hover {
    color: var(--gray-900);
}

.emp-modal__body {
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
}

/* ── Tabs ── */

.emp-modal__tabs {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid var(--gray-100);
    padding-bottom: 0;
}

.emp-modal__tab {
    background: none;
    border: none;
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    padding: .5rem .75rem;
    color: var(--gray-500);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .15s, border-color .15s;
}

.emp-modal__tab.is-active {
    color: var(--green-700);
    border-bottom-color: var(--green-600);
}

.emp-modal__tab:hover:not(.is-active) {
    color: var(--gray-700);
}

.emp-modal__tab--danger.is-active {
    color: var(--danger);
    border-bottom-color: var(--danger);
}

.emp-modal__panel {
    display: none;
}

.emp-modal__panel.is-active {
    display: block;
}

.emp-modal__section-title {
    font-size: .9rem;
    font-weight: 600;
    margin: 0 0 .35rem;
    color: var(--gray-900);
}

.emp-modal__hint {
    font-size: .8rem;
    color: var(--gray-500);
    margin: 0 0 .75rem;
}

.emp-modal__actions {
    display: flex;
    gap: .5rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-100);
}

/* ── Route & property grid ── */

.emp-route-grid,
.emp-prop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .5rem;
}

.emp-route-item {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    padding: .4rem .6rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-100);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.emp-route-item:hover {
    border-color: var(--green-400);
    background: var(--green-50);
}

.emp-route-item input[type="checkbox"] {
    accent-color: var(--green-600);
    width: 16px;
    height: 16px;
}

.emp-route-item__label {
    white-space: nowrap;
}

/* ── Form inputs (modals) ── */

.emp-form-group {
    margin-bottom: 1rem;
}

.emp-form-group.is-hidden {
    display: none;
}

.emp-form-static {
    margin: 0;
    font-size: .9rem;
    font-weight: 600;
    color: var(--gray-800);
}

.emp-form-label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    margin-bottom: .3rem;
    color: var(--gray-700);
}

.emp-form-input {
    width: 100%;
    padding: .55rem .75rem;
    font-size: .9rem;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}

.emp-form-input:focus {
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, .15);
}

select.emp-form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    padding-right: 2rem;
}

/* ── Danger zone ── */

.emp-danger-zone {
    text-align: center;
    padding: 2rem 1rem;
}

.emp-danger-zone__text {
    margin: 1rem 0 1.5rem;
    color: var(--gray-700);
    font-size: .9rem;
}

.btn--danger {
    background: var(--danger);
    color: var(--white);
    border: none;
    padding: .55rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s;
}

.btn--danger:hover {
    opacity: .9;
}

.btn--danger:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* ── Toast ── */

.emp-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    padding: .75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 500;
    color: var(--white);
    background: var(--green-700);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .3s, transform .3s;
    pointer-events: none;
}

.emp-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.emp-toast--error {
    background: var(--danger);
}

/* ── Responsive ── */

@media (max-width: 640px) {
    .emp-grid {
        grid-template-columns: 1fr;
    }

    .emp-modal {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .emp-route-grid,
    .emp-prop-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===================== Settings page ===================== */

.settings-page {
    max-width: min(56rem, 100%);
    margin: 0 auto;
}

@media (min-width: 1400px) {
    .settings-page {
        max-width: min(72rem, 100%);
    }
}

@media (min-width: 1800px) {
    .settings-page {
        max-width: min(90rem, 100%);
    }
}

@media (min-width: 2400px) {
    .settings-page {
        max-width: min(110rem, 100%);
    }
}

.settings-page__lead {
    margin: -0.25rem 0 1.5rem;
    max-width: 40rem;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--gray-500);
}

.settings-page__grid {
    display: grid;
    grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

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

.settings-card {
    background: var(--white);
    border: 1px solid rgb(22 163 74 / 0.12);
    border-radius: var(--radius);
    padding: 0;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.settings-card__head {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1.25rem 1.35rem 1rem;
    background: linear-gradient(180deg, var(--green-50) 0%, var(--white) 100%);
    border-bottom: 1px solid rgb(22 163 74 / 0.08);
}

.settings-card__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 10px;
    background: var(--white);
    color: var(--green-700);
    box-shadow: 0 1px 4px rgb(22 101 52 / 0.1);
    border: 1px solid rgb(22 163 74 / 0.15);
}

.settings-card__icon--photos {
    color: var(--green-600);
    background: linear-gradient(135deg, var(--green-50) 0%, var(--white) 100%);
}

.settings-card__head-text {
    min-width: 0;
}

.settings-card__title {
    margin: 0 0 0.2rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

.settings-card__subtitle {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--gray-500);
}

.settings-card__link {
    color: var(--green-700);
    font-weight: 600;
    text-decoration: none;
}

.settings-card__link:hover {
    color: var(--green-600);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.settings-card__form {
    padding: 1.1rem 1.35rem 1.35rem;
}

.settings-card--chessboard-colors {
    grid-column: 1 / -1;
}

.settings-cb-colors__preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 10px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
}

.settings-cb-colors__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 0.65rem 1rem;
}

.settings-cb-colors__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    background: var(--white);
    cursor: pointer;
}

.settings-cb-colors__label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-700);
    line-height: 1.3;
}

.settings-cb-colors__input {
    width: 2.5rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
}

.settings-cb-colors__swatch {
    width: 2.25rem;
    height: 1.75rem;
    pointer-events: none;
}

.settings-cb-colors__error {
    margin: 0.75rem 0 0;
}

.settings-cb-colors__footer {
    margin-top: 1rem;
}

.settings-cb-colors__reset {
    padding: 0 1.35rem 1.25rem;
}

.settings-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem 1rem;
}

.settings-form-grid__full {
    grid-column: 1 / -1;
}

.settings-form-grid .field {
    margin-bottom: 0;
}

@media (max-width: 480px) {
    .settings-form-grid {
        grid-template-columns: 1fr;
    }
}

.settings-card__footer {
    margin-top: 1.15rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-100);
}

.settings-sms__status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 1rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.settings-sms__status--ok {
    color: var(--green-800);
    background: rgb(22 163 74 / 0.1);
}

.settings-sms__status--empty {
    color: var(--gray-600);
    background: var(--gray-100);
}

.settings-sms__status-dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: currentColor;
}

.settings-sms__label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-700);
}

.settings-sms__hint--sender {
    margin-bottom: 1rem;
}

.settings-sms__sender-box {
    padding: 0.65rem 0.85rem;
    border: 1px solid rgb(22 163 74 / 0.18);
    border-radius: 10px;
    background: var(--white);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.35rem;
}

.settings-sms__sender-input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    font-size: 0.88rem;
}

.settings-sms__sender-input:focus {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgb(22 163 74 / 0.12);
}

.settings-sms__token-box {
    padding: 0.75rem 0.85rem;
    border: 1px solid rgb(22 163 74 / 0.18);
    border-radius: 10px;
    background: var(--green-50);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.72rem;
    line-height: 1.5;
    color: var(--gray-800);
    word-break: break-all;
    max-height: 8rem;
    overflow-y: auto;
}

.settings-sms__textarea {
    width: 100%;
    min-height: 6.5rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.45;
    resize: vertical;
}

.settings-sms__textarea:focus {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgb(22 163 74 / 0.12);
}

.settings-sms__hint {
    margin: 0 0 1rem;
    font-size: 0.82rem;
    color: var(--gray-500);
    line-height: 1.45;
}

.settings-sms__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.settings-sms__actions--edit {
    padding-top: 0.25rem;
}

.settings-sms__delete-btn {
    margin-left: auto;
    color: #b91c1c;
}

.settings-sms__delete-btn:hover {
    color: #991b1b;
    background: rgb(185 28 28 / 0.08);
}

.settings-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem 1.5rem 2.25rem;
    gap: 0.75rem;
}

.settings-empty__icon {
    display: flex;
    color: var(--green-600);
    opacity: 0.85;
}

.settings-empty__text {
    margin: 0;
    max-width: 18rem;
    font-size: 0.9rem;
    color: var(--gray-500);
    line-height: 1.5;
}

/* -- Photos section -- */
.settings-photos {
    padding: 0 1.35rem 1.35rem;
}

.settings-photos__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 1rem;
    margin-bottom: 1rem;
}

.settings-photos__label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
}

.settings-photos__select-wrap {
    flex: 1;
    min-width: 12rem;
    max-width: 20rem;
}

.settings-photos__select {
    width: 100%;
    padding: 0.55rem 2rem 0.55rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgb(22 163 74 / 0.22);
    background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.65rem center;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--gray-900);
    appearance: none;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.settings-photos__select:hover {
    border-color: rgb(22 163 74 / 0.35);
}

.settings-photos__select:focus-visible {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgb(34 197 94 / 0.2);
}

.settings-photos__count {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: var(--green-100);
    color: var(--green-800);
}

.settings-photos__placeholder {
    margin: 0;
    padding: 1.5rem 1rem;
    text-align: center;
    font-size: 0.88rem;
    color: var(--gray-500);
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border: 1px dashed rgb(22 163 74 / 0.2);
}

.settings-photos__body {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.settings-dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 1.25rem 1rem;
    border-radius: var(--radius-sm);
    border: 2px dashed rgb(22 163 74 / 0.28);
    background: linear-gradient(180deg, var(--green-50) 0%, var(--white) 55%);
    transition: border-color 0.2s, background 0.2s;
}

.settings-dropzone.is-dragover {
    border-color: var(--green-500);
    background: var(--green-50);
}

.settings-dropzone__input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.settings-dropzone__label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    text-align: center;
    padding: 0.5rem;
}

.settings-dropzone__icon {
    color: var(--green-600);
    margin-bottom: 0.15rem;
}

.settings-dropzone__title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--gray-900);
}

.settings-dropzone__hint {
    font-size: 0.78rem;
    color: var(--gray-500);
}

.settings-dropzone__files {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--green-700);
}

.settings-dropzone__submit {
    align-self: center;
}

.settings-photos__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 0.75rem;
}

.settings-photos__loading,
.settings-photos__empty-grid {
    grid-column: 1 / -1;
    margin: 0;
    padding: 1.25rem;
    text-align: center;
    font-size: 0.88rem;
    color: var(--gray-500);
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}

.settings-photo-card {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--gray-100);
    border: 1px solid rgb(15 23 42 / 0.06);
    box-shadow: 0 1px 3px rgb(15 23 42 / 0.06);
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s;
}

.settings-photo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgb(15 23 42 / 0.1);
}

.settings-photo-card__img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
    vertical-align: middle;
}

.settings-photo-card__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, transparent 40%, rgb(15 23 42 / 0.65) 100%);
    opacity: 0;
    transition: opacity 0.2s;
}

.settings-photo-card:hover .settings-photo-card__overlay,
.settings-photo-card:focus-within .settings-photo-card__overlay {
    opacity: 1;
}

.settings-photo-card__delete {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: auto;
    margin-bottom: 0.5rem;
    padding: 0.4rem 0.75rem;
    border: none;
    border-radius: 6px;
    background: rgb(220 38 38 / 0.92);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
}

.settings-photo-card__delete:hover {
    background: var(--danger);
}

/* ===================== Presentation index ===================== */

.pres-index__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.pres-index__card {
    display: block;
    text-decoration: none;
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s, transform .2s;
    color: var(--gray-900);
}

.pres-index__card:hover {
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,.12));
    transform: translateY(-2px);
}

.pres-index__card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: .25rem;
}

.pres-index__card-addr {
    font-size: .8125rem;
    color: var(--gray-500);
    margin-bottom: .5rem;
}

.pres-index__card-count {
    font-size: .8125rem;
    color: var(--gray-400);
}

/* —— Bino Core: лендинг, вход, загрузчик —— */
.brand--binocore {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--green-900);
}

.brand__logo {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    object-fit: contain;
    border-radius: 12px;
}

.brand__text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand__name {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand__sub {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--green-700);
    opacity: 0.85;
}

.hero--binocore {
    display: grid;
    gap: 2.5rem;
    align-items: center;
    padding-bottom: 3.5rem;
}

@media (min-width: 900px) {
    .hero--binocore {
        grid-template-columns: 1.05fr 0.95fr;
        gap: 2rem;
        padding-bottom: 4.5rem;
    }
}

.hero__visual {
    display: flex;
    justify-content: center;
}

.hero__logo-card {
    padding: 0.75rem;
    border-radius: 20px;
    background: #0a0a0a;
    box-shadow:
        0 24px 48px rgb(5 46 22 / 0.18),
        0 0 0 1px rgb(22 163 74 / 0.12);
}

.hero__logo-img {
    display: block;
    width: min(100%, 17.5rem);
    height: auto;
    object-fit: contain;
}

.cta-section__logo {
    display: block;
    margin: 0 auto 1rem;
    border-radius: 14px;
    background: #0a0a0a;
    padding: 0.35rem;
}

.site-footer__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.site-footer__brand img {
    border-radius: 8px;
    background: #0a0a0a;
}

.auth-page--split {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    padding: 0;
    background: var(--white);
}

@media (min-width: 900px) {
    .auth-page--split {
        grid-template-columns: minmax(18rem, 1fr) minmax(28rem, 42rem);
    }

    .auth-page--login.auth-page--split {
        grid-template-columns: minmax(20rem, 1.05fr) minmax(32rem, 46rem);
    }
}

.auth-showcase {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1.75rem 2rem;
    background: linear-gradient(165deg, var(--green-950) 0%, var(--green-800) 42%, var(--green-700) 100%);
    color: var(--white);
    overflow: hidden;
}

.auth-showcase::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 70% 50% at 30% 20%, rgb(74 222 128 / 0.22), transparent 60%);
    pointer-events: none;
}

.auth-showcase__home {
    position: relative;
    z-index: 1;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    border-radius: 999px;
    background: rgb(255 255 255 / 0.14);
    border: 1px solid rgb(255 255 255 / 0.22);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.auth-showcase__home:hover {
    color: #fff;
    background: rgb(255 255 255 / 0.24);
    border-color: rgb(255 255 255 / 0.35);
}

.auth-showcase__home:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.auth-showcase__center {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.75rem;
    padding: 1rem 0;
}

.auth-showcase__logo {
    width: min(100%, 11rem);
    height: auto;
    object-fit: contain;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgb(0 0 0 / 0.35);
}

.auth-page--login .auth-showcase__center {
    gap: 1.15rem;
    padding: 1.5rem 1rem 2rem;
    max-width: 26rem;
    margin-inline: auto;
}

.auth-page--login .auth-showcase__mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(100%, 17.5rem);
    aspect-ratio: 1;
    padding: 1.15rem;
    border-radius: 1.5rem;
    background: rgb(255 255 255 / 0.1);
    border: 1px solid rgb(255 255 255 / 0.14);
    box-shadow: 0 18px 48px rgb(0 0 0 / 0.22);
}

.auth-page--login .auth-showcase__logo {
    width: 100%;
    max-width: none;
    height: auto;
    border-radius: 1.1rem;
    box-shadow: none;
    display: block;
}

.auth-page--login .auth-showcase__name {
    font-size: clamp(1.75rem, 3vw, 2.35rem);
}

.auth-page--login .auth-showcase__tagline {
    max-width: 22rem;
    font-size: 1.05rem;
}

.auth-showcase__name {
    margin: 0;
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.auth-showcase__tagline {
    margin: 0;
    max-width: 22rem;
    font-size: 1rem;
    line-height: 1.6;
    color: rgb(255 255 255 / 0.82);
}

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.75rem 1.25rem;
    background: linear-gradient(180deg, var(--green-50) 0%, var(--white) 100%);
}

.auth-page--login .auth-panel {
    padding: clamp(1.25rem, 3vw, 2.75rem) clamp(1rem, 3vw, 2.5rem);
    background:
        radial-gradient(ellipse 80% 50% at 70% 0%, rgb(34 197 94 / 0.1), transparent 55%),
        linear-gradient(180deg, #f4faf6 0%, #fff 55%);
}

.auth-card--login {
    width: 100%;
    max-width: 24rem;
    animation: fade-up 0.55s var(--ease-out) both;
}

.auth-page--login .auth-card--login {
    max-width: 28rem;
    padding: 2.15rem 1.85rem 1.85rem;
    border-radius: 1.1rem;
    border: 1px solid rgb(22 163 74 / 0.14);
    box-shadow:
        0 1px 2px rgb(15 40 25 / 0.04),
        0 18px 40px rgb(15 40 25 / 0.07);
}

.auth-card__brand {
    margin: 0 0 0.45rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--green-700);
}

.auth-page--login .auth-card__title {
    font-size: clamp(1.55rem, 2.4vw, 1.9rem);
    letter-spacing: -0.03em;
}

.auth-page--login .auth-card__lead {
    margin-top: 0.65rem;
    font-size: 0.98rem;
    line-height: 1.6;
    color: var(--gray-600);
}

.auth-page--login .form--login {
    margin-top: 1.85rem;
    gap: 1.2rem;
}

.auth-page--login .form--login .field label {
    font-size: 0.92rem;
    margin-bottom: 0.5rem;
}

.auth-page--login .form--login .field input[type="text"],
.auth-page--login .form--login .field input[type="password"],
.auth-page--login .form--login .field--password .field__control input {
    padding: 0.95rem 1.05rem;
    font-size: 1.05rem;
    border-radius: 0.75rem;
    border-color: rgb(22 163 74 / 0.2);
    min-height: 3.15rem;
}

.auth-page--login .form--login .field--password .field__control {
    position: relative;
}

.auth-page--login .form--login .field--password .field__control input {
    width: 100%;
    padding-right: 3.1rem;
}

.field__reveal {
    position: absolute;
    top: 50%;
    right: 0.35rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: var(--gray-500);
    cursor: pointer;
}

.field__reveal:hover {
    color: var(--green-800);
    background: rgb(22 163 74 / 0.08);
}

.field__reveal:focus-visible {
    outline: none;
    color: var(--green-800);
    box-shadow: 0 0 0 3px rgb(34 197 94 / 0.22);
}

.field__reveal.is-on {
    color: var(--green-700);
    background: rgb(22 163 74 / 0.1);
}

.auth-page--login .form--login .field input::placeholder {
    color: var(--gray-400);
}

.auth-page--login .form--login .field__check {
    font-size: 0.95rem;
    min-height: 2.5rem;
    user-select: none;
}

.auth-page--login .form--login .field__check input {
    width: 1.15rem;
    height: 1.15rem;
}

.auth-page--login .btn--login {
    min-height: 3.25rem;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 0.75rem;
    margin-top: 0.25rem;
}

.auth-page--login .auth-card__support.support-telegram,
.auth-page--login .support-telegram--compact {
    margin-top: 1.35rem;
    padding: 0.85rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem 0.85rem;
    border-radius: 0.85rem;
}

.auth-page--login .support-telegram--compact .support-telegram__title {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--gray-600);
}

.auth-page--login .support-telegram--compact .btn--telegram {
    flex: 0 0 auto;
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
    gap: 0.35rem;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgb(34 158 217 / 0.25);
}

.auth-page--login .support-telegram--compact .btn--telegram:hover {
    transform: none;
    box-shadow: 0 3px 10px rgb(34 158 217 / 0.32);
}

@media (min-width: 900px) {
    .auth-page--login .auth-card--login {
        max-width: 34rem;
        padding: 2.75rem 2.75rem 2.35rem;
    }

    .auth-page--login .auth-card__title {
        font-size: 2.05rem;
    }

    .auth-page--login .auth-card__lead {
        font-size: 1.05rem;
        max-width: 28rem;
    }

    .auth-page--login .form--login {
        margin-top: 2.15rem;
        gap: 1.35rem;
    }

    .auth-page--login .form--login .field input[type="text"],
    .auth-page--login .form--login .field input[type="password"],
    .auth-page--login .form--login .field--password .field__control input {
        padding: 1.1rem 1.2rem;
        font-size: 1.1rem;
        min-height: 3.5rem;
        border-radius: 0.85rem;
    }

    .auth-page--login .form--login .field--password .field__control input {
        padding-right: 3.35rem;
    }

    .auth-page--login .btn--login {
        min-height: 3.55rem;
        font-size: 1.1rem;
        border-radius: 0.85rem;
    }
}

@media (max-width: 899px) {
    .auth-showcase {
        min-height: auto;
        padding-bottom: 1.25rem;
    }

    .auth-showcase__center {
        flex: 0;
        padding: 0.5rem 0 0;
    }

    .auth-showcase__logo {
        width: min(100%, 9rem);
    }

    .auth-showcase__tagline {
        display: none;
    }

    .auth-page--login.auth-page--split {
        grid-template-rows: auto 1fr;
    }

    .auth-page--login .auth-showcase {
        min-height: auto;
        padding: 1rem 1.15rem 1.25rem;
    }

    .auth-page--login .auth-showcase__center {
        flex: 0;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-start;
        align-items: center;
        text-align: left;
        gap: 0.85rem 1rem;
        padding: 0.75rem 0 0;
        max-width: none;
        margin: 0;
    }

    .auth-page--login .auth-showcase__mark {
        width: 4.75rem;
        padding: 0.4rem;
        border-radius: 0.9rem;
        flex-shrink: 0;
    }

    .auth-page--login .auth-showcase__logo {
        border-radius: 0.65rem;
    }

    .auth-page--login .auth-showcase__name {
        font-size: 1.25rem;
        margin: 0;
    }

    .auth-page--login .auth-showcase__tagline {
        display: none;
    }

    .auth-page--login .auth-panel {
        align-items: stretch;
        padding: 1rem 0.85rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
        background: #fff;
    }

    .auth-page--login .auth-card--login {
        max-width: none;
        padding: 1.5rem 1.15rem 1.35rem;
        border-radius: 1rem;
        box-shadow: none;
        border: 1px solid rgb(22 163 74 / 0.12);
        margin: 0 auto;
        width: 100%;
    }

    .auth-page--login .form--login .field input[type="text"],
    .auth-page--login .form--login .field input[type="password"],
    .auth-page--login .form--login .field--password .field__control input {
        font-size: 16px; /* avoid iOS zoom */
        min-height: 3.25rem;
        padding: 0.95rem 1rem;
    }

    .auth-page--login .form--login .field--password .field__control input {
        padding-right: 3rem;
    }

    .auth-page--login .btn--login {
        min-height: 3.35rem;
        font-size: 1.05rem;
    }
}

.support-telegram--compact {
    margin-top: 1.25rem;
}

.bc-loader-host {
    position: relative;
}

.bc-loader-host--busy > .chessboard-stage__map,
.bc-loader-host--busy > .sales-ws-map-pane__inner {
    pointer-events: none;
}

.bc-loader {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgb(255 255 255 / 0.82);
    backdrop-filter: blur(6px);
    border-radius: inherit;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.bc-loader[hidden] {
    display: none !important;
}

.bc-loader.is-active {
    opacity: 1;
    visibility: visible;
}

body > .bc-loader {
    position: fixed;
    inset: 0;
    z-index: 9998;
    border-radius: 0;
    background: rgb(248 250 252 / 0.92);
}

.bc-loader__card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    text-align: center;
}

.bc-loader__anim {
    width: min(42vw, 10rem);
    height: auto;
    max-height: 10rem;
    object-fit: contain;
    animation: bc-loader-pulse 1.15s ease-in-out infinite;
    filter: drop-shadow(0 8px 24px rgb(22 163 74 / 0.25));
}

.bc-loader__label {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--green-800);
}

.bc-loader-page-lock {
    overflow: hidden;
}

@keyframes bc-loader-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.04); opacity: 0.92; }
}

/* Появление блоков шахматки после загрузки */
.bc-map-enter {
    opacity: 0;
    transform: translateY(4px) scale(0.99);
    animation: bc-map-enter 0.22s var(--ease-out) forwards;
    animation-delay: var(--bc-map-delay, 0ms);
}

@keyframes bc-map-enter {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chessboard-stage__loader {
    display: none !important;
}

.sales-ws-map-pane.is-fetching::after {
    display: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .bc-loader__anim,
    .bc-map-enter {
        animation: none !important;
    }
    .bc-map-enter {
        opacity: 1;
        transform: none;
    }
}

/* ═══════════════════════════════════════════════
   Archive page
   ═══════════════════════════════════════════════ */

.archive-page {
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 0 2.5rem;
}

.archive-page__bg {
    position: absolute;
    inset: -0.5rem -0.75rem auto;
    height: 14rem;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.archive-page__orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(52px);
    opacity: 0.5;
}

.archive-page__orb--1 {
    width: 240px;
    height: 240px;
    background: #86efac;
    top: -80px;
    right: 8%;
}

.archive-page__orb--2 {
    width: 180px;
    height: 180px;
    background: #bbf7d0;
    top: -20px;
    left: 0;
}

.archive-hero,
.archive-stats,
.archive-layout,
.archive-table-card,
.archive-empty,
.archive-aside {
    position: relative;
    z-index: 1;
}

.archive-hero {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.archive-hero__icon {
    flex-shrink: 0;
    width: 3.25rem;
    height: 3.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(145deg, var(--green-500), var(--green-800));
    color: var(--white);
    box-shadow: 0 8px 24px rgb(22 163 74 / 0.28);
}

.archive-hero__kicker {
    margin: 0 0 0.2rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--green-700);
}

.archive-hero__title {
    margin: 0 0 0.4rem;
    font-size: clamp(1.35rem, 2.5vw, 1.65rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--gray-900);
    line-height: 1.15;
}

.archive-hero__lead {
    margin: 0;
    max-width: 40rem;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--gray-500);
}

.archive-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.archive-stat {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 0.65rem;
    align-items: center;
    padding: 0.9rem 1rem;
    background: var(--white);
    border: 1px solid rgb(22 163 74 / 0.12);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.archive-stat:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.archive-stat--secure {
    border-color: rgb(22 163 74 / 0.2);
    background: linear-gradient(135deg, var(--white) 0%, var(--green-50) 100%);
}

.archive-stat__icon {
    grid-row: 1 / span 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 10px;
    color: var(--green-800);
}

.archive-stat__icon--docs {
    background: var(--green-100);
}

.archive-stat__icon--size {
    background: #e0f2fe;
    color: #0369a1;
}

.archive-stat__icon--lock {
    background: #fef3c7;
    color: #b45309;
}

.archive-stat__value {
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--gray-900);
}

.archive-stat--secure .archive-stat__value {
    font-size: 1.1rem;
    letter-spacing: 0.02em;
    color: var(--green-800);
}

.archive-stat__label {
    grid-column: 2;
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.archive-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(14rem, 0.85fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
    align-items: start;
}

.archive-download {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgb(22 163 74 / 0.22);
    background: linear-gradient(145deg, var(--green-900) 0%, var(--green-700) 55%, var(--green-600) 100%);
    color: var(--white);
    box-shadow: 0 12px 36px rgb(5 46 22 / 0.22);
}

.archive-download__glow {
    position: absolute;
    top: -40%;
    right: -20%;
    width: 55%;
    height: 120%;
    background: radial-gradient(circle, rgb(74 222 128 / 0.35) 0%, transparent 68%);
    pointer-events: none;
}

.archive-download__inner {
    position: relative;
    padding: 1.5rem 1.65rem 1.65rem;
}

.archive-download__head {
    margin-bottom: 1rem;
}

.archive-download__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    margin-bottom: 0.55rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: 999px;
    background: rgb(255 255 255 / 0.14);
    border: 1px solid rgb(255 255 255 / 0.2);
}

.archive-download__title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.archive-tree {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0.65rem 0.85rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.15rem;
    border-radius: 12px;
    background: rgb(0 0 0 / 0.18);
    border: 1px solid rgb(255 255 255 / 0.1);
    font-size: 0.8rem;
}

.archive-tree__item {
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    background: rgb(255 255 255 / 0.1);
    font-weight: 600;
}

.archive-tree__item--accent {
    background: rgb(74 222 128 / 0.35);
    color: #ecfdf5;
}

.archive-tree__sep {
    opacity: 0.55;
    font-size: 0.75rem;
    user-select: none;
}

.archive-download__desc {
    margin: 0 0 1.15rem;
    font-size: 0.88rem;
    line-height: 1.55;
    color: rgb(255 255 255 / 0.82);
    max-width: 32rem;
}

.archive-download__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    font-size: 0.92rem;
    font-weight: 700;
    background: var(--white) !important;
    color: var(--green-900) !important;
    border: none !important;
    box-shadow: 0 4px 14px rgb(0 0 0 / 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.archive-download__btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgb(0 0 0 / 0.2);
}

.archive-download__empty {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: rgb(0 0 0 / 0.15);
    border: 1px dashed rgb(255 255 255 / 0.25);
}

.archive-download__empty p {
    margin: 0 0 0.25rem;
    font-weight: 700;
    font-size: 0.95rem;
}

.archive-download__empty span {
    font-size: 0.82rem;
    color: rgb(255 255 255 / 0.75);
}

.archive-restricted {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    background: rgb(254 243 199 / 0.95);
    color: #92400e;
}

.archive-restricted strong {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.9rem;
}

.archive-restricted p {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.45;
    color: #a16207;
}

.archive-restricted svg {
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.archive-aside {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.archive-tip {
    padding: 1rem 1.1rem;
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
}

.archive-tip--muted {
    background: var(--gray-50);
    border-color: transparent;
}

.archive-tip__title {
    margin: 0 0 0.55rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--green-900);
}

.archive-tip__list {
    margin: 0;
    padding-left: 1.15rem;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--gray-700);
}

.archive-tip__list li + li {
    margin-top: 0.35rem;
}

.archive-tip--muted p {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--gray-500);
}

.archive-table-card {
    background: var(--white);
    border: 1px solid rgb(22 163 74 / 0.12);
    border-radius: 16px;
    box-shadow: 0 4px 22px rgb(15 23 42 / 0.06);
    overflow: hidden;
}

.archive-table-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 1rem 1.15rem 0.75rem;
    border-bottom: 1px solid var(--gray-100);
}

.archive-table-card__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gray-900);
}

.archive-table-card__hint {
    font-size: 0.78rem;
    color: var(--gray-500);
}

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

.archive-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.archive-table th {
    padding: 0.55rem 0.85rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    background: var(--green-50);
    border-bottom: 1px solid rgb(22 163 74 / 0.1);
    white-space: nowrap;
}

.archive-table td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.archive-table tbody tr {
    transition: background 0.15s ease;
}

.archive-table tbody tr:hover {
    background: var(--green-50);
}

.archive-table tbody tr:last-child td {
    border-bottom: none;
}

.archive-table__date {
    white-space: nowrap;
}

.archive-table__date time {
    display: block;
    font-weight: 600;
    color: var(--gray-900);
}

.archive-table__time {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.archive-table__file {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 280px;
}

.archive-table__file-icon {
    flex-shrink: 0;
    display: flex;
    color: var(--green-700);
    opacity: 0.85;
}

.archive-table__filename {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    color: var(--gray-900);
}

.archive-table__property {
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--gray-700);
}

.archive-table__size {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: var(--gray-500);
    font-size: 0.8rem;
}

.archive-table__muted {
    color: var(--gray-500);
}

.archive-unit-pill {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--green-100);
    color: var(--green-800);
}

.archive-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.archive-badge--contract {
    background: #dbeafe;
    color: #1e40af;
}

.archive-badge--installment {
    background: #ede9fe;
    color: #5b21b6;
}

.archive-badge--down {
    background: #ffedd5;
    color: #c2410c;
}

.archive-badge--monthly {
    background: var(--green-100);
    color: var(--green-800);
}

.archive-badge--receipt {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid rgb(22 163 74 / 0.15);
}

.archive-badge--application {
    background: #fef3c7;
    color: #92400e;
}

.archive-badge--transfer {
    background: #fce7f3;
    color: #9d174d;
}

.archive-badge--muted {
    background: var(--gray-100);
    color: var(--gray-500);
}

.archive-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--white);
    border: 1px dashed rgb(22 163 74 / 0.25);
    border-radius: 16px;
}

.archive-empty__icon {
    display: inline-flex;
    margin-bottom: 1rem;
    color: var(--green-600);
    opacity: 0.7;
}

.archive-empty__title {
    margin: 0 0 0.4rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
}

.archive-empty__text {
    margin: 0;
    max-width: 22rem;
    margin-inline: auto;
    font-size: 0.9rem;
    color: var(--gray-500);
    line-height: 1.5;
}

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

    .archive-stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .archive-hero {
        flex-direction: column;
    }

    .archive-tree {
        font-size: 0.74rem;
    }

    .archive-table th:nth-child(4),
    .archive-table td:nth-child(4) {
        display: none;
    }
}

/* ═══════════════════════════════════════════════
   Mobile card tables (<=640px)
   ═══════════════════════════════════════════════ */

@media (max-width: 640px) {
    .inst-table:not(#inst-table):not(#crm-table):not(#notif-table):not(#notif-table) thead,
    .crm-deals-table thead,
    .archive-table thead {
        display: none;
    }

    .inst-table:not(#inst-table):not(#crm-table):not(#notif-table) tbody,
    .crm-deals-table tbody,
    .archive-table tbody {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .inst-table:not(#inst-table):not(#crm-table):not(#notif-table) tbody tr,
    .crm-deals-table tbody tr,
    .archive-table tbody tr {
        display: flex;
        flex-direction: column;
        gap: 0;
        background: var(--white);
        border: 1px solid var(--gray-100);
        border-radius: 14px;
        padding: 0.65rem 0.85rem;
        box-shadow: 0 1px 3px rgb(15 23 42 / 0.04);
    }

    .inst-table:not(#inst-table):not(#crm-table):not(#notif-table) tbody tr:hover,
    .crm-deals-table tbody tr:hover,
    .archive-table tbody tr:hover {
        background: var(--green-50);
    }

    .inst-table__row--overdue {
        border-color: #fecaca !important;
        background: #fef2f2 !important;
    }

    .inst-table:not(#inst-table):not(#crm-table):not(#notif-table) td,
    .crm-deals-table td,
    .archive-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        padding: 0.35rem 0 !important;
        border-bottom: none !important;
        white-space: normal;
        font-size: 0.86rem;
    }

    .inst-table:not(#inst-table):not(#crm-table):not(#notif-table) td[data-label]:not([data-label=""])::before,
    .crm-deals-table td[data-label]:not([data-label=""])::before,
    .archive-table td[data-label]:not([data-label=""])::before {
        content: attr(data-label);
        flex-shrink: 0;
        min-width: 5.5rem;
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--gray-500);
    }

    .inst-table:not(#inst-table):not(#crm-table):not(#notif-table) td:first-child {
        padding-bottom: 0.25rem !important;
        border-bottom: 1px solid var(--gray-100) !important;
        margin-bottom: 0.15rem;
    }

    .inst-table:not(#inst-table):not(#crm-table):not(#notif-table) td:first-child strong {
        font-size: 0.95rem;
    }

    /* Рассрочка: таблица с горизонтальной прокруткой */
    .inst-page .inst-table-card:has(#inst-table) .inst-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        border: 1px solid var(--gray-100);
        border-radius: 12px;
        background: var(--white);
        box-shadow: 0 1px 3px rgb(15 23 42 / 0.04);
        margin: 0 0.35rem;
    }

    #inst-table {
        min-width: 36rem;
        width: max-content;
        font-size: 0.78rem;
    }

    #inst-table thead {
        display: table-header-group;
        position: sticky;
        top: 0;
        z-index: 2;
        background: var(--gray-50);
    }

    #inst-table thead th {
        padding: 0.4rem 0.5rem;
        font-size: 0.68rem;
        white-space: nowrap;
    }

    #inst-table tbody {
        display: table-row-group;
        padding: 0;
        gap: 0;
    }

    #inst-table tbody tr {
        display: table-row;
        padding: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
    }

    #inst-table tbody tr:hover {
        background: #f5f3ff;
    }

    #inst-table tbody tr.inst-table__row--overdue {
        background: #fef2f2 !important;
    }

    #inst-table td {
        display: table-cell;
        padding: 0.4rem 0.5rem !important;
        border-bottom: 1px solid var(--gray-100) !important;
        vertical-align: middle;
        white-space: nowrap;
    }

    #inst-table td::before {
        display: none !important;
    }

    #inst-table .inst-table__contract strong {
        font-size: 0.8rem;
    }

    #inst-table .inst-table__unit-line {
        max-width: 8rem;
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-block;
        vertical-align: bottom;
    }

    #inst-table .inst-progress {
        min-width: 4.5rem;
        max-width: 5rem;
    }

    #inst-table .inst-table__comment {
        white-space: nowrap;
    }

    .inst-page .inst-table-card:has(#inst-table) {
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        overflow: visible;
    }

    /* Клиенты: таблица с горизонтальной прокруткой (как рассрочки) */
    .crm-table-card .inst-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        border: 1px solid var(--gray-100);
        border-radius: 12px;
        background: var(--white);
        box-shadow: 0 1px 3px rgb(15 23 42 / 0.04);
        margin: 0 0.35rem;
    }

    #crm-table {
        min-width: 30rem;
        width: max-content;
        font-size: 0.78rem;
    }

    #crm-table thead {
        display: table-header-group;
        position: sticky;
        top: 0;
        z-index: 2;
        background: var(--gray-50);
    }

    #crm-table thead th {
        padding: 0.4rem 0.5rem;
        font-size: 0.68rem;
        white-space: nowrap;
    }

    #crm-table tbody {
        display: table-row-group;
        padding: 0;
        gap: 0;
    }

    #crm-table tbody tr {
        display: table-row;
        padding: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
    }

    #crm-table tbody tr:hover {
        background: #f5f3ff;
    }

    #crm-table tbody tr.inst-table__row--overdue {
        background: #fef2f2 !important;
    }

    #crm-table td {
        display: table-cell;
        padding: 0.4rem 0.5rem !important;
        border-bottom: 1px solid var(--gray-100) !important;
        vertical-align: middle;
        white-space: nowrap;
    }

    #crm-table td::before {
        display: none !important;
    }

    #crm-table .inst-table__client strong {
        font-size: 0.8rem;
    }

    #crm-table .inst-table__client {
        max-width: 10rem;
    }

    .crm-table-card {
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        overflow: visible;
    }

    /* Уведомления: таблица с горизонтальной прокруткой (как рассрочки) */
    .notif-table-card .inst-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        border: 1px solid var(--gray-100);
        border-radius: 12px;
        background: var(--white);
        box-shadow: 0 1px 3px rgb(15 23 42 / 0.04);
        margin: 0 0.35rem;
    }

    #notif-table {
        min-width: 38rem;
        width: max-content;
        font-size: 0.78rem;
    }

    #notif-table thead {
        display: table-header-group;
        position: sticky;
        top: 0;
        z-index: 2;
        background: var(--gray-50);
    }

    #notif-table thead th {
        padding: 0.4rem 0.5rem;
        font-size: 0.68rem;
        white-space: nowrap;
    }

    #notif-table tbody {
        display: table-row-group;
        padding: 0;
        gap: 0;
    }

    #notif-table tbody tr {
        display: table-row;
        padding: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
    }

    #notif-table tbody tr:hover {
        background: #f5f3ff;
    }

    #notif-table tbody tr.inst-table__row--overdue {
        background: #fef2f2 !important;
    }

    #notif-table td {
        display: table-cell;
        padding: 0.4rem 0.5rem !important;
        border-bottom: 1px solid var(--gray-100) !important;
        vertical-align: middle;
        white-space: nowrap;
    }

    #notif-table td::before {
        display: none !important;
    }

    #notif-table .inst-table__client strong,
    #notif-table td strong {
        font-size: 0.8rem;
    }

    .notif-table-card {
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        overflow: visible;
    }

    .inst-table__unit-line {
        font-size: 0.82rem;
        line-height: 1.35;
    }

    .inst-progress {
        flex: 1;
        max-width: 6rem;
    }

    .inst-table__comment {
        flex-direction: row;
    }

    .inst-table__comment .inst-comment-btn {
        flex-shrink: 0;
    }

    .archive-table__file {
        flex-wrap: wrap;
    }

    .archive-table__filename {
        white-space: normal !important;
        word-break: break-all;
    }

    .archive-table__file-icon {
        display: none;
    }

    .inst-table-wrap,
    .archive-table-wrap {
        overflow-x: visible;
        border: none;
        border-radius: 0;
    }

    .inst-table-card,
    .archive-table-card {
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        overflow: visible;
    }

    .archive-table-card__head {
        padding: 0 0 0.5rem;
        border-bottom: none;
    }

    #crm-table .inst-table__row--overdue .inst-table__remaining {
        color: #b91c1c;
    }
}

/* ═══════════════════════════════════════════════
   Phase 5: Global mobile improvements
   ═══════════════════════════════════════════════ */

/* Touch targets — min 44px for all interactive elements on touch devices */
@media (pointer: coarse) {
    .btn,
    .sidebar__link,
    a[role="button"],
    button,
    [tabindex="0"] {
        min-height: 44px;
    }

    .btn--sm {
        min-height: 40px;
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    select,
    input[type="text"],
    input[type="search"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="month"],
    textarea {
        min-height: 44px;
        font-size: 16px;
    }
}

/* Hover guard — only apply hover styles on devices that support hover */
@media (hover: none) {
    .btn:hover,
    .sidebar__link:hover,
    .inst-table__row:hover,
    .reports-kpi-card:hover,
    .reports-hero-card:hover {
        transform: none !important;
        box-shadow: inherit !important;
    }
}

/* Safe-area padding for notch / PWA standalone */
@supports (padding: env(safe-area-inset-top)) {
    .sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }

    @media (max-width: 768px) {
        .app-content {
            padding-left: max(0.75rem, env(safe-area-inset-left));
            padding-right: max(0.75rem, env(safe-area-inset-right));
            padding-bottom: max(1rem, env(safe-area-inset-bottom));
        }
    }
}

/* Bottom-sheet style modals on mobile */
@media (max-width: 640px) {
    .inst-drawer--sheet {
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: none !important;
        max-height: 92vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .inst-drawer--sheet:not([hidden]) {
        transform: translateY(0);
    }

    .inst-drawer__head {
        position: sticky;
        top: 0;
        z-index: 1;
        background: inherit;
        border-bottom: 1px solid var(--gray-100);
        border-radius: 20px 20px 0 0;
    }

    .inst-drawer__head::before {
        content: "";
        display: block;
        width: 2.5rem;
        height: 0.25rem;
        border-radius: 99px;
        background: var(--gray-300);
        margin: 0.5rem auto 0.25rem;
    }
}

/* Sticky form buttons on mobile */
@media (max-width: 768px) {
    .form-actions,
    .wizard-footer,
    .sw-footer {
        position: sticky;
        bottom: 0;
        z-index: 10;
        background: rgb(255 255 255 / 0.95);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        padding: 0.75rem 0;
        margin-top: 1rem;
        border-top: 1px solid var(--gray-100);
    }
}

/* Prevent 300ms tap delay */
html {
    touch-action: manipulation;
}


/* Sales wizard tables card view on mobile */
@media (max-width: 640px) {
    .sw-installment-schedule thead,
    .sw-contract-registry__table thead {
        display: none;
    }

    .sw-installment-schedule tbody,
    .sw-contract-registry__table tbody {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
        padding: 0.35rem;
    }

    .sw-installment-schedule tbody tr,
    .sw-contract-registry__table tbody tr {
        display: flex;
        flex-direction: column;
        background: var(--white);
        border: 1px solid var(--gray-100);
        border-radius: 12px;
        padding: 0.55rem 0.75rem;
    }

    .sw-installment-schedule td,
    .sw-contract-registry__table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        padding: 0.3rem 0 !important;
        border-bottom: none !important;
        font-size: 0.86rem;
    }

    .sw-installment-schedule td[data-label]:not([data-label=""])::before,
    .sw-contract-registry__table td[data-label]:not([data-label=""])::before {
        content: attr(data-label);
        flex-shrink: 0;
        min-width: 5rem;
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--gray-500);
    }

    .sw-installment-schedule-wrap,
    .sw-contract-registry__table-wrap {
        overflow-x: visible;
    }

    .ps-entrance-slots-table thead {
        display: none;
    }

    .ps-entrance-slots-table tbody {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
    }

    .ps-entrance-slots-table tbody tr {
        display: flex;
        flex-direction: column;
        background: var(--white);
        border: 1px solid var(--gray-100);
        border-radius: 12px;
        padding: 0.55rem 0.75rem;
    }

    .ps-entrance-slots-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        padding: 0.3rem 0 !important;
        border-bottom: none !important;
        font-size: 0.86rem;
    }

    .ps-entrance-slots-table td[data-label]::before {
        content: attr(data-label);
        flex-shrink: 0;
        min-width: 5rem;
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--gray-500);
    }

    .ps-entrance-slots-table__select {
        flex: 1;
    }

    .ps-entrance-slots-table-wrap {
        overflow-x: visible;
    }
}

/* Page head responsiveness on mobile */
@media (max-width: 640px) {
    .app-content__head {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .app-content__title {
        font-size: 1.25rem;
    }

    .app-content__actions {
        width: 100%;
    }

    .app-content__actions .btn {
        flex: 1;
        text-align: center;
        justify-content: center;
    }
}

/* ═══════════════════════════════════════════════
   Notifications / SMS page
   ═══════════════════════════════════════════════ */

.notif-warning {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 10px;
    color: #92400e;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}
.notif-warning a { color: #92400e; text-decoration: underline; }

/* Template block */
.notif-template {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    box-shadow: 0 2px 12px rgb(15 23 42 / 0.05);
    margin-bottom: 1rem;
}
.notif-template__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}
.notif-template__title {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--gray-800);
}
.notif-template__vars {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}
.notif-var-chip {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    background: var(--green-50);
    border: 1px solid var(--green-200);
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--green-700);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}
.notif-var-chip:hover {
    background: var(--green-100);
    border-color: var(--green-400);
}
.notif-template__textarea {
    width: 100%;
    min-height: 4.5rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    font-size: 0.85rem;
    line-height: 1.45;
    resize: vertical;
    font-family: inherit;
    color: var(--gray-800);
    background: var(--gray-50);
    transition: border-color 0.15s;
}
.notif-template__textarea:focus {
    outline: none;
    border-color: var(--green-400);
    background: var(--white);
}
.notif-template__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.65rem;
}
.notif-template__hint {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 600;
}

/* Checkbox */
.notif-check {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    width: 18px;
    height: 18px;
}
.notif-check input {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}
.notif-check__box {
    width: 18px;
    height: 18px;
    border: 2px solid var(--gray-300);
    border-radius: 4px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}
.notif-check input:checked + .notif-check__box {
    background: var(--green-600);
    border-color: var(--green-600);
}
.notif-check input:checked + .notif-check__box::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid var(--white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -1px;
}
.notif-check input:indeterminate + .notif-check__box {
    background: var(--green-400);
    border-color: var(--green-400);
}
.notif-check input:indeterminate + .notif-check__box::after {
    content: '';
    width: 8px;
    height: 2px;
    background: var(--white);
    border-radius: 1px;
}

/* Table */
.notif-table__check-col { width: 2.5rem; text-align: center; }
.notif-table__phone { font-variant-numeric: tabular-nums; }

/* Action icons */
.notif-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}
.notif-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: var(--white);
    color: var(--gray-500);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    text-decoration: none;
}
.notif-action-btn:hover {
    background: var(--gray-50);
    color: var(--gray-700);
    border-color: var(--gray-300);
}
.notif-action-btn--call:hover { color: var(--green-700); border-color: var(--green-300); background: var(--green-50); }
.notif-action-btn--sms:hover { color: #7c3aed; border-color: #c4b5fd; background: #f5f3ff; }

/* Status bar */
.notif-status-bar {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-top: 0.85rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1.45;
    border: 1px solid transparent;
    animation: notif-status-in 0.25s ease;
}

.notif-status-bar__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.05rem;
}

.notif-status-bar__text {
    flex: 1;
    min-width: 0;
}

.notif-status-bar--success {
    background: var(--green-50);
    color: var(--green-800);
    border-color: rgb(22 163 74 / 0.22);
}

.notif-status-bar--error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

@keyframes notif-status-in {
    from { opacity: 0; transform: translateY(-0.35rem); }
    to { opacity: 1; transform: translateY(0); }
}

/* Modal client info */
.notif-modal__dl {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
    padding: 0.65rem 0.75rem;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px solid var(--gray-100);
}
.notif-modal__dl-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.82rem;
}
.notif-modal__dt {
    color: var(--gray-500);
    font-weight: 600;
    flex-shrink: 0;
}
.notif-modal__dd {
    color: var(--gray-800);
    text-align: right;
}

/* Table card container */
.notif-table-card {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: 14px;
    box-shadow: 0 4px 20px rgb(15 23 42 / 0.06);
    overflow: hidden;
}

/* ── Mobile: notifications template ── */
@media (max-width: 640px) {
    .notif-template__head { flex-direction: column; align-items: flex-start; }
    .notif-template__actions { flex-direction: column; align-items: stretch; }
    .notif-template__actions .btn { width: 100%; justify-content: center; }
}

/* ===== Landing page (home) ===== */
.btn--lg {
    padding: 0.85rem 1.65rem;
    font-size: 1rem;
    border-radius: 12px;
}

.btn--white {
    background: var(--white);
    color: var(--green-800);
    border-color: var(--white);
    box-shadow: 0 8px 28px rgb(0 0 0 / 0.18);
}

.btn--white:hover {
    background: var(--green-50);
    color: var(--green-900);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgb(0 0 0 / 0.22);
}

.btn--telegram {
    gap: 0.5rem;
    color: var(--white);
    background: linear-gradient(145deg, #2aabee 0%, #229ed9 100%);
    border-color: #229ed9;
    box-shadow: 0 6px 20px rgb(34 158 217 / 0.35);
}

.btn--telegram:hover {
    color: var(--white);
    background: linear-gradient(145deg, #3bb5f0 0%, #2aabee 100%);
    border-color: #2aabee;
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgb(34 158 217 / 0.42);
}

.support-telegram {
    margin-top: 1.5rem;
    padding: 1.15rem 1.25rem;
    border-radius: 14px;
    background: var(--green-50);
    border: 1px solid rgb(22 163 74 / 0.14);
}

.support-telegram__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--green-900);
}

.support-telegram__text {
    margin: 0.4rem 0 0.85rem;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--gray-600);
}

.support-telegram-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    color: #229ed9;
    text-decoration: none;
}

.support-telegram-link:hover {
    color: #1784b8;
    text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════
   LANDING (/) и ВХОД (/login)
   Туманный фон, белые «дома» из пастельных квартир — как на шахматке.
   ═══════════════════════════════════════════════════════════ */

/* Дом из квартир (partials/bc-tower) */
.bt {
    --bt-w: 3rem;
    --bt-h: 2.25rem;
    --bt-gap: 5px;
    display: flex;
    flex-direction: column;
    padding: 0.8rem 0.8rem 0.7rem;
    border-radius: 20px 20px 8px 8px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
    font-family: var(--cb-font);
}

.bt__head {
    margin: 0 0 0.55rem 0.1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--cb-ink);
    white-space: nowrap;
}

.bt__body {
    display: flex;
    flex-direction: column;
    gap: var(--bt-gap);
}

.bt__floor {
    display: flex;
    align-items: stretch;
    gap: var(--bt-gap);
}

.bt__num {
    flex: 0 0 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.66rem;
    font-weight: 500;
    color: var(--cb-faint);
    font-variant-numeric: tabular-nums;
}

.bt__unit {
    flex: 0 0 var(--bt-w);
    height: var(--bt-h);
    padding: 0.2rem 0.35rem;
    border-radius: 8px;
    background: #eceef3;
    color: #3f4658;
}

.bt__unit b {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.bt__unit--available { background: #dcf5e9; color: #0e6546; }
.bt__unit--reserved { background: #ffecd2; color: #8a4a06; }
.bt__unit--sold { background: #e4e6fd; color: #353c9e; }
.bt__unit--installment { background: #f1e5fd; color: #6a2fae; }
.bt__unit--occupied { background: #eceef3; color: #3f4658; }

.bt--animate .bt__floor {
    animation: bt-rise 0.5s cubic-bezier(0.2, 0.9, 0.2, 1) both;
    animation-delay: var(--bt-d, 0ms);
}

@keyframes bt-rise {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

/* Кнопки */
.ld-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 3rem;
    padding: 0 1.4rem;
    border: 0;
    border-radius: 999px;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.ld-btn:focus-visible,
.ld-nav__link:focus-visible,
.ld-brand:focus-visible,
.lg-back:focus-visible,
.lg-submit:focus-visible,
.lg-field__reveal:focus-visible {
    outline: 2px solid var(--cb-accent);
    outline-offset: 2px;
}

.ld-btn--sm {
    height: 2.5rem;
    padding: 0 1.1rem;
    font-size: 0.9rem;
}

.ld-btn--ink {
    background: var(--cb-ink);
    color: #fff;
}

.ld-btn--ink:hover {
    background: #343a4d;
}

.ld-btn--soft {
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
    color: var(--cb-ink);
}

.ld-btn--soft svg {
    color: #229ed9;
}

.ld-btn--soft:hover {
    box-shadow: var(--cb-lift), inset 0 0 0 1px var(--cb-line);
}

.ld-btn--light {
    background: #fff;
    color: var(--cb-ink);
}

.ld-btn--light:hover {
    background: var(--cb-mist);
}

.ld-btn--ghost-light {
    background: rgb(255 255 255 / 0.1);
    color: #fff;
}

.ld-btn--ghost-light:hover {
    background: rgb(255 255 255 / 0.18);
}

.ld-btn--ghost-light:focus-visible {
    outline-color: #fff;
}

/* Страница */
.theme-public body:has(.ld) {
    background: var(--cb-mist);
}

.ld {
    min-height: 100vh;
    background: var(--cb-mist);
    font-family: var(--cb-font);
    color: var(--cb-ink);
    overflow-x: clip;
}

.ld-wrap {
    width: 100%;
    max-width: 76rem;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Шапка */
.ld-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgb(238 241 246 / 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding-top: env(safe-area-inset-top, 0px);
}

.ld-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: 4.5rem;
}

.ld-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
}

.ld-brand__logo {
    border-radius: 10px;
}

.ld-brand__name {
    font-size: 1.1rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.ld-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.ld-nav__link {
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    font-size: 0.925rem;
    font-weight: 500;
    color: var(--cb-muted);
    text-decoration: none;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.ld-nav__link:hover {
    background: rgb(31 36 51 / 0.05);
    color: var(--cb-ink);
}

/* Hero */
.ld-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    align-items: center;
    gap: 3rem;
    padding-top: 3.5rem;
    padding-bottom: 4rem;
}

.ld-hero__title {
    margin: 0;
    max-width: 11.5em;
    font-size: clamp(2.4rem, 4.8vw, 4.1rem);
    font-weight: 650;
    line-height: 1.04;
    letter-spacing: -0.045em;
    text-wrap: balance;
}

.ld-hero__lead {
    margin: 1.5rem 0 0;
    max-width: 31rem;
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--cb-muted);
}

.ld-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2rem;
}

.ld-hero__note {
    margin: 1.1rem 0 0;
    font-size: 0.875rem;
    color: var(--cb-faint);
}

.ld-hero__scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}

.ld-scene {
    position: relative;
    padding: 0 2rem;
}

.ld-scene__towers {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 1.1rem;
}

.ld-scene .bt {
    --bt-w: 3.15rem;
    --bt-h: 2.3rem;
}

.ld-scene__ground {
    height: 0.5rem;
    margin: 0.55rem -1rem 0;
    border-radius: 999px;
    background: #dde2eb;
}

.ld-float {
    position: absolute;
    z-index: 2;
    border-radius: 20px;
    background: var(--cb-surface);
    box-shadow: 0 2px 6px rgb(31 36 51 / 0.06), 0 22px 50px rgb(31 36 51 / 0.16);
    animation: ld-float-in 0.5s cubic-bezier(0.2, 0.9, 0.2, 1) both;
    animation-delay: 0.9s;
}

@keyframes ld-float-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.97);
    }
}

.ld-float--unit {
    top: 3.5rem;
    left: -3.5rem;
    width: 13.5rem;
    padding: 0.4rem;
}

.ld-float__hero {
    display: flex;
    flex-direction: column;
    padding: 0.85rem 0.9rem 0.9rem;
    border-radius: 16px;
    background: #dcf5e9;
    color: #0e6546;
}

.ld-float__eyebrow {
    font-size: 0.75rem;
    opacity: 0.8;
}

.ld-float__num {
    margin: 0.1rem 0 0.55rem;
    font-size: 1.5rem;
    font-weight: 650;
    letter-spacing: -0.03em;
}

.ld-float__pill {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.65rem 0.2rem 0.5rem;
    border-radius: 999px;
    background: rgb(255 255 255 / 0.7);
    font-size: 0.75rem;
    font-weight: 500;
}

.ld-float__pill i {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: #2bb07f;
}

.ld-float__facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    padding: 0.45rem 0.1rem 0.1rem;
}

.ld-float__facts span {
    display: flex;
    white-space: nowrap;
    flex-direction: column;
    padding: 0.5rem 0.65rem;
    border-radius: 12px;
    background: var(--cb-mist);
    font-size: 1rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.ld-float__facts small {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--cb-muted);
}

.ld-float--pay {
    right: -2.75rem;
    bottom: 4.5rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem 1rem 0.7rem 0.7rem;
    border-radius: 999px;
    animation-delay: 1.1s;
}

.ld-float__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: #dcf5e9;
    color: #0e6546;
    font-weight: 600;
}

.ld-float__pay-text {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    line-height: 1.3;
}

.ld-float__pay-text b {
    font-weight: 600;
}

.ld-float__pay-text small {
    font-size: 0.75rem;
    color: var(--cb-muted);
}

.ld-float__amount {
    font-size: 0.95rem;
    font-weight: 650;
    color: #0e6546;
    font-variant-numeric: tabular-nums;
}

.ld-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem 1.25rem;
    margin: 1.25rem 0 0;
    padding: 0;
    list-style: none;
}

.ld-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    color: var(--cb-muted);
}

.ld-legend__item::before {
    content: "";
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
}

.ld-legend__item--available::before { background: #2bb07f; }
.ld-legend__item--reserved::before { background: #f2a33a; }
.ld-legend__item--sold::before { background: #6b74e8; }
.ld-legend__item--installment::before { background: #a769e6; }

/* Секции */
.ld-section {
    padding: 4.5rem 0;
}

.ld-section__head {
    margin-bottom: 2.25rem;
}

.ld-section__title {
    margin: 0;
    font-size: clamp(1.8rem, 3.2vw, 2.6rem);
    font-weight: 650;
    line-height: 1.1;
    letter-spacing: -0.035em;
}

.ld-section__lead {
    margin: 0.75rem 0 0;
    max-width: 36rem;
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--cb-muted);
}

/* Возможности */
.ld-features {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1.25rem;
}

.ld-feature {
    grid-column: span 5;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
    padding: 1.75rem;
    border-radius: 28px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
}

.ld-feature--wide {
    grid-column: span 7;
}

.ld-feature__title {
    margin: 0 0 0.5rem;
    font-size: 1.35rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.ld-feature__text p {
    margin: 0;
    max-width: 30rem;
    font-size: 0.975rem;
    line-height: 1.6;
    color: var(--cb-muted);
}

.ld-mock {
    margin-top: auto;
    padding: 1rem;
    border-radius: 20px;
    background: var(--cb-mist);
    overflow: hidden;
}

/* Макет: шахматка */
.ld-mock__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.ld-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 2rem;
    padding: 0 0.75rem 0 0.65rem;
    border-radius: 999px;
    background: var(--cb-surface);
    font-size: 0.8rem;
    white-space: nowrap;
}

.ld-chip::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
}

.ld-chip b {
    font-weight: 600;
    color: var(--cb-muted);
}

.ld-chip--available::before { background: #2bb07f; }
.ld-chip--reserved::before { background: #f2a33a; }
.ld-chip--sold::before { background: #6b74e8; }
.ld-chip--installment::before { background: #a769e6; }

.ld-chip--available {
    background: #dcf5e9;
    color: #0e6546;
    box-shadow: inset 0 0 0 1.5px #2bb07f;
}

.ld-chip--available b {
    color: inherit;
}

.ld-mock__towers {
    -webkit-mask-image: linear-gradient(to right, #000 82%, transparent);
    mask-image: linear-gradient(to right, #000 82%, transparent);
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
}

.ld-mock__towers .bt {
    --bt-w: 2.6rem;
    --bt-h: 2rem;
    flex-shrink: 0;
    padding: 0.65rem;
    border-radius: 16px 16px 6px 6px;
    box-shadow: none;
}

/* Эффект фильтра: не свободные квартиры приглушены */
.ld-mock--board .bt__unit:not(.bt__unit--available) {
    opacity: 0.22;
}

/* Макет: график рассрочки */
.ld-sched__head {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.ld-sched__progress {
    flex: 1;
    height: 0.4rem;
    border-radius: 999px;
    background: var(--cb-surface);
    overflow: hidden;
}

.ld-sched__progress i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #a769e6;
}

.ld-sched {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ld-sched li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 6.25rem;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 12px;
    background: var(--cb-surface);
    font-size: 0.85rem;
}

.ld-sched li span {
    color: var(--cb-muted);
}

.ld-sched li b {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.ld-sched li em {
    justify-self: end;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--cb-mist);
    font-size: 0.75rem;
    font-style: normal;
    color: var(--cb-muted);
}

.ld-sched li.is-paid em {
    background: #dcf5e9;
    color: #0e6546;
}

.ld-sched li.is-late b {
    color: #a11d35;
}

.ld-sched li.is-late em {
    background: #ffe2e6;
    color: #a11d35;
}

/* Макет: касса */
.ld-cash__balance {
    display: flex;
    flex-direction: column;
    margin: 0.15rem 0.25rem 0.9rem;
}

.ld-cash__balance small {
    font-size: 0.8rem;
    color: var(--cb-muted);
}

.ld-cash__balance strong {
    font-size: 2rem;
    font-weight: 650;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
}

.ld-cash {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ld-cash li {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.75rem 0.55rem 0.55rem;
    border-radius: 14px;
    background: var(--cb-surface);
}

.ld-cash i {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-style: normal;
    font-weight: 600;
}

.ld-cash span {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
}

.ld-cash small {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--cb-muted);
}

.ld-cash b {
    font-size: 0.9rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ld-cash .is-in i { background: #dcf5e9; color: #0e6546; }
.ld-cash .is-in b { color: #0e6546; }
.ld-cash .is-out i { background: #ffe2e6; color: #a11d35; }
.ld-cash .is-out b { color: #a11d35; }

/* Макет: отчёты */
.ld-report__figures {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin: 0 0 1rem;
}

.ld-report__figures div {
    padding: 0.65rem 0.8rem;
    border-radius: 14px;
    background: var(--cb-surface);
}

.ld-report__figures dt {
    font-size: 0.75rem;
    white-space: nowrap;
    color: var(--cb-muted);
}

.ld-report__figures dd {
    margin: 0.1rem 0 0;
    font-size: 1.05rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ld-report__figures .is-in dd { color: #0e6546; }
.ld-report__figures .is-net dd { color: #353c9e; }

.ld-report__chart {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    height: 8.5rem;
    padding: 0.9rem 0.9rem 0;
    border-radius: 14px;
    background: var(--cb-surface);
    background-image: linear-gradient(var(--cb-line) 1px, transparent 1px);
    background-size: 100% 2.1rem;
    background-position: 0 0.9rem;
}

.ld-report__day {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 100%;
}

.ld-report__day i {
    flex: 1;
    border-radius: 6px 6px 0 0;
}

.ld-report__day .is-in { background: #2bb07f; }
.ld-report__day .is-out { background: #ef5b73; }

/* Широкие карточки: текст слева, макет справа */
@media (min-width: 1100px) {
    .ld-feature--wide {
        display: grid;
        grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
        align-items: end;
        gap: 1.75rem;
    }

    .ld-feature--wide .ld-feature__text {
        align-self: start;
    }
}

/* Ещё в системе */
.ld-more {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
    margin: 2.75rem 0 0;
    padding: 0;
    list-style: none;
}

.ld-more__item {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.ld-more__item > span:last-child {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--cb-muted);
}

.ld-more__item strong {
    font-size: 0.975rem;
    font-weight: 600;
    color: var(--cb-ink);
}

.ld-more__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 12px;
    background: var(--cb-surface);
    color: var(--cb-accent);
}

.ld-more__icon .sidebar__icon-svg {
    width: 1.2rem;
    height: 1.2rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Как начать */
.ld-section--start {
    padding-top: 1.5rem;
}

.ld-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ld-step {
    position: relative;
}

.ld-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 1.25rem;
    left: 3.5rem;
    right: -1rem;
    height: 1px;
    background: #d3d8e2;
}

.ld-step__num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: 1.1rem;
    border-radius: 50%;
    background: var(--cb-ink);
    font-weight: 600;
    color: #fff;
}

.ld-step h3 {
    margin: 0 0 0.4rem;
    font-size: 1.15rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.ld-step p {
    margin: 0;
    max-width: 22rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--cb-muted);
}

.ld-step a {
    font-weight: 500;
    color: var(--cb-accent);
    text-decoration: none;
}

.ld-step a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Призыв */
.ld-cta {
    margin-bottom: 1rem;
}

.ld-cta__inner {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
    align-items: end;
    gap: 2rem;
    padding: 3rem 3rem 0;
    border-radius: 32px;
    background: var(--cb-ink);
    color: #fff;
    overflow: hidden;
}

.ld-cta__copy {
    align-self: center;
    padding-bottom: 3rem;
}

.ld-cta__title {
    margin: 0;
    max-width: 16em;
    font-size: clamp(1.6rem, 2.8vw, 2.25rem);
    font-weight: 650;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.ld-cta__copy p {
    margin: 0.85rem 0 0;
    max-width: 30rem;
    line-height: 1.6;
    color: rgb(255 255 255 / 0.68);
}

.ld-cta__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.75rem;
}

.ld-cta__art {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0.6rem;
}

.ld-cta__art .bt {
    --bt-w: 1.35rem;
    --bt-h: 1.1rem;
    --bt-gap: 4px;
    padding: 0.55rem 0.55rem 0.8rem;
    border-radius: 12px 12px 0 0;
    background: rgb(255 255 255 / 0.07);
    box-shadow: none;
}

.ld-cta__art .bt__unit {
    padding: 0;
    border-radius: 4px;
}

/* Подвал */
.ld-footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    padding-top: 2rem;
    padding-bottom: max(2.5rem, env(safe-area-inset-bottom, 0px));
    font-size: 0.875rem;
    color: var(--cb-muted);
}

.ld-footer__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.ld-footer__brand img {
    border-radius: 7px;
}

.ld-footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
}

.ld-footer__links a {
    color: inherit;
    text-decoration: none;
}

.ld-footer__links a:hover {
    color: var(--cb-ink);
}

/* Подробные разделы: текст + макет */
.ld-deep {
    padding: 3.5rem 0;
}

.ld-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    align-items: center;
    gap: 4rem;
}

.ld-split--reverse .ld-split__text {
    order: 2;
}

.ld-split__art {
    position: relative;
    min-width: 0;
    padding: 2.25rem;
    border-radius: 32px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
}

.ld-split__art--center {
    display: flex;
    justify-content: center;
    padding-bottom: 0;
    overflow: hidden;
}

.ld-points {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 2rem 0 0;
    padding: 0;
    list-style: none;
}

.ld-points li {
    position: relative;
    padding-left: 1.5rem;
    font-size: 0.975rem;
    line-height: 1.6;
    color: var(--cb-muted);
}

.ld-points li::before {
    content: "";
    position: absolute;
    top: 0.55rem;
    left: 0.15rem;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--cb-accent);
}

.ld-points strong {
    font-weight: 600;
    color: var(--cb-ink);
}

/* Рассрочка */
.ld-inst {
    padding: 1.25rem;
    border-radius: 22px;
    background: var(--cb-mist);
}

.ld-inst__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.ld-inst__head > div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ld-inst__eyebrow {
    font-size: 0.8rem;
    color: var(--cb-muted);
}

.ld-inst__name {
    font-size: 1.35rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.ld-inst__ring {
    --p: 0;
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4.25rem;
    height: 4.25rem;
    border-radius: 50%;
    background: conic-gradient(#a769e6 calc(var(--p) * 1%), #e5d2fb 0);
}

.ld-inst__ring::before {
    content: "";
    position: absolute;
    inset: 0.45rem;
    border-radius: 50%;
    background: var(--cb-mist);
}

.ld-inst__ring b {
    position: relative;
    font-size: 0.9rem;
    font-weight: 650;
    color: #6a2fae;
}

.ld-inst__facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4rem;
    margin: 0 0 0.75rem;
}

.ld-inst__facts div {
    padding: 0.6rem 0.75rem;
    border-radius: 14px;
    background: var(--cb-surface);
}

.ld-inst__facts dt {
    font-size: 0.75rem;
    color: var(--cb-muted);
}

.ld-inst__facts dd {
    margin: 0.1rem 0 0;
    font-size: 1.05rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.ld-inst__facts dd.is-in {
    color: #0e6546;
}

.ld-sched li.is-selected {
    box-shadow: inset 0 0 0 1.5px #ef5b73;
}

.ld-inst__action {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 2.75rem;
    margin-top: 0.75rem;
    border-radius: 999px;
    background: var(--cb-ink);
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
}

.ld-split__art:has(.ld-sms) {
    margin-bottom: 2.5rem;
}

.ld-sms {
    position: absolute;
    right: -1.5rem;
    bottom: -3.5rem;
    max-width: 17rem;
    padding: 0.8rem 1rem;
    border-radius: 18px 18px 4px 18px;
    background: #dcf1fb;
    box-shadow: 0 18px 40px rgb(31 36 51 / 0.14);
    font-size: 0.85rem;
    line-height: 1.45;
    color: #0c5a80;
}

.ld-sms__label {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.72rem;
    font-weight: 600;
}

/* Документы */
.ld-paper {
    padding: 1.75rem 1.75rem 1.5rem;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 1px 2px rgb(31 36 51 / 0.08), 0 14px 34px rgb(31 36 51 / 0.1), inset 0 0 0 1px var(--cb-line);
    font-family: "Times New Roman", Times, serif;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #1f2433;
    transform: rotate(-1.2deg);
}

.ld-paper p {
    margin: 0 0 0.6rem;
}

.ld-paper__title {
    font-size: 1.05rem;
    font-weight: 700;
    text-align: center;
}

.ld-paper__meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.ld-paper mark {
    padding: 0 0.2rem;
    border-radius: 4px;
    background: #dcf2ea;
    color: #0c5d4d;
}

.ld-paper__line {
    display: block;
    height: 0.4rem;
    margin: 0.55rem 0;
    border-radius: 999px;
    background: var(--cb-mist);
}

.ld-paper__line--short {
    width: 60%;
}

.ld-paper__sign {
    display: flex;
    justify-content: space-between;
    margin-top: 1.25rem;
    padding-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--cb-muted);
}

.ld-paper__sign span {
    width: 40%;
    padding-top: 0.35rem;
    border-top: 1px solid #c9ced8;
}

.ld-files {
    position: absolute;
    right: -1.5rem;
    bottom: -2rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 15.5rem;
    margin: 0;
    padding: 0.5rem;
    border-radius: 20px;
    background: var(--cb-surface);
    box-shadow: 0 2px 6px rgb(31 36 51 / 0.06), 0 22px 50px rgb(31 36 51 / 0.16);
    list-style: none;
}

.ld-files li {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem;
    border-radius: 12px;
}

.ld-files li + li {
    box-shadow: 0 -1px 0 var(--cb-line);
}

.ld-files i {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 10px;
    font-size: 0.8rem;
    font-style: normal;
    font-weight: 700;
}

.ld-files i.is-word { background: #dcf1fb; color: #0c5a80; }
.ld-files i.is-pdf { background: #ffe2e6; color: #a11d35; }

.ld-files span {
    display: flex;
    flex-direction: column;
    min-width: 0;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
}

.ld-files small {
    font-size: 0.72rem;
    font-weight: 400;
    color: #0e6546;
}

/* Телефон */
.ld-phone {
    width: 17rem;
    padding: 0.6rem 0.6rem 0;
    border-radius: 2.4rem 2.4rem 0 0;
    background: var(--cb-ink);
}

.ld-phone__screen {
    height: 25rem;
    padding: 1.1rem 0.75rem 0;
    border-radius: 1.9rem 1.9rem 0 0;
    background: var(--cb-mist);
    overflow: hidden;
}

.ld-phone__top {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.ld-phone__top b {
    padding-left: 0.25rem;
    font-size: 1.15rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.ld-phone__search {
    display: flex;
    align-items: center;
    height: 2.25rem;
    padding: 0 0.9rem;
    border-radius: 999px;
    background: var(--cb-surface);
    font-size: 0.8rem;
    color: var(--cb-faint);
}

.ld-phone__chips {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 0.6rem;
}

.ld-phone__chips .ld-chip {
    height: 1.75rem;
    font-size: 0.72rem;
}

.ld-phone__list {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0.3rem;
    border-radius: 18px;
    background: var(--cb-surface);
    list-style: none;
}

.ld-phone__list li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.5rem;
    font-size: 0.8rem;
}

.ld-phone__list i {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
}

.ld-phone__list i.is-available { background: #2bb07f; }
.ld-phone__list i.is-reserved { background: #f2a33a; }
.ld-phone__list i.is-sold { background: #6b74e8; }
.ld-phone__list i.is-installment { background: #a769e6; }

.ld-phone__list b {
    min-width: 3rem;
    font-weight: 600;
}

.ld-phone__list span {
    color: var(--cb-muted);
}

.ld-phone__list em {
    margin-left: auto;
    font-style: normal;
    color: var(--cb-muted);
    font-variant-numeric: tabular-nums;
}

/* Роли */
.ld-roles {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 4px;
    font-size: 0.9rem;
}

.ld-roles th,
.ld-roles td {
    padding: 0.7rem 0.5rem;
    text-align: center;
}

.ld-roles thead th {
    padding-top: 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--cb-muted);
}

.ld-roles tbody th {
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}

.ld-roles tbody th,
.ld-roles tbody td {
    background: var(--cb-mist);
}

.ld-roles tbody th {
    padding-left: 1rem;
    border-radius: 14px 0 0 14px;
}

.ld-roles tbody td:last-child {
    border-radius: 0 14px 14px 0;
}

.ld-roles td::before {
    content: "";
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: #d3d8e2;
}

.ld-roles td.is-on::before {
    width: 1.35rem;
    height: 1.35rem;
    vertical-align: middle;
    background: var(--cb-accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2312806a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 0.8rem no-repeat;
}

/* Было / стало */
.ld-compare {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.ld-compare__col {
    padding: 2rem;
    border-radius: 28px;
}

.ld-compare__col--before {
    background: rgb(255 255 255 / 0.5);
    box-shadow: inset 0 0 0 1px #dde2eb;
}

.ld-compare__col--after {
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
}

.ld-compare h3 {
    margin: 0 0 1.25rem;
    font-size: 1.25rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.ld-compare__col--before h3 {
    color: var(--cb-muted);
}

.ld-compare ul {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ld-compare li {
    position: relative;
    padding-left: 2rem;
    font-size: 0.975rem;
    line-height: 1.5;
}

.ld-compare li::before {
    content: "";
    position: absolute;
    top: 0.1rem;
    left: 0;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 50%;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 0.7rem;
}

.ld-compare__col--before li {
    color: var(--cb-muted);
}

.ld-compare__col--before li::before {
    background-color: #ffe2e6;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a11d35' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E");
}

.ld-compare__col--after li::before {
    background-color: #dcf5e9;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230e6546' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

/* Вопросы */
.ld-faq-wrap {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 3rem;
    align-items: start;
}

.ld-faq-wrap .ld-section__lead a {
    font-weight: 500;
    color: var(--cb-accent);
    text-decoration: none;
}

.ld-faq {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ld-faq__item {
    border-radius: 20px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
}

.ld-faq__item summary {
    position: relative;
    padding: 1.15rem 3.5rem 1.15rem 1.35rem;
    font-size: 1rem;
    font-weight: 600;
    list-style: none;
    cursor: pointer;
}

.ld-faq__item summary::-webkit-details-marker {
    display: none;
}

.ld-faq__item summary::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 1.1rem;
    width: 1.75rem;
    height: 1.75rem;
    margin-top: -0.875rem;
    border-radius: 50%;
    background: var(--cb-mist) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2433' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center / 0.85rem no-repeat;
    transition: transform 0.2s ease;
}

.ld-faq__item[open] summary::after {
    transform: rotate(45deg);
}

.ld-faq__item summary:focus-visible {
    outline: 2px solid var(--cb-accent);
    outline-offset: 2px;
    border-radius: 20px;
}

.ld-faq__item p {
    margin: 0;
    padding: 0 1.35rem 1.25rem;
    max-width: 40rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--cb-muted);
}

@media (max-width: 1100px) {
    .ld-split,
    .ld-faq-wrap {
        grid-template-columns: minmax(0, 1fr);
        gap: 2rem;
    }

    .ld-split--reverse .ld-split__text {
        order: 0;
    }

    .ld-split__art {
        margin-bottom: 1.5rem;
    }

    .ld-sms,
    .ld-files {
        right: 1rem;
    }
}

@media (max-width: 760px) {
    .ld-deep {
        padding: 2.5rem 0;
    }

    .ld-split__art {
        padding: 1rem;
        border-radius: 24px;
    }

    .ld-split__art--center {
        padding-bottom: 0;
    }

    .ld-inst {
        padding: 0.9rem;
    }

    .ld-inst__facts dd {
        font-size: 0.9rem;
    }

    .ld-split__art:has(.ld-sms) {
        margin-bottom: 0;
    }

    .ld-sms,
    .ld-files {
        position: static;
        max-width: none;
        width: auto;
        margin-top: 0.75rem;
        box-shadow: none;
    }

    .ld-files {
        background: var(--cb-mist);
    }

    .ld-paper {
        padding: 1.25rem 1.1rem;
        font-size: 0.82rem;
        transform: none;
    }

    .ld-roles {
        font-size: 0.8rem;
    }

    .ld-roles th,
    .ld-roles td {
        padding: 0.55rem 0.2rem;
    }

    .ld-roles thead th {
        font-size: 0.66rem;
    }

    .ld-roles tbody th {
        padding-left: 0.6rem;
        white-space: normal;
    }

    .ld-compare {
        grid-template-columns: minmax(0, 1fr);
    }

    .ld-compare__col {
        padding: 1.5rem 1.25rem;
        border-radius: 24px;
    }

    .ld-faq__item summary {
        padding: 1rem 3.25rem 1rem 1.1rem;
        font-size: 0.95rem;
    }

    .ld-faq__item p {
        padding: 0 1.1rem 1.1rem;
    }
}

/* Адаптив: главная */
@media (max-width: 1100px) {
    .ld-hero {
        grid-template-columns: minmax(0, 1fr);
        gap: 3rem;
        padding-top: 2rem;
    }

    .ld-hero__title {
        max-width: 13em;
    }

    .ld-feature,
    .ld-feature--wide {
        grid-column: 1 / -1;
    }

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

@media (max-width: 760px) {
    .ld-wrap {
        padding: 0 1rem;
    }

    .ld-nav__link {
        display: none;
    }

    .ld-header__inner {
        height: 4rem;
    }

    .ld-hero {
        gap: 2.25rem;
        padding-top: 1.25rem;
        padding-bottom: 2.5rem;
    }

    .ld-hero__title {
        font-size: 2.35rem;
    }

    .ld-hero__lead {
        margin-top: 1rem;
        font-size: 1rem;
    }

    .ld-hero__actions {
        flex-direction: column;
    }

    .ld-hero__actions .ld-btn {
        width: 100%;
    }

    .ld-scene {
        padding: 0;
    }

    .ld-scene__towers {
        gap: 0.6rem;
    }

    .ld-scene .bt {
        --bt-w: 2.05rem;
        --bt-h: 1.75rem;
        --bt-gap: 4px;
        padding: 0.6rem 0.55rem 0.55rem;
        border-radius: 16px 16px 6px 6px;
    }

    .ld-scene .bt__num {
        flex-basis: 0.9rem;
        font-size: 0.6rem;
    }

    .ld-scene .bt__unit {
        padding: 0.15rem 0.25rem;
        border-radius: 6px;
    }

    .ld-scene .bt__unit b {
        font-size: 0.58rem;
    }

    .ld-float--unit {
        top: 2.25rem;
        left: -0.25rem;
        width: 10.5rem;
    }

    .ld-float__num {
        font-size: 1.2rem;
    }

    .ld-float--unit {
        width: auto;
    }

    .ld-float__facts {
        display: none;
    }

    .ld-float--pay {
        right: -0.25rem;
        bottom: 2.5rem;
        padding: 0.5rem 0.8rem 0.5rem 0.5rem;
    }

    .ld-float__pay-text small {
        display: none;
    }

    .ld-section {
        padding: 3rem 0;
    }

    .ld-feature {
        padding: 1.25rem;
        border-radius: 24px;
    }

    .ld-mock {
        margin: 0 -0.5rem -0.5rem;
        padding: 0.75rem;
    }

    .ld-mock__towers .bt:last-child {
        display: none;
    }

    .ld-sched li {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .ld-sched li em {
        display: none;
    }

    .ld-report__figures {
        grid-template-columns: minmax(0, 1fr);
    }

    .ld-report__figures div {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
    }

    .ld-more {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.1rem;
    }

    .ld-steps {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.75rem;
    }

    .ld-step {
        padding-left: 3.5rem;
    }

    .ld-step__num {
        position: absolute;
        top: -0.35rem;
        left: 0;
    }

    .ld-step:not(:last-child)::after {
        top: 2.65rem;
        left: 1.25rem;
        right: auto;
        bottom: -1.5rem;
        width: 1px;
        height: auto;
    }

    .ld-cta__inner {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
        padding: 2rem 1.35rem 0;
        border-radius: 26px;
    }

    .ld-cta__copy {
        padding-bottom: 2rem;
    }

    .ld-cta__actions {
        flex-direction: column;
    }

    .ld-cta__actions .ld-btn {
        width: 100%;
    }
}

/* Вход */
.theme-public body:has(.lg) {
    background: var(--cb-surface);
}

.lg {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
    padding: 0.75rem;
    background: var(--cb-surface);
    font-family: var(--cb-font);
    color: var(--cb-ink);
}

.lg-art {
    display: flex;
    flex-direction: column;
    padding: 1.75rem 2rem 2rem;
    border-radius: 28px;
    background: var(--cb-mist);
    overflow: hidden;
}

.lg-art__brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 1.1rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.lg-art__brand img {
    border-radius: 10px;
}

.lg-art__scene {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    align-items: flex-end;
    justify-content: center;
    gap: 1rem;
    padding: 2rem 0;
}

.lg-art__caption {
    margin: 0;
    max-width: 22rem;
    font-size: 1.05rem;
    line-height: 1.55;
    color: var(--cb-muted);
}

.lg-panel {
    display: flex;
    flex-direction: column;
    padding: 1rem 2rem 2rem;
}

.lg-back {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.85rem 0.5rem 0.6rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--cb-muted);
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.lg-back:hover {
    background: var(--cb-mist);
    color: var(--cb-ink);
}

.lg-card {
    width: min(24rem, 100%);
    margin: auto;
    padding: 2rem 0;
}

.lg-card__logo {
    display: block;
    border-radius: 14px;
}

.lg-card__title {
    margin: 1.25rem 0 0.4rem;
    font-size: 2rem;
    font-weight: 650;
    line-height: 1.15;
    letter-spacing: -0.035em;
}

.lg-card__lead {
    margin: 0;
    font-size: 0.975rem;
    line-height: 1.55;
    color: var(--cb-muted);
}

.lg-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    margin-top: 2rem;
}

.lg-field label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--cb-muted);
}

.lg-field input {
    width: 100%;
    height: 3.25rem;
    padding: 0 1rem;
    border: 0;
    border-radius: 14px;
    background: var(--cb-mist);
    font: inherit;
    font-size: 1rem;
    color: var(--cb-ink);
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.lg-field input::placeholder {
    color: var(--cb-faint);
}

.lg-field input:focus {
    outline: none;
    background: var(--cb-surface);
    box-shadow: 0 0 0 2px var(--cb-accent);
}

.lg-field input[aria-invalid="true"] {
    box-shadow: inset 0 0 0 1.5px #ef5b73;
}

.lg-field__control {
    position: relative;
}

.lg-field__control input {
    padding-right: 3.25rem;
}

.lg-field__reveal {
    position: absolute;
    top: 50%;
    right: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--cb-faint);
    cursor: pointer;
    transform: translateY(-50%);
}

.lg-field__reveal:hover,
.lg-field__reveal.is-on {
    color: var(--cb-ink);
}

.lg-field__error {
    margin: 0.4rem 0 0;
    font-size: 0.85rem;
    color: #a11d35;
}

.lg-check {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.925rem;
    cursor: pointer;
    user-select: none;
}

.lg-check input {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
    accent-color: var(--cb-ink);
}

.lg-submit {
    height: 3.25rem;
    margin-top: 0.35rem;
    border: 0;
    border-radius: 999px;
    background: var(--cb-ink);
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.lg-submit:hover {
    background: #343a4d;
}

.lg-help {
    margin: 1.5rem 0 0;
    font-size: 0.9rem;
    color: var(--cb-muted);
}

.lg-help a {
    font-weight: 500;
    color: var(--cb-accent);
    text-decoration: none;
}

.lg-help a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 900px) {
    .lg {
        grid-template-columns: minmax(0, 1fr);
        padding: 0;
    }

    .lg-art {
        display: none;
    }

    .lg-panel {
        padding: max(0.75rem, env(safe-area-inset-top, 0px)) 1.25rem max(1.5rem, env(safe-area-inset-bottom, 0px));
    }

    .lg-card {
        margin: 1.5rem auto auto;
    }

    .lg-card__title {
        font-size: 1.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bt--animate .bt__floor,
    .ld-float {
        animation: none;
    }
}


/* ── Pagination ───────────────────────────────────────────── */
.bc-pagination {
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: center;
}
.bc-pag {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    justify-content: center;
}
.bc-pag__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.1rem;
    height: 2.1rem;
    padding: 0 0.5rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    color: #374151;
    background: #fff;
    border: 1px solid #e5e7eb;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    cursor: pointer;
}
.bc-pag__link:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}
.bc-pag__link--active {
    background: #166534;
    color: #fff;
    border-color: #166534;
    cursor: default;
}
.bc-pag__link--active:hover {
    background: #166534;
    border-color: #166534;
}
.bc-pag__link--disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}
.bc-pag__link--dots {
    border-color: transparent;
    background: transparent;
    cursor: default;
}

/* ----- Space zones / commercial lots ----- */
.space-floor { display: flex; flex-direction: column; gap: 1.25rem; }
.space-zone {
    padding: 1rem 1.1rem;
    border: 1px solid rgb(22 163 74 / 0.18);
    border-radius: 12px;
    background: #f8fbf9;
}
.space-zone__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}
.space-zone__title { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--green-950); }
.space-zone__meta { margin: 0.25rem 0 0; font-size: 0.88rem; color: var(--gray-600); }
.space-zone__form,
.space-zone__create,
.space-lots__add { margin-top: 0.75rem; }
.space-lots__title { margin: 1rem 0 0.5rem; font-size: 0.92rem; font-weight: 700; }
.space-lots__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.space-lots__table th,
.space-lots__table td {
    text-align: left;
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid rgb(22 163 74 / 0.12);
}
.space-lots__actions { white-space: nowrap; }
.field--actions { display: flex; flex-direction: column; justify-content: flex-end; }
.space-lot-card {
    --slc-ink: #14532d;
    --slc-muted: #64748b;
    --slc-line: rgb(20 83 45 / 0.12);
    max-width: 52rem;
    padding: 0;
    border-radius: 18px;
    background: #fff;
    border: 1px solid var(--slc-line);
    box-shadow: 0 10px 28px rgb(15 40 25 / 0.06);
    overflow: hidden;
    animation: shops-lot-in 0.45s ease both;
}
.space-lot-card--available { border-color: rgb(34 197 94 / 0.28); }
.space-lot-card--sold,
.space-lot-card--installment,
.space-lot-card--reassignment { border-color: rgb(239 68 68 / 0.2); }
.space-lot-card--reserved { border-color: rgb(234 179 8 / 0.35); }
.space-lot-card__hero {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.35rem 1.5rem 1.15rem;
    background:
        linear-gradient(135deg, rgb(240 253 244 / 0.95), #fff 70%),
        radial-gradient(ellipse at 100% 0%, rgb(34 197 94 / 0.1), transparent 50%);
    border-bottom: 1px solid var(--slc-line);
}
.space-lot-card__eyebrow {
    margin: 0 0 0.2rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #15803d;
}
.space-lot-card__title {
    margin: 0;
    font-size: clamp(1.45rem, 2.4vw, 1.85rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--slc-ink);
}
.space-lot-card__sub {
    margin: 0.35rem 0 0;
    font-size: 0.88rem;
    color: var(--slc-muted);
}
.space-lot-card__highlights {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    border-bottom: 1px solid var(--slc-line);
}
@media (max-width: 560px) {
    .space-lot-card__highlights { grid-template-columns: 1fr; }
}
.space-lot-card__hi {
    padding: 1rem 1.25rem;
    border-right: 1px solid var(--slc-line);
}
.space-lot-card__hi:last-child { border-right: 0; }
@media (max-width: 560px) {
    .space-lot-card__hi {
        border-right: 0;
        border-bottom: 1px solid var(--slc-line);
    }
    .space-lot-card__hi:last-child { border-bottom: 0; }
}
.space-lot-card__hi-val {
    display: block;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--slc-ink);
    line-height: 1.15;
}
.space-lot-card__hi-lab {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--slc-muted);
}
.space-lot-card__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: 1rem;
    margin: 0;
    padding: 1.25rem 1.5rem;
}
.space-lot-card__grid dt { font-size: 0.75rem; color: var(--slc-muted); margin: 0 0 0.2rem; }
.space-lot-card__grid dd { margin: 0; font-weight: 650; font-size: 0.98rem; color: var(--slc-ink); }
.space-lot-card__notes {
    margin: 0 1.5rem 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    background: rgb(240 253 244 / 0.65);
    color: var(--gray-700);
    font-size: 0.92rem;
}
.space-lot-card__layout {
    margin: 0 1.5rem 1.5rem;
}
.space-lot-card__layout img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid var(--slc-line);
}
.space-lot-card__layout figcaption {
    margin-top: 0.4rem;
    font-size: 0.85rem;
    color: var(--slc-muted);
}

.shops-page__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.shops-page__stat {
    padding: 0.85rem 1.1rem;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgb(22 163 74 / 0.14);
    min-width: 8rem;
}
.shops-page__stat dt { margin: 0; font-size: 0.78rem; color: var(--gray-500); }
.shops-page__stat dd { margin: 0.2rem 0 0; font-size: 1.25rem; font-weight: 700; }
.shops-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
.shops-table th, .shops-table td { padding: 0.7rem 0.85rem; border-bottom: 1px solid #e8eee9; text-align: left; font-size: 0.92rem; }
.shops-table th { background: #f4faf6; font-size: 0.8rem; color: var(--gray-600); }

.space-lot-edit {
    border: 1px solid rgb(22 163 74 / 0.14);
    border-radius: 10px;
    background: #fff;
    margin-bottom: 0.5rem;
}
.space-lot-edit__summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    align-items: center;
    padding: 0.65rem 0.85rem;
    cursor: pointer;
    font-size: 0.9rem;
    list-style: none;
}
.space-lot-edit__summary::-webkit-details-marker { display: none; }
.space-lot-edit__num { font-weight: 700; color: var(--green-900); }
.space-lot-edit__status { color: var(--gray-500); font-size: 0.82rem; }
.space-lot-edit__form { padding: 0 0.85rem 0.85rem; }
.space-lot-edit__delete { padding: 0 0.85rem 0.75rem; }

.space-lot-edit__entrance {
    font-size: 0.78rem;
    color: var(--gray-500);
}
.space-lot-edit__plan {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--green-700);
}

/* ── Shops page ── */
.shops-page {
    --shops-ink: #14532d;
    --shops-muted: #64748b;
    --shops-line: rgb(20 83 45 / 0.12);
    --shops-card: #fff;
    max-width: none;
    width: 100%;
}
.shops-hero {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem 2rem;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 1.35rem 1.5rem;
    border-radius: 16px;
    background:
        linear-gradient(135deg, rgb(240 253 244 / 0.95), rgb(255 255 255 / 0.9)),
        radial-gradient(ellipse at 0% 0%, rgb(34 197 94 / 0.12), transparent 55%);
    border: 1px solid var(--shops-line);
}
.shops-hero__eyebrow {
    margin: 0 0 0.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #15803d;
}
.shops-hero__title {
    margin: 0;
    font-size: clamp(1.45rem, 2.5vw, 1.85rem);
    font-weight: 800;
    color: var(--shops-ink);
    letter-spacing: -0.02em;
}
.shops-hero__lead {
    margin: 0.4rem 0 0;
    max-width: 48rem;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--shops-muted);
}
.shops-hero__filter {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 14rem;
}
.shops-hero__filter label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--shops-muted);
}
.shops-hero__filter select {
    border-radius: 10px;
    border: 1px solid var(--shops-line);
    padding: 0.55rem 0.75rem;
    background: #fff;
    font-size: 0.95rem;
}

.shops-metrics {
    margin-bottom: 1.75rem;
}
.shops-metrics__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}
@media (max-width: 900px) {
    .shops-metrics__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
    .shops-metrics__grid { grid-template-columns: 1fr; }
}
.shops-metric {
    position: relative;
    padding: 1rem 1.1rem;
    border-radius: 14px;
    background: var(--shops-card);
    border: 1px solid var(--shops-line);
    overflow: hidden;
}
.shops-metric--free { border-color: rgb(34 197 94 / 0.28); background: linear-gradient(180deg, #f0fdf4, #fff); }
.shops-metric--sold { border-color: rgb(239 68 68 / 0.22); background: linear-gradient(180deg, #fef2f2, #fff); }
.shops-metric--reserved { border-color: rgb(234 179 8 / 0.3); background: linear-gradient(180deg, #fefce8, #fff); }
.shops-metric--pool { border-color: rgb(20 83 45 / 0.18); background: linear-gradient(180deg, #ecfdf5, #fff); }
.shops-metric__label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--shops-muted);
    margin-bottom: 0.35rem;
}
.shops-metric__value {
    display: block;
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--shops-ink);
    letter-spacing: -0.02em;
    line-height: 1.15;
}
.shops-metric__value small {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--shops-muted);
}
.shops-metric__hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: var(--shops-muted);
}
.shops-metrics__progress {
    margin-top: 1rem;
}
.shops-metrics__progress-track {
    height: 8px;
    border-radius: 999px;
    background: rgb(20 83 45 / 0.08);
    overflow: hidden;
}
.shops-metrics__progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #16a34a, #15803d);
}
.shops-metrics__progress-label {
    margin: 0.4rem 0 0;
    font-size: 0.78rem;
    color: var(--shops-muted);
}
.shops-metrics__counts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1.25rem;
    margin-top: 0.85rem;
    font-size: 0.88rem;
    color: var(--shops-muted);
}
.shops-metrics__counts strong {
    color: var(--shops-ink);
    font-weight: 700;
}

.shops-empty {
    padding: 2rem 1.5rem;
    text-align: center;
    border-radius: 16px;
    border: 1px dashed var(--shops-line);
    background: #fafafa;
}
.shops-empty__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--shops-ink);
}
.shops-empty__text {
    margin: 0.5rem 0 1rem;
    color: var(--shops-muted);
}

.shops-zones {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}
.shops-zone {
    border-radius: 16px;
    border: 1px solid var(--shops-line);
    background: #fff;
    padding: 1.1rem 1.2rem 1.2rem;
}
.shops-zone__head {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}
.shops-zone__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 750;
    color: var(--shops-ink);
}
.shops-zone__meta {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
    color: var(--shops-muted);
}
.shops-zone__pool {
    margin-bottom: 0.9rem;
}
.shops-zone__pool-nums {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.82rem;
    color: var(--shops-muted);
    margin-bottom: 0.4rem;
}
.shops-zone__pool-nums strong { color: var(--shops-ink); }
.shops-zone__bar {
    height: 6px;
    border-radius: 999px;
    background: rgb(20 83 45 / 0.08);
    overflow: hidden;
}
.shops-zone__bar span {
    display: block;
    height: 100%;
    background: #16a34a;
    border-radius: inherit;
}
.shops-zone__empty {
    margin: 0;
    font-size: 0.9rem;
    color: var(--shops-muted);
}

@keyframes shops-lot-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.shops-lot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
    gap: 0.85rem;
}
.shops-lot-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1rem 1.05rem 1.05rem;
    border-radius: 16px;
    background:
        linear-gradient(165deg, #fff 0%, #fbfefc 100%);
    border: 1px solid var(--shops-line);
    box-shadow: 0 6px 18px rgb(15 40 25 / 0.04);
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    animation: shops-lot-in 0.4s ease both;
}
.shops-lot-card:nth-child(2) { animation-delay: 0.04s; }
.shops-lot-card:nth-child(3) { animation-delay: 0.08s; }
.shops-lot-card:nth-child(4) { animation-delay: 0.12s; }
.shops-lot-card:nth-child(5) { animation-delay: 0.16s; }
.shops-lot-card:nth-child(6) { animation-delay: 0.2s; }
.shops-lot-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgb(15 40 25 / 0.08);
    border-color: rgb(22 163 74 / 0.28);
}
.shops-lot-card__accent {
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: #94a3b8;
}
.shops-lot-card--available .shops-lot-card__accent { background: linear-gradient(180deg, #22c55e, #15803d); }
.shops-lot-card--sold .shops-lot-card__accent,
.shops-lot-card--installment .shops-lot-card__accent,
.shops-lot-card--reassignment .shops-lot-card__accent { background: linear-gradient(180deg, #f87171, #dc2626); }
.shops-lot-card--reserved .shops-lot-card__accent { background: linear-gradient(180deg, #facc15, #ca8a04); }
.shops-lot-card--occupied .shops-lot-card__accent { background: linear-gradient(180deg, #60a5fa, #2563eb); }
.shops-lot-card--available {
    background: linear-gradient(165deg, #f0fdf4 0%, #fff 55%);
    border-color: rgb(34 197 94 / 0.22);
}
.shops-lot-card--sold,
.shops-lot-card--installment,
.shops-lot-card--reassignment {
    background: linear-gradient(165deg, #fef2f2 0%, #fff 55%);
    border-color: rgb(239 68 68 / 0.16);
}
.shops-lot-card--reserved {
    background: linear-gradient(165deg, #fefce8 0%, #fff 55%);
    border-color: rgb(234 179 8 / 0.28);
}
.shops-lot-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
    padding-left: 0.35rem;
}
.shops-lot-card__eyebrow {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #15803d;
}
.shops-lot-card__num {
    margin: 0.15rem 0 0;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--shops-ink);
    line-height: 1.1;
}
.shops-lot-card__stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
    padding-left: 0.35rem;
}
.shops-lot-card__stat {
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
    background: rgb(255 255 255 / 0.85);
    border: 1px solid rgb(20 83 45 / 0.08);
}
.shops-lot-card__stat--total {
    grid-column: 1 / -1;
    background: rgb(240 253 244 / 0.7);
}
.shops-lot-card__stat-val {
    display: block;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--shops-ink);
    line-height: 1.15;
}
.shops-lot-card__stat-lab {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--shops-muted);
}
.shops-lot-card__meta {
    list-style: none;
    margin: 0;
    padding: 0 0 0 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.shops-lot-card__meta li {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--shops-muted);
}
.shops-lot-card__meta strong {
    color: var(--shops-ink);
    font-weight: 650;
}
.shops-lot-card__meta--plan strong { color: #15803d; }
.shops-lot-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: auto;
    padding: 0.75rem 0 0 0.35rem;
    border-top: 1px solid rgb(20 83 45 / 0.08);
}
.shops-lot-card__actions .btn { flex: 1 1 auto; text-align: center; }

.shops-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
.shops-table th, .shops-table td { padding: 0.7rem 0.85rem; border-bottom: 1px solid #e8eee9; text-align: left; font-size: 0.92rem; }
.shops-table th { background: #f4faf6; font-size: 0.8rem; color: var(--gray-600); }
.shops-table-wrap { overflow-x: auto; }
.shops-table__num { font-weight: 700; color: var(--shops-ink); }
.shops-table__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-end;
}

/* Shops page — responsive */
@media (max-width: 720px) {
    .shops-page { max-width: 100%; }
    .shops-hero {
        padding: 1rem 1.05rem;
        border-radius: 12px;
        align-items: stretch;
    }
    .shops-hero__filter {
        width: 100%;
        min-width: 0;
    }
    .shops-hero__filter select { width: 100%; }
    .shops-hero__lead { font-size: 0.88rem; }
    .shops-metric { padding: 0.85rem 0.9rem; }
    .shops-metric__value { font-size: 1.25rem; }
    .shops-metrics__counts {
        gap: 0.45rem 0.85rem;
        font-size: 0.82rem;
    }
    .shops-zone {
        padding: 0.9rem 0.95rem 1rem;
        border-radius: 12px;
    }
    .shops-zone__head {
        flex-direction: column;
        align-items: stretch;
    }
    .shops-zone__head .btn { align-self: flex-start; }
    .shops-zone__pool-nums {
        flex-direction: column;
        gap: 0.25rem;
    }
    .shops-lot-grid {
        grid-template-columns: 1fr;
        gap: 0.7rem;
    }
    .shops-lot-card { padding: 0.9rem 0.95rem 1rem; }
    .shops-lot-card__num { font-size: 1.2rem; }
}
@media (max-width: 380px) {
    .shops-metrics__grid { grid-template-columns: 1fr; }
}

/* Вход под пользователем: тихая кнопка «вернуться в админку» рядом с «Выйти» */
.sidebar__back:hover {
    background: var(--sb-bg);
    color: var(--sb-accent);
}

/* ═══════════════════════════════════════════════════════════
   АДМИНКА ПЛАТФОРМЫ (/platform)
   Тёмное меню отличает админку от CRM, всё остальное — таблицы
   и модалки в стиле системы.
   ═══════════════════════════════════════════════════════════ */
.pa-body {
    margin: 0;
    background: var(--cb-mist);
    font-family: var(--cb-font);
    color: var(--cb-ink);
}

.pa-shell {
    min-height: 100vh;
}

/* Меню */
.pa-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    width: 15rem;
    padding: 1rem 0.75rem 0.75rem;
    background: #1f2433;
    color: #fff;
}

.pa-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.25rem 0.5rem 1.25rem;
    color: inherit;
    text-decoration: none;
}

.pa-sidebar__brand img {
    border-radius: 10px;
    background: #fff;
}

.pa-sidebar__brand span {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.pa-sidebar__brand b {
    font-size: 1rem;
    font-weight: 650;
}

.pa-sidebar__brand small {
    font-size: 0.75rem;
    color: rgb(255 255 255 / 0.5);
}

.pa-sidebar__nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pa-sidebar__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: 2.6rem;
    padding: 0 0.75rem;
    border-radius: 12px;
    font-size: 0.925rem;
    font-weight: 500;
    color: rgb(255 255 255 / 0.65);
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.pa-sidebar__link:hover {
    background: rgb(255 255 255 / 0.06);
    color: #fff;
}

.pa-sidebar__link.is-active {
    background: rgb(255 255 255 / 0.1);
    color: #fff;
    font-weight: 600;
}

.pa-sidebar__link.is-active .pa-sidebar__icon {
    color: #5fd3a5;
}

.pa-sidebar__icon {
    display: flex;
    width: 1.2rem;
    height: 1.2rem;
}

.pa-sidebar__icon .sidebar__icon-svg {
    width: 1.2rem;
    height: 1.2rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pa-sidebar__footer {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.5rem 0.6rem 0.6rem;
    border-radius: 16px;
    background: rgb(255 255 255 / 0.06);
}

.pa-sidebar__avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    background: #5fd3a5;
    font-size: 0.85rem;
    font-weight: 650;
    color: #0c3d2d;
}

.pa-sidebar__who {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.pa-sidebar__who b {
    font-size: 0.875rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pa-sidebar__who small {
    font-size: 0.75rem;
    color: rgb(255 255 255 / 0.5);
}

.pa-sidebar__footer form {
    margin: 0;
}

.pa-sidebar__logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: rgb(255 255 255 / 0.6);
    cursor: pointer;
}

.pa-sidebar__logout:hover {
    background: rgb(239 91 115 / 0.18);
    color: #ffb3c0;
}

.pa-topbar,
.pa-backdrop {
    display: none;
}

/* Основная часть */
.pa-main {
    margin-left: 15rem;
    min-width: 0;
}

.pa-shell--guest .pa-main {
    margin-left: 0;
}

.pa-content {
    max-width: 90rem;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
}

.pa-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 2rem;
    margin-bottom: 1.5rem;
}

.pa-head__title {
    margin: 0;
    font-size: 1.9rem;
    font-weight: 650;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.pa-head__sub {
    margin: 0.35rem 0 0;
    max-width: 44rem;
    font-size: 0.925rem;
    color: var(--cb-muted);
}

.pa-head__badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.pa-head__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.pa-back {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin: -0.5rem 0 0.75rem -0.5rem;
    padding: 0.35rem 0.7rem 0.35rem 0.5rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--cb-muted);
    text-decoration: none;
}

.pa-back:hover {
    background: rgb(31 36 51 / 0.05);
    color: var(--cb-ink);
}

/* Кнопки */
.pa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    height: 2.5rem;
    min-height: 0;
    padding: 0 1.1rem;
    border: 0;
    border-radius: 999px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.pa-btn--sm {
    height: 2rem;
    padding: 0 0.8rem;
    font-size: 0.825rem;
}

.pa-btn--block {
    width: 100%;
    height: 3rem;
}

.pa-btn--primary {
    background: var(--cb-ink);
    color: #fff;
}

.pa-btn--primary:hover {
    background: #343a4d;
}

.pa-btn--soft {
    background: var(--cb-accent-soft);
    color: var(--cb-accent-ink);
}

.pa-btn--soft:hover {
    background: #c9eadd;
}

.pa-btn--ghost {
    background: var(--cb-surface);
    box-shadow: inset 0 0 0 1px var(--cb-line);
    color: var(--cb-ink);
}

.pa-btn--ghost:hover {
    background: var(--cb-mist);
}

.pa-btn--danger {
    background: #ffe2e6;
    color: #a11d35;
}

.pa-btn--danger:hover {
    background: #ffd2d9;
}

.pa-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--cb-muted);
    cursor: pointer;
}

.pa-icon-btn:hover {
    background: var(--cb-mist);
    color: var(--cb-ink);
}

.pa-icon-btn--danger:hover {
    background: #ffe2e6;
    color: #a11d35;
}

.pa-btn:focus-visible,
.pa-icon-btn:focus-visible,
.pa-link:focus-visible,
.pa-chip:focus-visible,
.pa-tabs__tab:focus-visible,
.pa-sidebar__link:focus-visible,
.pa-back:focus-visible,
.pa-switch:focus-visible,
.pa-modal__close:focus-visible {
    outline: 2px solid var(--cb-accent);
    outline-offset: 2px;
}

.pa-link {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--cb-accent);
    text-decoration: none;
    cursor: pointer;
}

.pa-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.pa-link-quiet {
    color: inherit;
    text-decoration: none;
}

.pa-link-quiet:hover {
    color: var(--cb-accent);
}

.pa-inline-form {
    display: inline-flex;
    margin: 0;
}

.pa-row-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
}

/* Цифры */
.pa-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.pa-kpis--stack {
    grid-template-columns: minmax(0, 1fr);
    margin-bottom: 0;
}

.pa-kpi {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
    padding: 1.15rem 1.25rem;
    border-radius: 20px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
}

.pa-kpi--lead {
    background: var(--cb-ink);
    color: #fff;
}

.pa-kpi__label {
    font-size: 0.85rem;
    color: var(--cb-muted);
}

.pa-kpi--lead .pa-kpi__label,
.pa-kpi--lead .pa-kpi__note {
    color: rgb(255 255 255 / 0.65);
}

.pa-kpi__value {
    font-size: 1.65rem;
    font-weight: 650;
    line-height: 1.15;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pa-kpi__value small {
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--cb-faint);
}

.pa-kpi--lead .pa-kpi__value small {
    color: rgb(255 255 255 / 0.55);
}

.pa-kpi__value.is-bad {
    color: #a11d35;
}

.pa-kpi__note {
    font-size: 0.8rem;
    color: var(--cb-muted);
}

.pa-kpi .pa-ribbon {
    margin-top: 0.35rem;
}

.pa-delta {
    display: inline-flex;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    font-weight: 600;
}

.pa-delta.is-up { background: rgb(95 211 165 / 0.2); color: #5fd3a5; }
.pa-delta.is-down { background: rgb(239 91 115 / 0.2); color: #ff9fb0; }

.pa-meter {
    height: 0.4rem;
    margin-top: 0.35rem;
    border-radius: 999px;
    background: var(--cb-mist);
    overflow: hidden;
}

.pa-meter i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #2bb07f;
}

.pa-in { color: #0e6546; }
.pa-out { color: #a11d35; }
.pa-kpi__value.pa-in { color: #0e6546; }
.pa-kpi__value.pa-out { color: #a11d35; }

/* Раскладка */
.pa-cols {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    align-items: start;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

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

.pa-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.pa-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Карточки */
.pa-card {
    min-width: 0;
    padding: 1.35rem 1.5rem;
    border-radius: 22px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
}

.pa-card + .pa-card,
.pa-cols + .pa-card,
.pa-card + .pa-cols {
    margin-top: 1.25rem;
}

.pa-card--flush {
    padding: 0;
    overflow: hidden;
}

.pa-cols > .pa-card,
.pa-cols > .pa-kpis {
    margin-top: 0;
}

.pa-nowrap {
    white-space: nowrap;
}

.pa-table td:first-child {
    min-width: 11rem;
}

.pa-card--narrow {
    max-width: 30rem;
}

.pa-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.pa-card--flush .pa-card__head {
    margin: 0;
    padding: 1.1rem 1.5rem 0.9rem;
}

.pa-card__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.pa-card__meta {
    margin-left: 0.35rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--cb-faint);
}

.pa-card__foot {
    margin-top: 1.1rem;
}

.pa-card__note {
    margin: 0;
    padding: 0.85rem 1.5rem 1rem;
    border-top: 1px solid var(--cb-line);
    font-size: 0.825rem;
    color: var(--cb-muted);
}

.pa-empty {
    margin: 0;
    padding: 2rem 1.5rem;
    font-size: 0.9rem;
    text-align: center;
    color: var(--cb-muted);
}

td.pa-empty {
    padding: 2.25rem 1.5rem;
}

/* Таблицы */
.pa-table-wrap {
    overflow-x: auto;
}

.pa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.pa-table th {
    padding: 0.65rem 0.85rem;
    background: #f7f8fb;
    border-top: 1px solid var(--cb-line);
    border-bottom: 1px solid var(--cb-line);
    font-size: 0.8rem;
    font-weight: 500;
    text-align: left;
    color: var(--cb-muted);
    white-space: nowrap;
}

.pa-table th:first-child,
.pa-table td:first-child {
    padding-left: 1.5rem;
}

.pa-table th:last-child,
.pa-table td:last-child {
    padding-right: 1.25rem;
}

.pa-table td {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--cb-line);
    vertical-align: middle;
}

.pa-table tbody tr:last-child td {
    border-bottom: 0;
}

.pa-table tbody tr[data-href] {
    cursor: pointer;
}

.pa-table tbody tr:hover td {
    background: #fafbfd;
}

.pa-table tr.is-dim td {
    color: var(--cb-muted);
}

.pa-table .is-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pa-table .is-actions {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

.pa-strong {
    font-weight: 600;
    color: var(--cb-ink);
    text-decoration: none;
}

a.pa-strong:hover {
    color: var(--cb-accent);
}

.pa-sub {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--cb-muted);
}

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

.pa-cell-note {
    max-width: 18rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pa-cell-units {
    min-width: 9rem;
}

.pa-cell-units__nums {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.825rem;
    color: var(--cb-muted);
    white-space: nowrap;
}

.pa-cell-units__nums b {
    font-weight: 600;
    color: var(--cb-ink);
}

.pa-person {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
}

.pa-person b {
    font-weight: 600;
}

.pa-avatar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--cb-mist);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--cb-muted);
}

.pa-pre {
    white-space: pre-wrap;
}

/* Полоска статусов квартир */
.pa-ribbon {
    display: flex;
    gap: 2px;
    height: 0.375rem;
    min-width: 6rem;
    border-radius: 999px;
    overflow: hidden;
    background: var(--cb-mist);
}

.pa-ribbon__seg { min-width: 2px; background: #c2c7d1; }
.pa-ribbon__seg--available { background: #2bb07f; }
.pa-ribbon__seg--reserved { background: #f2a33a; }
.pa-ribbon__seg--sold { background: #6b74e8; }
.pa-ribbon__seg--installment { background: #a769e6; }
.pa-ribbon__seg--overdue { background: #ef5b73; }
.pa-ribbon__seg--reassignment { background: #2aa6d9; }
.pa-ribbon__seg--occupied { background: #8d95a8; }

.pa-status-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.pa-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: #eceef3;
    font-size: 0.775rem;
    color: #3f4658;
    white-space: nowrap;
}

.pa-status b { font-weight: 600; }
.pa-status--available { background: #dcf5e9; color: #0e6546; }
.pa-status--reserved { background: #ffecd2; color: #8a4a06; }
.pa-status--sold { background: #e4e6fd; color: #353c9e; }
.pa-status--installment { background: #f1e5fd; color: #6a2fae; }
.pa-status--overdue { background: #ffe2e6; color: #a11d35; }
.pa-status--reassignment { background: #dcf1fb; color: #0c5a80; }

/* Бейджи */
.pa-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.65rem 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.pa-badge::before {
    content: "";
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.8;
}

.pa-badge--inline {
    margin-top: 0.35rem;
}

.pa-badge--ok { background: #dcf5e9; color: #0e6546; }
.pa-badge--warn { background: #ffecd2; color: #8a4a06; }
.pa-badge--bad { background: #ffe2e6; color: #a11d35; }
.pa-badge--info { background: #e4e6fd; color: #353c9e; }
.pa-badge--muted { background: #eceef3; color: #5b6275; }

/* Описания */
.pa-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin: 0;
}

.pa-facts div {
    padding: 0.8rem 0.95rem;
    border-radius: 16px;
    background: var(--cb-mist);
}

.pa-facts dt {
    font-size: 0.8rem;
    color: var(--cb-muted);
}

.pa-facts dd {
    margin: 0.15rem 0 0;
    font-size: 1.25rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.pa-facts dd small {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--cb-muted);
}

.pa-dl {
    display: flex;
    flex-direction: column;
    margin: 0;
}

.pa-dl > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 0;
    border-top: 1px solid var(--cb-line);
}

.pa-dl > div:first-child {
    border-top: 0;
    padding-top: 0;
}

.pa-dl dt {
    flex-shrink: 0;
    font-size: 0.875rem;
    color: var(--cb-muted);
}

.pa-dl dd {
    margin: 0;
    font-weight: 500;
    text-align: right;
}

.pa-dl dd small {
    margin-left: 0.25rem;
    color: var(--cb-muted);
}

/* Переключатели функций */
.pa-switches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.pa-switches form {
    margin: 0;
}

.pa-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    height: 2.4rem;
    min-height: 0;
    padding: 0 0.95rem 0 0.55rem;
    border: 0;
    border-radius: 999px;
    background: var(--cb-mist);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--cb-ink);
    cursor: pointer;
}

.pa-switch__track {
    position: relative;
    width: 2.1rem;
    height: 1.25rem;
    border-radius: 999px;
    background: #c9ced8;
    transition: background-color 0.15s ease;
}

.pa-switch__track i {
    position: absolute;
    top: 0.15rem;
    left: 0.15rem;
    width: 0.95rem;
    height: 0.95rem;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.15s ease;
}

.pa-switch.is-on .pa-switch__track {
    background: #2bb07f;
}

.pa-switch.is-on .pa-switch__track i {
    transform: translateX(0.85rem);
}

/* Фильтры */
.pa-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.pa-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 1 20rem;
}

.pa-search svg {
    position: absolute;
    left: 0.9rem;
    color: var(--cb-faint);
    pointer-events: none;
}

.pa-search input {
    width: 100%;
    height: 2.5rem;
    min-height: 0;
    padding: 0 1rem 0 2.5rem;
    border: 0;
    border-radius: 999px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
    font: inherit;
    font-size: 0.9rem;
    color: var(--cb-ink);
}

.pa-search input:focus {
    outline: none;
    box-shadow: var(--cb-lift), 0 0 0 2px var(--cb-accent);
}

.pa-select {
    height: 2.5rem;
    min-height: 0;
    padding: 0 2.2rem 0 1rem;
    border: 0;
    border-radius: 999px;
    background: var(--cb-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a3a9b8' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 0.85rem center;
    box-shadow: var(--cb-lift);
    font: inherit;
    font-size: 0.9rem;
    color: var(--cb-ink);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.pa-select:focus-visible {
    outline: 2px solid var(--cb-accent);
    outline-offset: 2px;
}

.pa-date {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 2.5rem;
    padding: 0 0.35rem 0 0.9rem;
    border-radius: 999px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
    font-size: 0.85rem;
    color: var(--cb-muted);
}

.pa-date input {
    height: 2rem;
    min-height: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 0.875rem;
    color: var(--cb-ink);
}

.pa-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.9rem;
}

.pa-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 2.1rem;
    padding: 0 0.9rem;
    border-radius: 999px;
    background: rgb(255 255 255 / 0.6);
    box-shadow: inset 0 0 0 1px var(--cb-line);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--cb-muted);
    text-decoration: none;
}

.pa-chip b {
    font-weight: 600;
    color: var(--cb-faint);
}

.pa-chip.is-active {
    background: var(--cb-ink);
    box-shadow: none;
    color: #fff;
}

.pa-chip.is-active b {
    color: rgb(255 255 255 / 0.6);
}

.pa-tabs {
    display: inline-flex;
    gap: 2px;
    margin-bottom: 1.25rem;
    padding: 4px;
    border-radius: 999px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
}

.pa-tabs__tab {
    display: inline-flex;
    align-items: center;
    height: 2.25rem;
    padding: 0 1.1rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--cb-muted);
    text-decoration: none;
}

.pa-tabs__tab.is-active {
    background: var(--cb-ink);
    color: #fff;
}

/* График дохода */
.pa-bars {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    height: 14rem;
}

.pa-bars--short {
    height: 11rem;
}

.pa-bars__col {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.pa-bars__value {
    min-height: 1rem;
    font-size: 0.7rem;
    color: var(--cb-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pa-bars__bar {
    width: 100%;
    max-width: 2.5rem;
    border-radius: 8px 8px 3px 3px;
    background: #bfe9d6;
}

.pa-bars__bar.is-current {
    background: #2bb07f;
}

.pa-bars__label {
    font-size: 0.75rem;
    color: var(--cb-muted);
}

/* Модалки */
.pa-modal {
    width: min(34rem, calc(100vw - 2rem));
    max-height: calc(100dvh - 2rem);
    padding: 0;
    border: 0;
    border-radius: 26px;
    background: var(--cb-surface);
    box-shadow: 0 30px 80px rgb(31 36 51 / 0.25);
    font-family: var(--cb-font);
    color: var(--cb-ink);
}

.pa-modal--sm {
    width: min(26rem, calc(100vw - 2rem));
}

.pa-modal::backdrop {
    background: rgb(31 36 51 / 0.32);
}

.pa-modal[open] {
    animation: pa-modal-in 0.2s cubic-bezier(0.2, 0.9, 0.2, 1);
}

@keyframes pa-modal-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
}

.pa-modal__form {
    display: flex;
    flex-direction: column;
    margin: 0;
}

.pa-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.35rem 1.5rem 0.5rem;
}

.pa-modal__title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.pa-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--cb-mist);
    color: var(--cb-ink);
    cursor: pointer;
}

.pa-modal__body {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: 0.75rem 1.5rem 1.25rem;
}

.pa-modal__lead {
    margin: 0;
    font-size: 0.9rem;
    color: var(--cb-muted);
}

.pa-modal__lead b {
    color: var(--cb-ink);
    font-weight: 600;
}

.pa-modal__foot {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.5rem 1.35rem;
    border-top: 1px solid var(--cb-line);
}

/* Поля */
.pa-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.pa-field > span {
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--cb-muted);
}

.pa-field input,
.pa-field select,
.pa-field textarea {
    width: 100%;
    min-height: 2.85rem;
    padding: 0.6rem 0.9rem;
    border: 0;
    border-radius: 14px;
    background: var(--cb-mist);
    font: inherit;
    font-size: 0.95rem;
    color: var(--cb-ink);
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.pa-field select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.2rem;
    background: var(--cb-mist) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a3a9b8' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 0.85rem center;
}

.pa-field textarea {
    resize: vertical;
}

.pa-field input:focus,
.pa-field select:focus,
.pa-field textarea:focus {
    outline: none;
    background-color: var(--cb-surface);
    box-shadow: 0 0 0 2px var(--cb-accent);
}

.pa-field__error {
    font-size: 0.825rem;
    font-style: normal;
    color: #a11d35;
}

.pa-seg {
    display: flex;
    gap: 2px;
    padding: 4px;
    border-radius: 999px;
    background: var(--cb-mist);
}

.pa-seg__opt {
    flex: 1;
    position: relative;
}

.pa-seg__opt input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.pa-seg__opt span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 2.1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--cb-muted);
    cursor: pointer;
}

.pa-seg__opt input:checked + span {
    background: var(--cb-surface);
    box-shadow: 0 1px 3px rgb(31 36 51 / 0.1);
    color: var(--cb-ink);
}

.pa-seg__opt input:focus-visible + span {
    outline: 2px solid var(--cb-accent);
}

.pa-check {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.pa-check input[type="checkbox"] {
    width: 1.05rem;
    height: 1.05rem;
    margin: 0;
    accent-color: var(--cb-ink);
}

/* Сообщение */
.pa-toast {
    position: fixed;
    top: 1rem;
    left: 50%;
    z-index: 300;
    max-width: min(32rem, calc(100vw - 2rem));
    padding: 0.75rem 1.15rem;
    border-radius: 16px;
    background: var(--cb-ink);
    box-shadow: 0 18px 40px rgb(31 36 51 / 0.25);
    font-size: 0.9rem;
    color: #fff;
    transform: translateX(-50%);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.pa-toast.is-hidden {
    opacity: 0;
    transform: translate(-50%, -0.5rem);
    pointer-events: none;
}

.pa-pages {
    display: flex;
    justify-content: center;
    margin-top: 1.25rem;
}

/* Вход в админку */
.pa-login {
    width: min(24rem, 100%);
    margin: 12vh auto 0;
    padding: 2rem;
    border-radius: 26px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
}

.pa-login__logo {
    display: block;
    border-radius: 14px;
}

.pa-login__title {
    margin: 1.1rem 0 0.3rem;
    font-size: 1.6rem;
    font-weight: 650;
    letter-spacing: -0.03em;
}

.pa-login__lead {
    margin: 0 0 1.5rem;
    font-size: 0.925rem;
    color: var(--cb-muted);
}

.pa-login__form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Адаптив */
@media (max-width: 1200px) {
    .pa-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pa-kpis--stack {
        grid-template-columns: minmax(0, 1fr);
    }

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

@media (max-width: 900px) {
    .pa-topbar {
        position: sticky;
        top: 0;
        z-index: 150;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 0.75rem;
        padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
        background: #1f2433;
        color: #fff;
    }

    .pa-topbar__burger {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2.5rem;
        height: 2.5rem;
        min-height: 0;
        border: 0;
        border-radius: 12px;
        background: transparent;
        color: #fff;
        cursor: pointer;
    }

    .pa-topbar__title {
        font-weight: 600;
    }

    .pa-sidebar {
        width: 16rem;
        transform: translateX(-105%);
        transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
    }

    .pa-shell.is-nav-open .pa-sidebar {
        transform: none;
    }

    .pa-backdrop {
        position: fixed;
        inset: 0;
        z-index: 190;
        background: rgb(31 36 51 / 0.35);
    }

    .pa-shell.is-nav-open .pa-backdrop {
        display: block;
    }

    .pa-main {
        margin-left: 0;
    }

    .pa-content {
        padding: 1.25rem 1rem 3rem;
    }

    .pa-head__title {
        font-size: 1.5rem;
    }

    .pa-card--flush .pa-card__head {
        padding: 1rem 1.1rem 0.8rem;
    }

    .pa-table th:first-child,
    .pa-table td:first-child {
        padding-left: 1.1rem;
    }
}

@media (max-width: 560px) {
    .pa-kpis {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.6rem;
    }

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

    .pa-search {
        flex: 1 1 100%;
    }

    .pa-select {
        flex: 1 1 auto;
    }

    .pa-head__actions {
        width: 100%;
    }

    .pa-head__actions > * {
        flex: 1 1 auto;
    }

    .pa-head__actions .pa-btn {
        width: 100%;
    }

    .pa-modal {
        width: 100%;
        max-width: none;
        margin: auto 0 0;
        border-radius: 24px 24px 0 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pa-modal[open] {
        animation: none;
    }
}

/* Админка: страница обновления базы */
.pa-setup-error {
    margin-bottom: 1.25rem;
    background: #ffe2e6;
    color: #a11d35;
}

.pa-setup-error p {
    margin: 0.35rem 0 0;
}

.pa-setup-sql {
    width: 100%;
    margin-top: 0.75rem;
    padding: 1rem;
    border: 0;
    border-radius: 14px;
    background: var(--cb-mist);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--cb-ink);
    resize: vertical;
}

/* ============================================================ */
/* Продажи: рабочая область v2 — панель в стиле шахматки,       */
/* фильтры блок / этаж / доступные, нижние шторки на телефоне.  */
/* ============================================================ */
.sw-head {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex-shrink: 0;
    padding: 0.75rem 1rem 0.65rem;
    background: var(--cb-surface);
    border: 1px solid var(--cb-line);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    font-family: var(--cb-font);
}

.sw-head__row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.sw-head__back {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    color: var(--cb-ink);
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.sw-head__back:hover {
    background: var(--cb-mist);
}

.sw-head__title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
    flex: 1 1 auto;
    min-width: 0;
}

.sw-head__property {
    margin-left: 0;
    min-width: 0;
}

.sw-head__property .chessboard-select-label {
    font-size: 1.35rem;
}

.sw-head__meta {
    margin: 0;
    font-size: 0.85rem;
    color: var(--cb-muted);
    white-space: nowrap;
}

.sw-head__tools {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.sw-filters-btn {
    display: none;
    align-items: center;
    gap: 0.4rem;
    height: 2.5rem;
    padding: 0 0.9rem;
    border: 0;
    border-radius: 999px;
    background: var(--cb-mist);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--cb-ink);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.sw-filters-btn__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--cb-accent);
    font-size: 0.75rem;
    color: #fff;
}

.sw-filters-btn__count[hidden] {
    display: none;
}

.sw-filters {
    gap: 0.45rem;
    margin-bottom: 0;
}

.sw-filters__sheet-head,
.sw-filters__sheet-foot,
.sw-filters-backdrop {
    display: none;
}

.sw-filters__avail-row {
    gap: 1rem;
}

#sw-floor-chips {
    flex-wrap: nowrap;
}

.sw-floor-chip {
    justify-content: center;
    min-width: 2.25rem;
    padding: 0 0.7rem;
    font-variant-numeric: tabular-nums;
}

.sw-floor-chip.is-active::before {
    display: none;
}

.sw-filters__count {
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    color: var(--cb-muted);
}

.sw-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 2.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--cb-ink);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.sw-switch__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.sw-switch__track {
    position: relative;
    flex-shrink: 0;
    width: 2.5rem;
    height: 1.5rem;
    border-radius: 999px;
    background: var(--cb-line);
    transition: background-color 0.18s ease;
}

.sw-switch__thumb {
    position: absolute;
    top: 0.1875rem;
    left: 0.1875rem;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgb(31 36 51 / 0.2);
    transition: transform 0.18s ease;
}

.sw-switch__input:checked + .sw-switch__track {
    background: var(--cb-accent);
}

.sw-switch__input:checked + .sw-switch__track .sw-switch__thumb {
    transform: translateX(1rem);
}

.sw-switch__input:focus-visible + .sw-switch__track {
    outline: 2px solid var(--cb-accent);
    outline-offset: 2px;
}

/* Скрытые фильтром квартиры держат своё место, чтобы колонки шахматки не съезжали. */
.sales-workspace .cb-unit.sw-unit-off {
    visibility: hidden;
    pointer-events: none;
}

.sales-workspace .sw-row-off {
    display: none !important;
}

.sw-filter-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin: 1.5rem auto;
    padding: 1.25rem;
    max-width: 22rem;
    border-radius: 20px;
    background: var(--cb-surface);
    box-shadow: var(--cb-lift);
    text-align: center;
}

.sw-filter-empty__text {
    margin: 0;
    color: var(--cb-muted);
}

.sw-list-floor + .sw-list-floor {
    margin-top: 0.25rem;
}

.sw-list-floor__title {
    margin: 0;
    padding: 0.75rem 0.75rem 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--cb-muted);
}

.cb-list__unit.is-disabled {
    opacity: 0.45;
}

.sw-list-unit__head {
    display: flex;
    flex-direction: column;
    min-width: 5.5rem;
    line-height: 1.25;
}

.sw-list-unit__place {
    font-size: 0.75rem;
    color: var(--cb-muted);
}

@media (max-width: 768px) {
    .sw-head {
        gap: 0;
        padding: 0.5rem 0.5rem 0.5rem 0.25rem;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .sw-head__row {
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .sw-head__title {
        flex: 1 1 0;
    }

    .sw-head__tools {
        flex: 1 1 100%;
        gap: 0.5rem;
        margin: 0.35rem 0 0 0.25rem;
    }

    .sw-filters-btn {
        flex: 1 1 auto;
        justify-content: center;
        height: 2.75rem;
    }

    .sw-head__title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.1rem;
    }

    .sw-head__property .chessboard-select-label {
        font-size: 1.1rem;
    }

    .sw-head__meta {
        font-size: 0.75rem;
    }

    .sw-filters-btn {
        display: inline-flex;
    }

    .sw-filters-backdrop:not([hidden]) {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 149;
        background: rgb(31 36 51 / 0.35);
    }

    .sw-filters {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 150;
        gap: 1rem;
        max-height: 82dvh;
        padding: 0 1rem calc(1rem + env(safe-area-inset-bottom));
        overflow-y: auto;
        overscroll-behavior: contain;
        background: var(--cb-surface);
        border-radius: 22px 22px 0 0;
        box-shadow: 0 -12px 40px rgb(31 36 51 / 0.18);
        transform: translateY(105%);
        visibility: hidden;
        transition: transform 0.28s var(--ease-out, ease), visibility 0s linear 0.28s;
    }

    .sales-workspace.is-filters-open .sw-filters {
        transform: none;
        visibility: visible;
        transition: transform 0.28s var(--ease-out, ease);
    }

    .sw-filters__sheet-head {
        position: sticky;
        top: 0;
        z-index: 1;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.9rem 0 0.4rem;
        background: var(--cb-surface);
    }

    .sw-filters__sheet-title {
        font-size: 1.1rem;
        font-weight: 650;
        color: var(--cb-ink);
    }

    .sw-filters__close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.75rem;
        height: 2.75rem;
        margin-right: -0.5rem;
        border: 0;
        border-radius: 50%;
        background: transparent;
        color: var(--cb-muted);
        cursor: pointer;
    }

    .sw-filters .cb-scope__row {
        flex-wrap: wrap;
    }

    .sw-filters .cb-scope__label {
        flex: 1 1 auto;
        font-weight: 600;
        color: var(--cb-ink);
    }

    .sw-filters .chessboard-chips-scroll {
        flex: 1 1 100%;
        order: 3;
        overflow: visible;
    }

    .sw-filters .chessboard-chips,
    .sw-filters #sw-floor-chips {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .sw-filters .chessboard-chip {
        height: 2.75rem;
        padding: 0 1.1rem;
        font-size: 0.95rem;
    }

    .sw-filters .cb-scope__link {
        min-height: 2.75rem;
    }

    .sw-filters__avail-row {
        justify-content: space-between;
    }

    .sw-switch {
        min-height: 2.75rem;
        font-size: 1rem;
    }

    .sw-filters__sheet-foot {
        position: sticky;
        bottom: 0;
        display: block;
        padding-top: 0.5rem;
        background: var(--cb-surface);
    }

    .sw-filters__apply {
        width: 100%;
        min-height: 3rem;
        font-size: 1rem;
    }

    /* Карточка брони/жителя/возврата — нижняя шторка поверх шахматки. */
    .sales-ws-layout {
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .sales-workspace.is-detail .sales-ws-map-pane {
        flex: 1 1 0%;
        max-width: none;
    }

    .sales-ws-detail-pane,
    .sales-workspace.is-detail .sales-ws-detail-pane {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 150;
        flex: none;
        width: auto;
        min-width: 0;
        height: 88dvh;
        border: 0;
        border-radius: 22px 22px 0 0;
        box-shadow: 0 -12px 40px rgb(31 36 51 / 0.2);
        opacity: 1;
        transform: translateY(105%);
        visibility: hidden;
        transition: transform 0.28s var(--ease-out, ease), visibility 0s linear 0.28s;
    }

    .sales-workspace.is-detail .sales-ws-detail-pane {
        transform: none;
        visibility: visible;
        transition: transform 0.28s var(--ease-out, ease);
    }

    .sales-ws-detail-pane__scroll {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }

    .sales-ws-detail-pane .sales-detail-facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sales-ws-toast {
        z-index: 160;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sw-filters,
    .sales-ws-detail-pane,
    .sw-switch__track,
    .sw-switch__thumb {
        transition: none !important;
    }
}

/* ============================================================ */
/* Продажи: мастер оформления v2 — единая форма клиента,        */
/* шаги «Шаг N из 5» и крупные кнопки на телефоне.              */
/* ============================================================ */
.sales-wizard__step-count {
    display: none;
}

.sw-client-picker__selected[hidden],
.sw-client-picker__search-wrap[hidden],
.sw-client-picker__new[hidden],
.sales-wizard__footer .btn[hidden] {
    display: none !important;
}

.sw-contact-fields {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 0.85rem 1rem;
}

@media (max-width: 767px) {
    .sales-wizard--v2 .sales-wizard__head {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .sales-wizard--v2 .sales-wizard__head > .btn {
        min-height: 2.5rem;
        margin-left: -0.5rem;
        padding: 0 0.5rem;
        white-space: nowrap;
    }

    .sales-wizard--v2 .sales-wizard__title {
        font-size: 1.3rem;
        line-height: 1.25;
    }

    .sales-wizard--v2 .sales-wizard__sub {
        font-size: 0.9rem;
    }

    .sales-wizard--v2 .sales-wizard__steps {
        font-size: 1rem;
    }

    .sales-wizard--v2 .sales-wizard__step:not(.is-active) {
        display: none;
    }

    .sales-wizard--v2 .sales-wizard__step-count {
        display: inline;
        font-weight: 500;
        color: var(--gray-500);
    }

    .sales-wizard--v2 .sales-wizard__panel-title {
        font-size: 1.15rem;
    }

    /* 16px — чтобы iPhone не увеличивал страницу при фокусе на поле. */
    .sales-wizard--v2 .sales-wizard-input {
        min-height: 2.875rem;
        font-size: 16px;
    }

    .sales-wizard--v2 .sales-wizard-label {
        font-size: 0.9rem;
    }

    .sales-wizard--v2 .sw-contact-fields {
        grid-template-columns: 1fr;
    }

    /* «Итого» на телефоне не закрепляем — иначе плашка закрывает поля под собой. */
    .sales-wizard.sales-wizard--v2 .sw-pricing-total {
        position: static;
    }

    /* Одинаковые боковые отступы во всех мастерах (раньше у рассрочки и переоформления они складывались). */
    .sales-wizard.sales-wizard--v2 .sales-wizard__shell {
        padding: 0;
    }

    .sales-wizard.sales-wizard--v2 .sales-wizard__head,
    .sales-wizard.sales-wizard--v2 .sales-wizard__progress,
    .sales-wizard.sales-wizard--v2 .sales-wizard__panel,
    .sales-wizard.sales-wizard--v2 .sales-wizard__footer {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    .sales-wizard.sales-wizard--v2 .sales-wizard__alert {
        margin-left: 0.85rem;
        margin-right: 0.85rem;
    }

    .sales-wizard--v2 .sales-wizard-unit-card__meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.6rem 1rem;
    }

    .sales-wizard--v2 .sw-client-picker__selected {
        flex-wrap: wrap;
    }

    .sales-wizard--v2 .sales-wizard__footer {
        gap: 0.75rem;
        padding-bottom: calc(0.85rem + env(safe-area-inset-bottom));
    }

    .sales-wizard--v2 .sales-wizard__footer .btn {
        min-height: 3rem;
        font-size: 1rem;
    }

    .sales-wizard--v2 #sw-btn-next {
        flex: 1 1 auto;
    }
}

/* ============================================================ */
/* Продажи: просмотр и правка договора перед оформлением        */
/* ============================================================ */
.sw-contract-view {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.9rem;
    margin: 0.25rem 0 1rem;
}

.sw-contract-view .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.75rem;
    padding: 0 1.1rem;
    border: 1px solid rgb(22 163 74 / 0.35);
    border-radius: 10px;
    background: #fff;
    font-weight: 600;
    color: var(--green-800);
}

.sw-contract-view .btn:hover {
    background: var(--green-50);
}

.sw-contract-view__item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
}

.sw-contract-view__state {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--green-700);
}

.sw-contract-view__state[hidden],
.sw-contract-view__note[hidden] {
    display: none;
}

.sw-contract-view__note {
    flex: 1 1 100%;
    margin: 0;
    font-size: 0.85rem;
    color: #b45309;
}

html.scp-open,
html.scp-open body {
    overflow: hidden;
}

.scp {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    flex-direction: column;
    background: #e9ecf1;
}

.scp[hidden] {
    display: none;
}

.scp__bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    padding: 0.65rem 1rem;
    background: #fff;
    border-bottom: 1px solid #dde2ea;
}

.scp__close {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #1f2433;
    cursor: pointer;
}

.scp__close:hover {
    background: #eef1f6;
}

.scp__titles {
    flex: 1 1 auto;
    min-width: 0;
}

.scp__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scp__hint {
    margin: 0.1rem 0 0;
    font-size: 0.8rem;
    color: #737a8c;
}

.scp__actions {
    display: flex;
    flex-shrink: 0;
    gap: 0.5rem;
}

.scp__actions .btn[hidden] {
    display: none;
}

.scp__desk {
    flex: 1 1 auto;
    overflow: auto;
    padding: 1.5rem 0.75rem 3rem;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.scp__status {
    max-width: 40rem;
    margin: 0 auto 1rem;
    text-align: center;
    color: #4b5563;
}

.scp__status[hidden] {
    display: none;
}

.scp__status.is-error {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: #fef2f2;
    color: #b91c1c;
}

.scp__page {
    box-sizing: border-box;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 1px 3px rgb(15 23 42 / 0.12), 0 12px 32px rgb(15 23 42 / 0.1);
    outline: none;
    overflow-wrap: break-word;
}

.scp__page:empty {
    display: none;
}

.scp__page:focus-visible {
    box-shadow: 0 0 0 2px #12806a, 0 12px 32px rgb(15 23 42 / 0.1);
}

@media (max-width: 767px) {
    .sw-contract-view__item {
        flex: 1 1 100%;
    }

    .sw-contract-view__item .btn {
        flex: 1 1 100%;
        justify-content: center;
    }

    .scp__bar {
        flex-wrap: wrap;
        padding: 0.5rem 0.5rem 0.65rem;
        gap: 0.35rem 0.5rem;
    }

    .scp__hint {
        display: none;
    }

    .scp__actions {
        flex: 1 1 100%;
    }

    .scp__actions .btn {
        flex: 1 1 0;
        min-height: 2.75rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .scp__desk {
        padding: 0.75rem 0.5rem 2rem;
    }
}

/* ============================================================ */
/* Продажи: главная страница — сетка операций и недавние сделки */
/* ============================================================ */
.sh-page {
    font-family: var(--cb-font);
}

.sh-head {
    margin-bottom: 1.25rem;
}

.sh-head__title {
    margin: 0;
    font-size: 2rem;
    font-weight: 650;
    letter-spacing: -0.03em;
    color: var(--cb-ink);
}

.sh-head__sub {
    margin: 0.35rem 0 0;
    font-size: 0.95rem;
    color: var(--cb-muted);
}

.sh-modes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.sh-mode {
    --sh-bg: #eef1f6;
    --sh-ink: #1f2433;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-height: 5.5rem;
    padding: 1rem 1rem 1rem 1.1rem;
    border-radius: 18px;
    background: var(--cb-surface);
    box-shadow: inset 0 0 0 1px var(--cb-line);
    color: var(--cb-ink);
    text-decoration: none;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.sh-mode:hover {
    box-shadow: inset 0 0 0 1px var(--sh-ink), var(--cb-lift);
}

.sh-mode:active {
    transform: scale(0.99);
}

.sh-mode:focus-visible {
    outline: 2px solid var(--cb-accent);
    outline-offset: 2px;
}

.sh-mode--sale { --sh-bg: #dcfce7; --sh-ink: #166534; }
.sh-mode--installment { --sh-bg: #dbeafe; --sh-ink: #1e40af; }
.sh-mode--reserve { --sh-bg: #fef9c3; --sh-ink: #854d0e; }
.sh-mode--reassignment { --sh-bg: #ede9fe; --sh-ink: #5b21b6; }
.sh-mode--resident { --sh-bg: #f3f4f6; --sh-ink: #374151; }
.sh-mode--return { --sh-bg: #fef3c7; --sh-ink: #92400e; }

.sh-mode__icon {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 14px;
    background: var(--sh-bg);
    color: var(--sh-ink);
}

.sh-mode__text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1 1 auto;
    min-width: 0;
}

.sh-mode__title {
    font-size: 1.05rem;
    font-weight: 650;
}

.sh-mode__desc {
    font-size: 0.83rem;
    line-height: 1.4;
    color: var(--cb-muted);
}

.sh-mode__chevron {
    flex-shrink: 0;
    color: var(--cb-faint);
}

.sh-recent__title {
    margin: 0 0 0.75rem;
    font-size: 1.15rem;
    font-weight: 650;
    color: var(--cb-ink);
}

.sh-recent__empty {
    margin: 0;
    padding: 1.25rem;
    border-radius: 18px;
    background: var(--cb-surface);
    box-shadow: inset 0 0 0 1px var(--cb-line);
    color: var(--cb-muted);
}

.sh-deals {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sh-deal {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 1.1rem;
    border-radius: 18px;
    background: var(--cb-surface);
    box-shadow: inset 0 0 0 1px var(--cb-line);
}

.sh-deal--incomplete {
    box-shadow: inset 0 0 0 1px #f5d78e;
}

.sh-deal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.sh-deal__date {
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    color: var(--cb-muted);
}

.sh-deal__unit {
    margin: 0.2rem 0 0;
    font-weight: 600;
    color: var(--cb-ink);
}

.sh-deal__contract {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--cb-muted);
}

.sh-deal__client {
    margin: 0;
    font-size: 0.9rem;
    color: var(--cb-ink);
}

.sh-deal__docs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-top: 0.4rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--cb-line);
}

.sh-deal__docs-label {
    font-size: 0.82rem;
    color: var(--cb-muted);
}

.sh-deal__slots {
    flex: 1 1 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.82rem;
}

.sh-deal__slot.is-ok {
    color: #15803d;
}

.sh-deal__slot.is-missing {
    color: #b45309;
}

.sh-deal__slot-icon {
    margin-right: 0.15rem;
    font-weight: 700;
}

@media (max-width: 1100px) {
    .sh-modes {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sh-deals {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .sh-page.sales-page {
        padding: 1rem 0.75rem 2rem;
    }

    .sh-head__title {
        font-size: 1.6rem;
    }

    .sh-modes {
        gap: 0.5rem;
        margin-bottom: 1.5rem;
    }

    /* На телефоне — компактные плитки: все шесть операций видны без прокрутки. */
    .sh-mode {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
        min-height: 6.5rem;
        padding: 0.9rem;
    }

    .sh-mode__icon {
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 12px;
    }

    .sh-mode__desc,
    .sh-mode__chevron {
        display: none;
    }

    .sh-mode__title {
        font-size: 1rem;
    }

    .sh-deal__docs .btn {
        flex: 1 1 100%;
        min-height: 2.75rem;
    }
}

/* 3D-планировка на квартире в шахматке: правый нижний угол свободен (текст слева) */
.cb-unit__3d {
    position: absolute;
    right: 0.4rem;
    bottom: 0.4rem;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.4rem;
    height: 1.05rem;
    padding: 0 0.25rem;
    border-radius: 5px;
    background: #17191c;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.cb-unit__3d:hover {
    transform: scale(1.12);
}

.unit-3d-card {
    position: relative;
    display: block;
    width: 100%;
    min-height: 4.5rem;
    margin: 0 0 0.75rem;
    padding: 0;
    border: 1px solid rgb(15 23 42 / 0.08);
    border-radius: 12px;
    background: #eef1f4;
    overflow: hidden;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.unit-3d-card img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.unit-3d-card__label {
    position: absolute;
    left: 0.6rem;
    bottom: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.45rem 0.75rem;
    border-radius: 10px;
    background: rgb(23 25 28 / 0.86);
    color: #fff;
    font-size: 0.75rem;
}

.unit-3d-card__label b {
    font-size: 0.9rem;
}

.unit-3d-card:not(:has(img)) .unit-3d-card__label {
    position: static;
    margin: 0.6rem;
    width: fit-content;
}

/* ── 3D-планировка в карточке квартиры: живая модель, крутится без отдельного окна;
   значок в углу раскрывает её на весь экран поверх навигации (с отступами под вырез экрана) ── */
.unit-3d-live {
    position: relative;
    height: clamp(280px, 42vh, 420px);
    margin-bottom: 14px;
    overflow: hidden;
    border-radius: 14px;
    background: #eef1f4 center / cover no-repeat;
    transition: background-color 0.4s;
}

.unit-3d-live.is-night {
    background-color: #151a23;
}

.unit-3d-live iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* пока 3D грузится — видна обычная планировка */
.unit-3d-live__ph {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    padding: 14px;
    box-sizing: border-box;
    object-fit: contain;
    background: #fff;
    transition: opacity 0.5s ease;
}

.unit-3d-live__loading {
    position: absolute;
    left: 10px;
    bottom: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #5d636a;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: opacity 0.3s;
}

.unit-3d-live__loading i {
    width: 10px;
    height: 10px;
    border: 2px solid #d5dbe1;
    border-top-color: #16a34a;
    border-radius: 50%;
    animation: unit-3d-spin 0.8s linear infinite;
}

@keyframes unit-3d-spin {
    to { transform: rotate(360deg); }
}

.unit-3d-live.is-ready iframe {
    opacity: 1;
}

.unit-3d-live.is-ready .unit-3d-live__ph,
.unit-3d-live.is-ready .unit-3d-live__loading,
.unit-3d-live.is-failed .unit-3d-live__loading {
    opacity: 0;
    pointer-events: none;
}

.unit-3d-live:not(.is-ready) .unit-3d-live__full,
.unit-3d-live:not(.is-ready) .unit-3d-live__vr {
    display: none;
}

.unit-3d-live__full {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.94);
    color: #17191c;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
}

.unit-3d-live__full:hover {
    background: #fff;
}

.unit-3d-live__full:active {
    transform: scale(0.94);
}

.unit-3d-live__ic-close,
.unit-3d-live.is-full .unit-3d-live__ic-open {
    display: none;
}

.unit-3d-live.is-full .unit-3d-live__ic-close {
    display: block;
}

.unit-3d-live.is-full {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    height: auto;
    margin: 0;
    border-radius: 0;
    background-image: none !important;
    animation: unit-3d-grow 0.28s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.unit-3d-live.is-full iframe {
    top: env(safe-area-inset-top, 0px);
    left: env(safe-area-inset-left, 0px);
    width: calc(100% - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    height: calc(100% - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}

.unit-3d-live.is-full .unit-3d-live__full {
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    right: calc(env(safe-area-inset-right, 0px) + 12px);
    bottom: auto;
    width: 42px;
    height: 42px;
}

@keyframes unit-3d-grow {
    from { opacity: 0.4; transform: scale(0.96); }
}

html:has(.unit-3d-live.is-full),
html:has(.unit-3d-live.is-full) body {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .unit-3d-live.is-full {
        animation: none;
    }
}

/* Кнопка «VR» в карточке квартиры и окошко с кодом для очков */
.unit-3d-live__vr {
    position: absolute;
    right: 56px;
    bottom: 10px;
    z-index: 2;
    height: 38px;
    padding: 0 12px;
    border: 0;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.94);
    color: #17191c;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
    cursor: pointer;
}

.unit-3d-live.is-full .unit-3d-live__vr {
    display: none;
}

.unit-3d-live__vrcode {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 58px;
    z-index: 3;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(23, 25, 28, 0.94);
    color: #fff;
    font-size: 14px;
    line-height: 1.4;
}

.unit-3d-live__vrcode b {
    display: block;
    margin: 2px 0 4px;
    font-size: 30px;
    letter-spacing: 0.18em;
    font-variant-numeric: tabular-nums;
}

.unit-3d-live__vrcode[hidden] {
    display: none;
}

/* пока 3D грузится, планировка показана в его блоке — нижнюю копию прячем */
.unit-3d-live:not(.is-ready):not(.is-failed):has(.unit-3d-live__ph) ~ .unit-detail__plan {
    display: none;
}

/* ============================================================ */
/* Мастер продаж: минималистичный вид, телефон в первую очередь */
/* ============================================================ */
.sales-wizard.sales-wizard--v2 {
    --swm-ink: #18212b;
    --swm-soft: #5f6b78;
    --swm-faint: #8a95a1;
    --swm-line: #e7eaee;
    --swm-green: #16a34a;
    --swm-green-d: #0e6b47;
    --swm-tint: #f3faf6;
    --swm-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 6l-6 6 6 6'/%3E%3C/svg%3E");
}
/* подписи-«ярлыки» заглавными — обычным текстом */
.sales-wizard--v2 .sw-currency-toggle__legend,
.sales-wizard--v2 .sales-wizard-unit-card__layout-title,
.sales-wizard--v2 .sw-pricing-total__label,
.sales-wizard--v2 .sw-installment-summary__label {
    text-transform: none;
    letter-spacing: 0;
}

@media (max-width: 767px) {
    body:has(.sales-wizard--v2),
    .app-content--sales-wizard { background: #fff !important; }
    .sales-wizard.sales-wizard--v2 .sales-wizard__shell {
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    /* шапка в одну строку: назад · название и квартира · шаг */
    .sales-wizard.sales-wizard--v2 .sales-wizard__head {
        display: grid;
        grid-template-columns: 40px minmax(0, 1fr) auto;
        align-items: center;
        gap: 0.65rem;
        margin: 0;
        padding: 0.35rem 0.85rem 0.6rem;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard__head > .btn {
        display: grid;
        place-items: center;
        width: 40px;
        height: 40px;
        min-height: 40px;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: #f1f4f2;
        color: var(--swm-ink);
        font-size: 0;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard__head > .btn::before {
        content: "";
        width: 20px;
        height: 20px;
        background: currentColor;
        -webkit-mask: var(--swm-arrow) center / contain no-repeat;
        mask: var(--swm-arrow) center / contain no-repeat;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard__head-text { min-width: 0; }
    .sales-wizard.sales-wizard--v2 .sales-wizard__title {
        margin: 0;
        font-size: 1rem;
        line-height: 1.25;
        letter-spacing: -0.01em;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard__sub {
        margin: 0.1rem 0 0;
        overflow: hidden;
        font-size: 0.8rem;
        color: var(--swm-soft);
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard__head[data-step]::after {
        content: attr(data-step);
        padding: 0.25rem 0.6rem;
        border-radius: 999px;
        background: var(--swm-tint);
        color: var(--swm-green-d);
        font-size: 0.8rem;
        font-weight: 700;
        font-variant-numeric: tabular-nums;
    }

    /* шаги: только тонкая полоса прогресса, название шага — заголовок экрана */
    .sales-wizard.sales-wizard--v2 .sales-wizard__progress {
        margin: 0;
        padding: 0 !important;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard__steps { display: none; }
    .sales-wizard.sales-wizard--v2 .sales-wizard__progress-bar {
        height: 3px;
        margin: 0;
        border-radius: 0;
        background: var(--swm-line);
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard__progress-fill {
        border-radius: 0 3px 3px 0;
        background: var(--swm-green);
    }

    /* содержимое: плоские секции без рамок и теней */
    .sales-wizard.sales-wizard--v2 .sales-wizard__panel { padding-top: 0.25rem; }
    .sales-wizard.sales-wizard--v2 .sales-wizard__panel-title {
        margin: 1rem 0 0.9rem;
        font-size: 1.3rem;
        line-height: 1.25;
        letter-spacing: -0.015em;
        color: var(--swm-ink);
    }
    .sales-wizard.sales-wizard--v2 .sw-card {
        margin: 0 0 1.5rem;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }
    .sales-wizard.sales-wizard--v2 .sw-card__title {
        margin: 0 0 0.65rem;
        font-size: 0.95rem;
        font-weight: 700;
        color: var(--swm-ink);
    }
    .sales-wizard.sales-wizard--v2 .sw-hint-muted { font-size: 0.82rem; }
    .sales-wizard.sales-wizard--v2 .sales-wizard-fields { gap: 0.85rem; }
    .sales-wizard.sales-wizard--v2 .sales-wizard-label {
        margin-bottom: 0.35rem;
        font-size: 0.82rem;
        font-weight: 600;
        color: var(--swm-soft);
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard-input {
        min-height: 48px;
        border-color: #dde2e7;
        border-radius: 12px;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard-input:focus {
        border-color: var(--swm-green);
        box-shadow: 0 0 0 3px rgb(22 163 74 / 0.15);
    }

    /* квартира: компактно, без вложенной карточки */
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card {
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card__main { margin-bottom: 0.75rem; }
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card__meta {
        gap: 0.75rem 1rem;
        padding: 0.85rem 1rem;
        border-radius: 14px;
        background: #f6f8f9;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card__meta dt { font-size: 0.78rem; }
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card__layout {
        margin-top: 1rem;
        padding: 0;
        border: 0;
        background: transparent;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card__layout-title {
        margin-bottom: 0.5rem;
        font-size: 0.95rem;
        font-weight: 700;
        color: var(--swm-ink);
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card__layout-empty {
        min-height: 0;
        padding: 0.85rem 1rem;
        border-radius: 14px;
        background: #f6f8f9;
        flex-direction: row;
        justify-content: flex-start;
        gap: 0.6rem;
        font-size: 0.88rem;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card__layout-empty svg { width: 22px; height: 22px; }
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card__layout-img {
        max-height: 240px;
        width: 100%;
        object-fit: contain;
        border-radius: 12px;
        background: #f6f8f9;
    }

    /* низ: компактная «назад» и широкая «Далее», над полосой iPhone */
    .sales-wizard.sales-wizard--v2 .sales-wizard__footer {
        position: sticky;
        bottom: 0;
        z-index: 20;
        display: flex;
        gap: 0.6rem;
        margin: 0;
        padding: 0.6rem 0.85rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid var(--swm-line);
        border-radius: 0;
        background: rgb(255 255 255 / 0.96);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
        box-shadow: none;
    }
    .sales-wizard.sales-wizard--v2 #sw-btn-prev {
        display: grid;
        place-items: center;
        flex: 0 0 50px;
        width: 50px;
        min-height: 50px;
        padding: 0;
        border: 1px solid var(--swm-line);
        border-radius: 14px;
        background: #fff;
        color: var(--swm-ink);
        font-size: 0;
    }
    .sales-wizard.sales-wizard--v2 #sw-btn-prev::before {
        content: "";
        width: 20px;
        height: 20px;
        background: currentColor;
        -webkit-mask: var(--swm-arrow) center / contain no-repeat;
        mask: var(--swm-arrow) center / contain no-repeat;
    }
    .sales-wizard.sales-wizard--v2 #sw-btn-prev[hidden] { display: none; }
    .sales-wizard.sales-wizard--v2 #sw-btn-next {
        flex: 1 1 auto;
        min-height: 50px;
        border-radius: 14px;
        font-size: 1rem;
        font-weight: 700;
        box-shadow: none;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard__submit {
        width: 100%;
        min-height: 52px;
        border-radius: 14px;
    }
}

/* ============================================================ */
/* Мастер продаж: экран как в приложении — сгруппированные поля, */
/* табло суммы, чек проверки (телефон)                           */
/* ============================================================ */
.sales-wizard.sales-wizard--v2 {
    --swa-bg: #f2f4f3;
    --swa-ink: #17201b;
    --swa-soft: #5e6a63;
    --swa-faint: #8b968f;
    --swa-line: #e3e8e5;
    --swa-green: #16a34a;
    --swa-deep: #0f7a4a;
    --swa-board: #0f3b28;
}

/* чек проверки — на всех экранах */
.sales-wizard--v2 .sw-review { display: block; padding: 0; border: 0; background: transparent; box-shadow: none; }
.sales-wizard--v2 .sw-review__hero { padding: 0 0.25rem 0.9rem; border: 0; background: none; }
.sales-wizard--v2 .sw-review__title { margin: 0; font-size: 1.25rem; line-height: 1.25; color: var(--swa-ink); }
.sales-wizard--v2 .sw-review__sub { margin: 0.2rem 0 0; font-size: 0.9rem; color: var(--swa-soft); }
.sales-wizard--v2 .sw-review__section {
    margin: 0 0 0.9rem;
    padding: 0;
    border: 1px solid var(--swa-line);
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
}
.sales-wizard--v2 .sw-review__section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem 0.3rem;
}
.sales-wizard--v2 .sw-review__section-title {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--swa-soft);
}
.sales-wizard--v2 .sw-review__grid { display: block; margin: 0; padding: 0; }
.sales-wizard--v2 .sw-review__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 1rem;
    border-top: 1px solid var(--swa-line);
}
.sales-wizard--v2 .sw-review__section-head + .sw-review__grid > .sw-review__row:first-child { border-top: 0; }
.sales-wizard--v2 .sw-review__dt { flex-shrink: 0; font-size: 0.88rem; color: var(--swa-soft); }
.sales-wizard--v2 .sw-review__dd {
    max-width: 64%;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--swa-ink);
    text-align: right;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
}
.sales-wizard--v2 .sw-review__total {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.15rem 0.75rem;
    padding: 0.95rem 1rem 0.9rem;
}
.sales-wizard--v2 .sw-review__total-label { grid-column: 1; font-size: 0.82rem; font-weight: 600; color: var(--swa-soft); }
.sales-wizard--v2 .sw-review__total-value {
    grid-column: 1;
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--swa-deep);
    font-variant-numeric: tabular-nums;
}
.sales-wizard--v2 .sw-review__total .sw-review__edit { grid-column: 2; grid-row: 1 / span 2; }
.sales-wizard--v2 .sw-review__edit {
    flex-shrink: 0;
    min-height: 0 !important;
    padding: 0.35rem 0.1rem;
    border: 0;
    background: none;
    color: var(--swa-deep);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
}
.sales-wizard--v2 .sw-review__edit:focus-visible { outline: 2px solid var(--swa-green); outline-offset: 2px; border-radius: 6px; }
.sales-wizard--v2 .sw-review__more { border-top: 1px solid var(--swa-line); }
.sales-wizard--v2 .sw-review__more summary {
    padding: 0.7rem 1rem;
    color: var(--swa-deep);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}
.sales-wizard--v2 .sw-review-schedule-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.sales-wizard--v2 .sw-review-schedule-table th,
.sales-wizard--v2 .sw-review-schedule-table td { padding: 0.45rem 1rem; border-top: 1px solid var(--swa-line); text-align: left; }
.sales-wizard--v2 .sw-review-schedule-table th { color: var(--swa-soft); font-weight: 600; }

/* последний шаг: без повторной полной сводки — сумма и номер договора */
.sales-wizard.sales-wizard--v2 .sw-finish #sales-summary .sw-review__section:not(.sw-review__section--money),
.sales-wizard.sales-wizard--v2 .sw-finish #sales-summary .sw-review__section--money .sw-review__grid { display: none; }

@media (max-width: 767px) {
    body:has(.sales-wizard--v2),
    .app-content--sales-wizard { background: var(--swa-bg, #f2f4f3) !important; }
    .sales-wizard.sales-wizard--v2 { background: #f2f4f3; }

    /* группа полей: белый блок, подпись группы сверху, строки через тонкую линию */
    .sales-wizard.sales-wizard--v2 .sw-card {
        margin: 0 0 1rem;
        padding: 0;
        border: 0;
        border-radius: 16px;
        background: #fff;
        overflow: hidden;
    }
    /* шаг — колонка с прокруткой: блоки не должны сжиматься и обрезать поля */
    .sales-wizard.sales-wizard--v2 .sales-wizard__panel > *,
    .sales-wizard.sales-wizard--v2 .sw-pricing > * { flex-shrink: 0; }
    .sales-wizard.sales-wizard--v2 .sw-card__title {
        margin: 0;
        padding: 0.8rem 1rem 0.2rem;
        font-size: 0.8rem;
        font-weight: 600;
        color: var(--swa-soft);
    }
    .sales-wizard.sales-wizard--v2 .sw-card > .sw-hint-muted { margin: 0; padding: 0 1rem 0.6rem; }
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-fields,
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field-row,
    .sales-wizard.sales-wizard--v2 .sw-card .sw-contact-fields {
        display: block;
        margin: 0;
        gap: 0;
    }
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field {
        margin: 0;
        padding: 0.55rem 1rem 0.6rem;
        border-top: 1px solid var(--swa-line);
        transition: background-color 0.15s ease;
    }
    .sales-wizard.sales-wizard--v2 .sw-card__title + .sales-wizard-field,
    .sales-wizard.sales-wizard--v2 .sw-card__title + .sales-wizard-fields > .sales-wizard-field:first-child,
    .sales-wizard.sales-wizard--v2 .sw-card__title + .sales-wizard-field-row > .sales-wizard-field:first-child,
    .sales-wizard.sales-wizard--v2 .sw-card__title + .sw-contact-fields > .sales-wizard-field:first-child { border-top: 0; }
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field:focus-within { background: #f6fbf8; }
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-label {
        display: block;
        margin: 0 0 0.05rem;
        font-size: 0.76rem;
        font-weight: 500;
        color: var(--swa-soft);
    }
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field:focus-within .sales-wizard-label { color: var(--swa-deep); }
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-input {
        width: 100%;
        min-height: 30px;
        height: auto;
        margin: 0;
        padding: 0.1rem 0;
        border: 0;
        border-radius: 0;
        background: transparent !important;
        box-shadow: none !important;
        color: var(--swa-ink);
        font-size: 17px;
        line-height: 1.35;
    }
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-input::placeholder { color: #b3bcb6; }
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-input:focus { outline: none; }
    .sales-wizard.sales-wizard--v2 .sw-card .sw-pricing__hint-secondary,
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field .sw-hint-muted {
        margin: 0.15rem 0 0;
        font-size: 0.78rem;
        color: var(--swa-faint);
    }
    /* результат скана — подсветка строки, а не рамки поля */
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field:has(.sw-scan-ok) { background: #f3faf6; }
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field:has(.sw-scan-check) { background: #fff8eb; }
    .sales-wizard.sales-wizard--v2 .sw-card .sw-scan-note { margin-top: 0.1rem; }

    /* суммы: табло итога сверху, как экран калькулятора; при прокрутке уезжает вместе с экраном */
    .sales-wizard.sales-wizard--v2 .sw-pricing { display: flex; flex-direction: column; }
    .sales-wizard.sales-wizard--v2 .sw-pricing-total {
        order: -1;
        position: static;
        margin: 0 0 1rem;
        padding: 0.95rem 1.1rem 1rem;
        border: 0;
        border-radius: 18px;
        background: var(--swa-board);
        color: #fff;
        box-shadow: none;
    }
    .sales-wizard.sales-wizard--v2 .sw-pricing-total__label { margin: 0; font-size: 0.8rem; color: rgb(255 255 255 / 0.7); }
    .sales-wizard.sales-wizard--v2 .sw-pricing-total__primary {
        margin: 0.1rem 0 0;
        font-size: 1.9rem;
        font-weight: 800;
        line-height: 1.1;
        letter-spacing: -0.02em;
        color: #fff;
        font-variant-numeric: tabular-nums;
    }
    .sales-wizard.sales-wizard--v2 .sw-pricing-total__secondary {
        margin: 0.25rem 0 0;
        font-size: 0.88rem;
        color: rgb(255 255 255 / 0.75);
        font-variant-numeric: tabular-nums;
    }
    .sales-wizard.sales-wizard--v2 .sw-pricing__row {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        margin: 0;
        padding: 0.7rem 1rem;
        border: 0;
        border-radius: 0;
        background: transparent;
    }
    .sales-wizard.sales-wizard--v2 .sw-pricing__label { font-size: 0.95rem; color: var(--swa-soft); }
    .sales-wizard.sales-wizard--v2 .sw-pricing__value { font-size: 1rem; font-weight: 700; color: var(--swa-ink); }

    /* валюта: переключатель-сегменты */
    .sales-wizard.sales-wizard--v2 .sw-currency-toggle {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 3px;
        margin: 0.1rem 1rem 0.9rem;
        padding: 3px;
        border: 0;
        border-radius: 12px;
        background: #e8ece9;
    }
    /* подпись валюты видна только экранным дикторам — переключатель говорит сам за себя */
    .sales-wizard.sales-wizard--v2 .sw-currency-toggle__legend {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
    .sales-wizard.sales-wizard--v2 .sw-currency-toggle__opt {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 40px;
        margin: 0;
        padding: 0 0.5rem;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: var(--swa-soft);
        font-size: 0.92rem;
        font-weight: 600;
        cursor: pointer;
    }
    .sales-wizard.sales-wizard--v2 .sw-currency-toggle__opt input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }
    .sales-wizard.sales-wizard--v2 .sw-currency-toggle__opt:has(input:checked) {
        background: #fff;
        color: var(--swa-ink);
        box-shadow: 0 1px 3px rgb(0 0 0 / 0.12);
    }
    .sales-wizard.sales-wizard--v2 .sw-currency-toggle__opt:has(input:focus-visible) { outline: 2px solid var(--swa-green); outline-offset: 1px; }

    /* график рассрочки в шаге «Суммы»: одна строка на платёж — № · дата · сумма */
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card .sw-installment-schedule-wrap {
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        max-height: 320px;
        overflow-y: auto;
    }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card table.sw-installment-schedule thead { display: none; }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card table.sw-installment-schedule tbody {
        display: block;
        padding: 0;
        gap: 0;
    }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card table.sw-installment-schedule tbody tr {
        display: grid;
        grid-template-columns: 1.8rem minmax(0, 1fr) auto;
        align-items: baseline;
        gap: 0.5rem;
        margin: 0;
        padding: 0.55rem 1rem;
        border: 0;
        border-top: 1px solid var(--swa-line);
        border-radius: 0;
        background: transparent;
    }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card table.sw-installment-schedule td {
        display: block;
        padding: 0 !important;
        border: 0 !important;
        font-size: 0.92rem;
        background: none;
    }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card table.sw-installment-schedule td::before { content: none !important; }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card table.sw-installment-schedule td:nth-child(1) { color: var(--swa-faint); }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card table.sw-installment-schedule td:nth-child(2) { color: var(--swa-soft); }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card table.sw-installment-schedule td:nth-child(3) { text-align: right; font-variant-numeric: tabular-nums; }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card table.sw-installment-schedule td:nth-child(4) { display: none; }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card table.sw-installment-schedule td[colspan] {
        grid-column: 1 / -1;
        color: var(--swa-faint);
    }

    /* поиск постоянного клиента — серое поле поиска внутри группы */
    .sales-wizard.sales-wizard--v2 .sw-client-picker > .sw-hint-muted { display: none; }
    .sales-wizard.sales-wizard--v2 .sw-client-picker__search-wrap { padding: 0.2rem 1rem 0.8rem; }
    .sales-wizard.sales-wizard--v2 .sw-client-picker__search-wrap .sales-wizard-label { display: none; }
    .sales-wizard.sales-wizard--v2 .sw-client-picker .sales-wizard-input {
        min-height: 44px;
        padding: 0 0.9rem;
        border: 0;
        border-radius: 12px;
        background: #f2f4f3 !important;
        font-size: 16px;
    }
    .sales-wizard.sales-wizard--v2 .sw-client-picker__new {
        display: block;
        width: 100%;
        min-height: 46px;
        margin: 0;
        padding: 0 1rem;
        border: 0;
        border-top: 1px solid var(--swa-line);
        border-radius: 0;
        background: none;
        color: var(--swa-deep);
        font-weight: 600;
        text-align: left;
    }
    .sales-wizard.sales-wizard--v2 .sw-client-picker__selected { padding: 0.4rem 1rem 0.8rem; }

    /* квартира: данные на белом блоке */
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card__main {
        padding: 0 0.25rem;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card__meta,
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card__layout-empty { background: #fff; }

    /* проверка: заголовок шага и подсказки */
    .sales-wizard.sales-wizard--v2 .sw-review-step__head .sw-hint-muted { margin: -0.4rem 0 1rem; }
    .sales-wizard.sales-wizard--v2 .sw-review-step__notes { font-size: 0.82rem; color: var(--swa-soft); }

    .sales-wizard.sales-wizard--v2 .sw-back-link {
        min-height: 0 !important;
        margin: -0.4rem 0 0.75rem;
        padding: 0.3rem 0;
        border: 0;
        background: none;
        color: var(--swa-deep);
        font-weight: 600;
    }
    .sales-wizard.sales-wizard--v2 .sw-contract-number__preview { padding: 0.6rem 1rem 0.2rem; margin: 0; font-size: 0.95rem; }
    .sales-wizard.sales-wizard--v2 #sw-open-contract-registry { margin: 0.3rem 1rem 0.9rem; }
}

@media (max-width: 767px) {
    /* «Назад / Далее» всегда внизу экрана, даже если на шаге мало полей */
    .sales-wizard.sales-wizard--v2 .sales-wizard__footer {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 60;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard__form {
        padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard__footer:not(:has(.btn:not([hidden]))) { display: none; }

    /* одним взглядом: инструкции скрыты, остаются данные, статусы и ошибки (у них есть id) */
    .sales-wizard.sales-wizard--v2 .sw-hint-muted:not([id]):not(.sw-hint-muted--warn),
    .sales-wizard.sales-wizard--v2 .sw-pricing__hint-secondary:not([id]),
    .sales-wizard.sales-wizard--v2 .sales-wizard-docs-lead { display: none; }

    /* дата — по левому краю, как остальные значения (iPhone ставит её по центру) */
    .sales-wizard.sales-wizard--v2 input[type="date"].sales-wizard-input { text-align: left; }
    .sales-wizard.sales-wizard--v2 input[type="date"].sales-wizard-input::-webkit-date-and-time-value { text-align: left; }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field { transition: none; }
}

/* последний шаг: «‹ к проверке» и «Подтвердить» перенесены скриптом в нижнюю панель — как «‹ Далее» */
.sales-wizard.sales-wizard--v2 .sales-wizard__footer [hidden] { display: none !important; }
.sales-wizard.sales-wizard--v2 .sales-wizard__footer #sw-back-to-review {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    min-height: 52px !important;
    margin: 0;
    padding: 0;
    border: 1px solid #e3e8e5;
    border-radius: 14px;
    background: #fff;
    color: #17201b;
    font-size: 0;
    text-decoration: none;
    cursor: pointer;
}
.sales-wizard.sales-wizard--v2 .sales-wizard__footer #sw-back-to-review::before {
    content: "";
    width: 20px;
    height: 20px;
    background: currentColor;
    -webkit-mask: var(--swm-arrow) center / contain no-repeat;
    mask: var(--swm-arrow) center / contain no-repeat;
}
.sales-wizard.sales-wizard--v2 .sales-wizard__footer #sw-btn-confirm {
    flex: 1 1 auto;
    width: auto;
    min-height: 52px;
    margin: 0;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: none;
}
@media (max-width: 767px) {
    .sales-wizard.sales-wizard--v2 .sales-wizard__footer #sw-back-to-review { width: 50px; height: 50px; min-height: 50px !important; }
    .sales-wizard.sales-wizard--v2 .sales-wizard__footer #sw-btn-confirm { min-height: 50px; }
}
@media (min-width: 768px) {
    .sales-wizard.sales-wizard--v2 .sales-wizard__footer #sw-btn-confirm { flex: 0 0 auto; min-width: 300px; }
}

/* ============================================================ */
/* Мастер продаж на компьютере: тот же вид приложения            */
/* ============================================================ */
@media (min-width: 768px) {
    body:has(.sales-wizard--v2),
    .app-content--sales-wizard { background: var(--swa-bg, #f2f4f3) !important; }
    .sales-wizard.sales-wizard--v2 { background: #f2f4f3; }

    /* группа полей: белый блок, подпись группы сверху, строки через тонкую линию */
    .sales-wizard.sales-wizard--v2 .sw-card {
        margin: 0 0 1rem;
        padding: 0;
        border: 0;
        border-radius: 16px;
        background: #fff;
        overflow: hidden;
    }
    /* шаг — колонка с прокруткой: блоки не должны сжиматься и обрезать поля */
    .sales-wizard.sales-wizard--v2 .sales-wizard__panel > *,
    .sales-wizard.sales-wizard--v2 .sw-pricing > * { flex-shrink: 0; }
    .sales-wizard.sales-wizard--v2 .sw-card__title {
        margin: 0;
        padding: 0.8rem 1rem 0.2rem;
        font-size: 0.8rem;
        font-weight: 600;
        color: var(--swa-soft);
    }
    .sales-wizard.sales-wizard--v2 .sw-card > .sw-hint-muted { margin: 0; padding: 0 1rem 0.6rem; }
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-fields,
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field-row,
    .sales-wizard.sales-wizard--v2 .sw-card .sw-contact-fields {
        display: block;
        margin: 0;
        gap: 0;
    }
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field {
        margin: 0;
        padding: 0.55rem 1rem 0.6rem;
        border-top: 1px solid var(--swa-line);
        transition: background-color 0.15s ease;
    }
    .sales-wizard.sales-wizard--v2 .sw-card__title + .sales-wizard-field,
    .sales-wizard.sales-wizard--v2 .sw-card__title + .sales-wizard-fields > .sales-wizard-field:first-child,
    .sales-wizard.sales-wizard--v2 .sw-card__title + .sales-wizard-field-row > .sales-wizard-field:first-child,
    .sales-wizard.sales-wizard--v2 .sw-card__title + .sw-contact-fields > .sales-wizard-field:first-child { border-top: 0; }
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field:focus-within { background: #f6fbf8; }
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-label {
        display: block;
        margin: 0 0 0.05rem;
        font-size: 0.76rem;
        font-weight: 500;
        color: var(--swa-soft);
    }
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field:focus-within .sales-wizard-label { color: var(--swa-deep); }
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-input {
        width: 100%;
        min-height: 30px;
        height: auto;
        margin: 0;
        padding: 0.1rem 0;
        border: 0;
        border-radius: 0;
        background: transparent !important;
        box-shadow: none !important;
        color: var(--swa-ink);
        font-size: 17px;
        line-height: 1.35;
    }
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-input::placeholder { color: #b3bcb6; }
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-input:focus { outline: none; }
    .sales-wizard.sales-wizard--v2 .sw-card .sw-pricing__hint-secondary,
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field .sw-hint-muted {
        margin: 0.15rem 0 0;
        font-size: 0.78rem;
        color: var(--swa-faint);
    }
    /* результат скана — подсветка строки, а не рамки поля */
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field:has(.sw-scan-ok) { background: #f3faf6; }
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field:has(.sw-scan-check) { background: #fff8eb; }
    .sales-wizard.sales-wizard--v2 .sw-card .sw-scan-note { margin-top: 0.1rem; }

    /* суммы: табло итога сверху, как экран калькулятора; при прокрутке уезжает вместе с экраном */
    .sales-wizard.sales-wizard--v2 .sw-pricing { display: flex; flex-direction: column; }
    .sales-wizard.sales-wizard--v2 .sw-pricing-total {
        order: -1;
        position: static;
        margin: 0 0 1rem;
        padding: 0.95rem 1.1rem 1rem;
        border: 0;
        border-radius: 18px;
        background: var(--swa-board);
        color: #fff;
        box-shadow: none;
    }
    .sales-wizard.sales-wizard--v2 .sw-pricing-total__label { margin: 0; font-size: 0.8rem; color: rgb(255 255 255 / 0.7); }
    .sales-wizard.sales-wizard--v2 .sw-pricing-total__primary {
        margin: 0.1rem 0 0;
        font-size: 1.9rem;
        font-weight: 800;
        line-height: 1.1;
        letter-spacing: -0.02em;
        color: #fff;
        font-variant-numeric: tabular-nums;
    }
    .sales-wizard.sales-wizard--v2 .sw-pricing-total__secondary {
        margin: 0.25rem 0 0;
        font-size: 0.88rem;
        color: rgb(255 255 255 / 0.75);
        font-variant-numeric: tabular-nums;
    }
    .sales-wizard.sales-wizard--v2 .sw-pricing__row {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        margin: 0;
        padding: 0.7rem 1rem;
        border: 0;
        border-radius: 0;
        background: transparent;
    }
    .sales-wizard.sales-wizard--v2 .sw-pricing__label { font-size: 0.95rem; color: var(--swa-soft); }
    .sales-wizard.sales-wizard--v2 .sw-pricing__value { font-size: 1rem; font-weight: 700; color: var(--swa-ink); }

    /* валюта: переключатель-сегменты */
    .sales-wizard.sales-wizard--v2 .sw-currency-toggle {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 3px;
        margin: 0.1rem 1rem 0.9rem;
        padding: 3px;
        border: 0;
        border-radius: 12px;
        background: #e8ece9;
    }
    /* подпись валюты видна только экранным дикторам — переключатель говорит сам за себя */
    .sales-wizard.sales-wizard--v2 .sw-currency-toggle__legend {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
    .sales-wizard.sales-wizard--v2 .sw-currency-toggle__opt {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 40px;
        margin: 0;
        padding: 0 0.5rem;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: var(--swa-soft);
        font-size: 0.92rem;
        font-weight: 600;
        cursor: pointer;
    }
    .sales-wizard.sales-wizard--v2 .sw-currency-toggle__opt input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }
    .sales-wizard.sales-wizard--v2 .sw-currency-toggle__opt:has(input:checked) {
        background: #fff;
        color: var(--swa-ink);
        box-shadow: 0 1px 3px rgb(0 0 0 / 0.12);
    }
    .sales-wizard.sales-wizard--v2 .sw-currency-toggle__opt:has(input:focus-visible) { outline: 2px solid var(--swa-green); outline-offset: 1px; }

    /* график рассрочки в шаге «Суммы»: одна строка на платёж — № · дата · сумма */
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card .sw-installment-schedule-wrap {
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        max-height: 320px;
        overflow-y: auto;
    }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card table.sw-installment-schedule thead { display: none; }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card table.sw-installment-schedule tbody {
        display: block;
        padding: 0;
        gap: 0;
    }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card table.sw-installment-schedule tbody tr {
        display: grid;
        grid-template-columns: 1.8rem minmax(0, 1fr) auto;
        align-items: baseline;
        gap: 0.5rem;
        margin: 0;
        padding: 0.55rem 1rem;
        border: 0;
        border-top: 1px solid var(--swa-line);
        border-radius: 0;
        background: transparent;
    }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card table.sw-installment-schedule td {
        display: block;
        padding: 0 !important;
        border: 0 !important;
        font-size: 0.92rem;
        background: none;
    }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card table.sw-installment-schedule td::before { content: none !important; }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card table.sw-installment-schedule td:nth-child(1) { color: var(--swa-faint); }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card table.sw-installment-schedule td:nth-child(2) { color: var(--swa-soft); }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card table.sw-installment-schedule td:nth-child(3) { text-align: right; font-variant-numeric: tabular-nums; }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card table.sw-installment-schedule td:nth-child(4) { display: none; }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card table.sw-installment-schedule td[colspan] {
        grid-column: 1 / -1;
        color: var(--swa-faint);
    }

    /* поиск постоянного клиента — серое поле поиска внутри группы */
    .sales-wizard.sales-wizard--v2 .sw-client-picker > .sw-hint-muted { display: none; }
    .sales-wizard.sales-wizard--v2 .sw-client-picker__search-wrap { padding: 0.2rem 1rem 0.8rem; }
    .sales-wizard.sales-wizard--v2 .sw-client-picker__search-wrap .sales-wizard-label { display: none; }
    .sales-wizard.sales-wizard--v2 .sw-client-picker .sales-wizard-input {
        min-height: 44px;
        padding: 0 0.9rem;
        border: 0;
        border-radius: 12px;
        background: #f2f4f3 !important;
        font-size: 16px;
    }
    .sales-wizard.sales-wizard--v2 .sw-client-picker__new {
        display: block;
        width: 100%;
        min-height: 46px;
        margin: 0;
        padding: 0 1rem;
        border: 0;
        border-top: 1px solid var(--swa-line);
        border-radius: 0;
        background: none;
        color: var(--swa-deep);
        font-weight: 600;
        text-align: left;
    }
    .sales-wizard.sales-wizard--v2 .sw-client-picker__selected { padding: 0.4rem 1rem 0.8rem; }

    /* квартира: данные на белом блоке */
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card__main {
        padding: 0 0.25rem;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card__meta,
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card__layout-empty { background: #fff; }

    /* проверка: заголовок шага и подсказки */
    .sales-wizard.sales-wizard--v2 .sw-review-step__head .sw-hint-muted { margin: -0.4rem 0 1rem; }
    .sales-wizard.sales-wizard--v2 .sw-review-step__notes { font-size: 0.82rem; color: var(--swa-soft); }

    .sales-wizard.sales-wizard--v2 .sw-back-link {
        min-height: 0 !important;
        margin: -0.4rem 0 0.75rem;
        padding: 0.3rem 0;
        border: 0;
        background: none;
        color: var(--swa-deep);
        font-weight: 600;
    }
    .sales-wizard.sales-wizard--v2 .sw-contract-number__preview { padding: 0.6rem 1rem 0.2rem; margin: 0; font-size: 0.95rem; }
    .sales-wizard.sales-wizard--v2 #sw-open-contract-registry { margin: 0.3rem 1rem 0.9rem; }
}

@media (min-width: 768px) {
    .sales-wizard.sales-wizard--v2 {
        max-width: 760px;
        margin: 0 auto;
        padding: 1.5rem 1.5rem 0;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard__shell {
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }
    /* шапка: круглая «‹», название и квартира */
    .sales-wizard.sales-wizard--v2 .sales-wizard__head {
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr);
        align-items: center;
        gap: 0.9rem;
        margin: 0 0 1rem;
        padding: 0;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard__head > .btn {
        display: grid;
        place-items: center;
        width: 44px;
        height: 44px;
        min-height: 44px;
        margin: 0;
        padding: 0;
        border: 1px solid #e3e8e5;
        border-radius: 50%;
        background: #fff;
        color: #17201b;
        font-size: 0;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard__head > .btn::before {
        content: "";
        width: 20px;
        height: 20px;
        background: currentColor;
        -webkit-mask: var(--swm-arrow) center / contain no-repeat;
        mask: var(--swm-arrow) center / contain no-repeat;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard__title { margin: 0; font-size: 1.35rem; letter-spacing: -0.015em; color: #17201b; }
    .sales-wizard.sales-wizard--v2 .sales-wizard__sub { margin: 0.15rem 0 0; font-size: 0.9rem; color: #5e6a63; }

    /* шаги: подписи и тонкая полоса */
    .sales-wizard.sales-wizard--v2 .sales-wizard__progress { margin: 0 0 1.25rem; padding: 0; }
    .sales-wizard.sales-wizard--v2 .sales-wizard__steps {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0.5rem;
        margin: 0 0 0.5rem;
        padding: 0;
        font-size: 0.85rem;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard__step { padding: 0; border: 0; color: #8b968f; font-weight: 600; text-align: left; }
    .sales-wizard.sales-wizard--v2 .sales-wizard__step.is-done { color: #5e6a63; }
    .sales-wizard.sales-wizard--v2 .sales-wizard__step.is-active { color: #0f7a4a; }
    .sales-wizard.sales-wizard--v2 .sales-wizard__progress-bar { height: 4px; border-radius: 4px; background: #e3e8e5; }
    .sales-wizard.sales-wizard--v2 .sales-wizard__progress-fill { border-radius: 4px; background: #16a34a; }

    .sales-wizard.sales-wizard--v2 .sales-wizard__panel { padding: 0; }
    .sales-wizard.sales-wizard--v2 .sales-wizard__panel-title { margin: 0 0 1rem; font-size: 1.5rem; letter-spacing: -0.02em; color: #17201b; }
    .sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field { padding: 0.65rem 1.1rem 0.7rem; }
    .sales-wizard.sales-wizard--v2 .sw-card__title { padding: 0.9rem 1.1rem 0.2rem; }

    /* квартира */
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card { padding: 0; border: 0; background: transparent; box-shadow: none; }
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card__meta {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        padding: 1rem 1.1rem;
        border-radius: 16px;
        background: #fff;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card__layout { margin-top: 1rem; padding: 0; border: 0; background: transparent; }
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card__layout-img { max-height: 360px; width: 100%; object-fit: contain; border-radius: 16px; background: #fff; }

    /* кнопки внизу — панель во всю ширину мастера, прилипает к низу окна */
    .sales-wizard.sales-wizard--v2 .sales-wizard__footer {
        position: sticky;
        bottom: 0;
        z-index: 20;
        display: flex;
        justify-content: flex-end;
        gap: 0.6rem;
        margin: 1rem -1.5rem 0;
        padding: 0.8rem 1.5rem;
        border-top: 1px solid #e3e8e5;
        border-radius: 0;
        background: rgb(242 244 243 / 0.94);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
        box-shadow: none;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard__footer:not(:has(.btn:not([hidden]))) { display: none; }
    .sales-wizard.sales-wizard--v2 #sw-btn-prev {
        display: grid;
        place-items: center;
        width: 52px;
        min-height: 52px;
        padding: 0;
        border: 1px solid #e3e8e5;
        border-radius: 14px;
        background: #fff;
        color: #17201b;
        font-size: 0;
    }
    .sales-wizard.sales-wizard--v2 #sw-btn-prev::before {
        content: "";
        width: 20px;
        height: 20px;
        background: currentColor;
        -webkit-mask: var(--swm-arrow) center / contain no-repeat;
        mask: var(--swm-arrow) center / contain no-repeat;
    }
    .sales-wizard.sales-wizard--v2 #sw-btn-prev[hidden] { display: none; }
    .sales-wizard.sales-wizard--v2 #sw-btn-next {
        min-width: 260px;
        min-height: 52px;
        border-radius: 14px;
        font-size: 1rem;
        font-weight: 700;
        box-shadow: none;
    }
    .sales-wizard.sales-wizard--v2 .sw-finish #sw-before-sale:not([hidden]) { padding-bottom: 1.5rem; }

    /* блоки во всю ширину мастера, друг под другом */
    .sales-wizard.sales-wizard--v2 .sales-wizard__form,
    .sales-wizard.sales-wizard--v2 .sw-pricing { display: flex; flex-direction: column; align-items: stretch; gap: 1rem; }
    .sales-wizard.sales-wizard--v2 .sales-wizard__panel > *,
    .sales-wizard.sales-wizard--v2 .sw-pricing > * { width: auto; max-width: none; align-self: stretch; }
    .sales-wizard.sales-wizard--v2 .sales-wizard__panel:not(.is-active) { display: none; }

    /* инструкции — тоже нет: всё понятно по подписям */
    .sales-wizard.sales-wizard--v2 .sw-hint-muted:not([id]):not(.sw-hint-muted--warn),
    .sales-wizard.sales-wizard--v2 .sw-pricing__hint-secondary:not([id]),
    .sales-wizard.sales-wizard--v2 .sales-wizard-docs-lead { display: none; }
}

/* Ноутбук и большие экраны: мастер на всю рабочую область, блоки в две колонки */
@media (min-width: 1100px) {
    .sales-wizard.sales-wizard--v2 {
        max-width: 1240px;
        padding: 1.75rem clamp(1.5rem, 3vw, 3rem) 0;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard__footer {
        margin-left: calc(-1 * clamp(1.5rem, 3vw, 3rem));
        margin-right: calc(-1 * clamp(1.5rem, 3vw, 3rem));
        padding-left: clamp(1.5rem, 3vw, 3rem);
        padding-right: clamp(1.5rem, 3vw, 3rem);
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard__steps { font-size: 0.9rem; }

    /* шаг: заголовок и широкие блоки — во всю ширину, группы полей — по две в ряд */
    .sales-wizard.sales-wizard--v2 .sales-wizard__panel.is-active {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-flow: row dense;
        grid-auto-rows: max-content;
        align-content: start;
        gap: 1rem 1.25rem;
        align-items: start;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard__panel.is-active > * { grid-column: 1 / -1; margin-top: 0; margin-bottom: 0; }
    .sales-wizard.sales-wizard--v2 .sales-wizard__panel.is-active > .sw-card:not(.sw-client-picker) { grid-column: auto; }
    .sales-wizard.sales-wizard--v2 .sales-wizard__panel.is-active > [hidden] { display: none; }

    /* суммы: табло сверху, блоки цены — рядом, график — во всю ширину */
    .sales-wizard.sales-wizard--v2 .sw-pricing {
        display: grid;
        grid-auto-rows: max-content;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem 1.25rem;
        align-items: start;
    }
    .sales-wizard.sales-wizard--v2 .sw-pricing > * { grid-column: auto; margin: 0; }
    .sales-wizard.sales-wizard--v2 .sw-pricing > .sw-pricing-total,
    .sales-wizard.sales-wizard--v2 .sw-pricing > .sw-installment-schedule-card,
    .sales-wizard.sales-wizard--v2 .sw-pricing > :not(.sw-card):not(.sw-pricing-total) { grid-column: 1 / -1; }
    .sales-wizard.sales-wizard--v2 .sw-installment-schedule-card { max-height: 420px; }

    /* квартира: данные слева, планировка справа */
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card--with-layout .sales-wizard-unit-card__body {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
        gap: 1.25rem;
        align-items: start;
    }
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card__meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card__layout { margin-top: 0; }
    .sales-wizard.sales-wizard--v2 .sales-wizard-unit-card__layout-img { max-height: min(520px, 60vh); }

    /* проверка: итог сверху, разделы чека по два в ряд */
    .sales-wizard.sales-wizard--v2 .sales-wizard__panel--review { max-width: none; }
    .sales-wizard.sales-wizard--v2 .sw-review {
        max-width: none;
        grid-auto-rows: max-content;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem 1.25rem;
        align-items: start;
    }
    .sales-wizard.sales-wizard--v2 .sw-review > * { margin: 0; }
    .sales-wizard.sales-wizard--v2 .sw-review > :not(.sw-review__section),
    .sales-wizard.sales-wizard--v2 .sw-review > .sw-review__section--money { grid-column: 1 / -1; }
}

/* Кнопка «Сканировать паспорт»: тёмно-зелёная карточка с мини ID-картой, как табло итога */
.sales-wizard .sw-scan,
.sw-scan {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 84px !important;
    padding: 0.95rem 1rem 0.95rem 1.05rem;
    overflow: hidden;
    border: 0;
    border-radius: 18px;
    background:
        radial-gradient(120% 140% at 100% 0%, rgb(34 197 94 / 0.22), transparent 55%),
        #0f3b28;
    color: #fff;
    box-shadow: 0 1px 0 rgb(255 255 255 / 0.06) inset, 0 6px 18px rgb(15 59 40 / 0.18);
    transition: box-shadow 0.18s ease, transform 0.12s ease;
}
.sw-scan:hover { border-color: transparent; box-shadow: 0 1px 0 rgb(255 255 255 / 0.06) inset, 0 10px 26px rgb(15 59 40 / 0.26); }
.sw-scan:active { transform: scale(0.985); }
.sw-scan:focus-visible { outline: 3px solid #4ade80; outline-offset: 2px; }
.sw-scan__card { position: relative; flex-shrink: 0; display: block; width: 64px; height: 42px; }
.sw-scan__card svg { display: block; }
/* луч сканера проходит по карте один раз при появлении и при наведении */
.sw-scan__beam {
    position: absolute;
    left: -3px;
    right: -3px;
    top: 0;
    height: 2px;
    border-radius: 2px;
    background: #4ade80;
    box-shadow: 0 0 10px 2px rgb(74 222 128 / 0.65);
    opacity: 0;
}
.sw-scan:hover .sw-scan__beam,
.sales-wizard__panel.is-active .sw-scan__beam { animation: sw-scan-beam 1.6s ease-in-out 0.3s 1; }
@keyframes sw-scan-beam {
    0% { top: 0; opacity: 0; }
    15% { opacity: 1; }
    85% { opacity: 1; }
    100% { top: 40px; opacity: 0; }
}
.sw-scan__text { gap: 0.2rem; }
.sw-scan__text b { font-size: 1.02rem; font-weight: 700; letter-spacing: -0.01em; color: #fff; }
.sw-scan__text small { font-size: 0.8rem; line-height: 1.35; color: rgb(255 255 255 / 0.68); }
.sw-scan__go {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
    height: 40px;
    padding: 0 1rem;
    border-radius: 999px;
    background: #fff;
    color: #0f3b28;
    font-size: 0.88rem;
    font-weight: 700;
}
.sw-scan__go em { font-style: normal; }
/* на телефоне — только круглая кнопка с рамкой камеры */
@media (max-width: 559px) {
    .sales-wizard .sw-scan, .sw-scan { gap: 0.8rem; padding: 0.85rem 0.85rem 0.85rem 0.9rem; }
    .sw-scan__card, .sw-scan__card svg { width: 54px; height: 36px; }
    .sw-scan__go { width: 40px; padding: 0; justify-content: center; }
    .sw-scan__go em { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .sw-scan__beam { animation: none !important; }
}


/* ═══════════════════════════════════════════════════════════════
   BINO CORE · Стиль таблиц v2 (ЭТАЛОН) — страницы «Сотрудники» и «Клиенты»
   Принципы: таблица на всю ширину, без аватарок, без плашек-«пилюль»,
   статус = точка + текст, пустые значения — словами серым,
   деньги и числа — по правому краю, красным только сумма просрочки.
   ═══════════════════════════════════════════════════════════════ */
:root {
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --tbl-radius: 10px;
    --tbl-head-h: 40px;
    --tbl-row-pad-y: 0.75rem;
    --tbl-row-pad-x: 1rem;
}

/* ── Кнопки на этих страницах — плоские ── */
body:has(#emp-page) .btn--primary,
body:has(#crm-page) .btn--primary {
    background: var(--green-600);
    border-color: var(--green-600);
    color: var(--white);
    box-shadow: none;
}
body:has(#emp-page) .btn--primary:hover,
body:has(#crm-page) .btn--primary:hover {
    background: var(--green-700);
    border-color: var(--green-700);
}
body:has(#emp-page) .btn--outline,
body:has(#crm-page) .btn--outline {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    box-shadow: none;
}
body:has(#emp-page) .btn--outline:hover,
body:has(#crm-page) .btn--outline:hover {
    border-color: var(--gray-500);
    color: var(--gray-900);
}

/* ═════════════ СОТРУДНИКИ ═════════════ */
.emp-page {
    max-width: none;
    width: 100%;
}
.emp-grid {
    display: block;
    width: 100%;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--tbl-radius);
    overflow: hidden;
}
.emp-head,
.emp-card {
    display: grid;
    grid-template-columns: minmax(10rem, 1.4fr) minmax(7rem, 0.8fr) minmax(8rem, 0.9fr) minmax(10rem, 1.6fr) 2.5rem;
    align-items: center;
    column-gap: 1.5rem;
    padding: 0 var(--tbl-row-pad-x);
}
.emp-head {
    min-height: var(--tbl-head-h);
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-500);
}
.emp-card {
    position: relative;
    min-height: 3.25rem;
    padding-top: var(--tbl-row-pad-y);
    padding-bottom: var(--tbl-row-pad-y);
    background: var(--white);
    border: 0;
    border-bottom: 1px solid var(--gray-100);
    border-radius: 0;
    box-shadow: none;
    transition: background 0.12s;
}
.emp-card:last-child {
    border-bottom: 0;
}
.emp-card:hover {
    background: var(--gray-50);
    box-shadow: none;
    transform: none;
}
/* Ячейки берутся из .emp-card__body — растворяем обёртку в сетку */
.emp-card__body {
    display: contents;
}
.emp-card__avatar {
    display: none;
}
.emp-card__name {
    grid-column: 1;
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.emp-card__role,
.emp-card__role[class*="emp-card__role--"] {
    grid-column: 2;
    justify-self: start;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--gray-700);
}
.emp-card__phone {
    grid-column: 3;
    margin: 0;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--gray-700);
    font-variant-numeric: tabular-nums;
}
.emp-card__props {
    grid-column: 4;
    display: block;
    margin: 0;
    font-size: 0.875rem;
    color: var(--gray-700);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.emp-card__prop-badge,
.emp-card__prop-badge--all,
.emp-card__prop-badge--none {
    display: inline;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    font-size: inherit;
    color: inherit;
}
.emp-card__prop-badge:not(:last-child)::after {
    content: ", ";
}
.emp-card__prop-badge--all {
    color: var(--gray-500);
}
.emp-card__prop-badge--none {
    color: var(--danger);
}
.emp-card__settings-btn {
    grid-column: 5;
    position: static;
    justify-self: end;
    padding: 6px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--gray-400);
    background: none;
}
.emp-card__settings-btn:hover {
    background: var(--white);
    border-color: var(--gray-200);
    color: var(--gray-900);
}
.emp-empty {
    padding: 3rem 1rem;
    background: var(--white);
    border: 1px dashed var(--gray-300);
    border-radius: var(--tbl-radius);
}

/* Модалки сотрудников */
.emp-modal-overlay {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: none;
    transition: opacity 0.15s;
}
.emp-modal {
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-soft);
    transform: none;
    transition: none;
}
.emp-modal-overlay.is-open .emp-modal {
    transform: none;
}
.emp-modal__header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}
.emp-modal__title {
    font-size: 1rem;
    font-weight: 600;
}
.emp-modal__body {
    padding: 1.25rem;
}
.emp-modal__tabs {
    gap: 0.25rem;
    border-bottom: 1px solid var(--gray-200);
}
.emp-modal__tab {
    padding: 0.5rem 0.75rem;
    margin-bottom: -1px;
}
.emp-modal__actions {
    border-top: 1px solid var(--gray-200);
}
.emp-route-grid,
.emp-prop-grid {
    margin-bottom: 1.25rem;
}
.emp-route-item {
    border: 1px solid var(--gray-200);
    background: var(--white);
}
.emp-route-item:hover {
    border-color: var(--gray-300);
    background: var(--gray-50);
}
.emp-route-item:has(input:checked) {
    border-color: var(--gray-500);
    background: var(--white);
}
.emp-form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-700);
}
.emp-form-input {
    background-color: var(--white);
    border: 1px solid var(--gray-300);
    color: var(--gray-900);
}
.emp-form-input:focus {
    border-color: var(--gray-500);
    box-shadow: none;
}
.emp-toast {
    background: var(--gray-900);
    box-shadow: var(--shadow-soft);
    transform: none;
    transition: opacity 0.15s;
}
.emp-toast.is-visible {
    transform: none;
}
.emp-toast--error {
    background: var(--danger);
}

@media (max-width: 900px) {
    .emp-head {
        display: none;
    }
    .emp-card {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "name btn"
            "role btn"
            "phone btn"
            "props btn";
        row-gap: 0.15rem;
        align-items: start;
    }
    .emp-card__name { grid-area: name; }
    .emp-card__role,
    .emp-card__role[class*="emp-card__role--"] { grid-area: role; color: var(--gray-500); font-size: 0.8125rem; }
    .emp-card__phone { grid-area: phone; color: var(--gray-500); font-size: 0.8125rem; }
    .emp-card__props { grid-area: props; white-space: normal; font-size: 0.8125rem; }
    .emp-card__settings-btn { grid-area: btn; align-self: center; }
    .emp-modal { border: 0; }
}

/* ═════════════ КЛИЕНТЫ ═════════════ */
#crm-page .inst-page__bg {
    display: none;
}

/* Сводка — компактная строка слева, без растянутых пустых блоков */
#crm-page .inst-stats {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 1rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--tbl-radius);
    overflow: hidden;
}
#crm-page .inst-stat,
#crm-page .inst-stat--warn {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    min-width: 0;
    padding: 0.625rem 1.25rem;
    background: var(--white);
    border: 0;
    border-right: 1px solid var(--gray-200);
    border-radius: 0;
    box-shadow: none;
}
#crm-page .inst-stat:last-child {
    border-right: 0;
}
#crm-page .inst-stat__value {
    display: inline;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
}
#crm-page .inst-stat--warn .inst-stat__value {
    color: var(--danger);
}
#crm-page .inst-stat__label {
    font-size: 0.8125rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--gray-500);
}

/* Поиск */
#crm-page .inst-search {
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    box-shadow: none;
}
#crm-page .inst-search:focus-within {
    border-color: var(--gray-500);
    box-shadow: none;
}
#crm-page .inst-search__icon {
    color: var(--gray-400);
}

/* Таблица */
#crm-page .inst-table-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--tbl-radius);
    box-shadow: none;
    overflow: hidden;
}
#crm-page #crm-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}
#crm-page #crm-table th {
    height: var(--tbl-head-h);
    padding: 0 var(--tbl-row-pad-x);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--gray-500);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}
#crm-page #crm-table td {
    padding: var(--tbl-row-pad-y) var(--tbl-row-pad-x);
    font-size: 0.875rem;
    color: var(--gray-700);
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-100);
    background: transparent;
}
#crm-page #crm-table tbody tr:last-child td {
    border-bottom: 0;
}
#crm-page #crm-table tbody tr {
    cursor: pointer;
    transition: background 0.12s;
}
#crm-page #crm-table tbody tr:hover td,
#crm-page #crm-table tbody tr.is-active td {
    background: var(--gray-50) !important;
}
#crm-page .crm-col-client { width: 26%; }
#crm-page .crm-col-contracts { width: 28%; }
#crm-page .crm-col-property { width: 20%; }
#crm-page .crm-col-num { width: 9%; text-align: right; font-variant-numeric: tabular-nums; }
#crm-page .crm-col-debt { width: 17%; text-align: right; }

#crm-page .crm-cell__main {
    display: block;
    font-weight: 500;
    color: var(--gray-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#crm-page .crm-cell__sub {
    display: block;
    margin-top: 2px;
    font-size: 0.8125rem;
    color: var(--gray-500);
    font-variant-numeric: tabular-nums;
}
#crm-page .is-empty {
    color: var(--gray-400) !important;
    font-weight: 400 !important;
}
#crm-page .crm-contracts {
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
}
#crm-page .crm-contracts__more {
    margin-left: 0.375rem;
    font-size: 0.8125rem;
    color: var(--gray-500);
    white-space: nowrap;
}
#crm-page .crm-col-property {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#crm-page .crm-col-debt .inst-table__remaining {
    display: block;
    font-weight: 600;
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
#crm-page .crm-debt-flag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 2px;
    font-size: 0.75rem;
    color: var(--danger);
}
#crm-page .crm-debt-flag::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--danger);
}
/* Просрочка: строку не красим, красная только сумма */
#crm-page .inst-table__row--overdue td,
#crm-page .inst-table__row--overdue:hover td {
    color: var(--gray-700) !important;
    font-weight: 400;
    text-shadow: none !important;
}
#crm-page .inst-table__row--overdue .crm-col-debt .inst-table__remaining {
    color: var(--danger);
}
/* ── Сортировка по клику на заголовок (все колонки) ── */
.tbl-sort {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    text-align: inherit;
    cursor: pointer;
    white-space: nowrap;
}
.tbl-sort:hover,
.tbl-sort[data-sort="asc"],
.tbl-sort[data-sort="desc"] {
    color: var(--gray-900);
    background: none;
}
.tbl-sort:focus {
    outline: none;
}
.tbl-sort:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}
.tbl-sort__icon {
    flex-shrink: 0;
    color: var(--gray-400);
}
.tbl-sort__up,
.tbl-sort__down {
    opacity: 0;
}
.tbl-sort:hover .tbl-sort__up,
.tbl-sort:hover .tbl-sort__down {
    opacity: 0.6;
}
.tbl-sort[data-sort="asc"] .tbl-sort__icon,
.tbl-sort[data-sort="desc"] .tbl-sort__icon {
    color: var(--gray-900);
}
.tbl-sort[data-sort="asc"] .tbl-sort__up,
.tbl-sort[data-sort="desc"] .tbl-sort__down {
    opacity: 1;
}
.tbl-sort[data-sort="asc"] .tbl-sort__down,
.tbl-sort[data-sort="desc"] .tbl-sort__up {
    opacity: 0;
}
.crm-col-num .tbl-sort,
.crm-col-debt .tbl-sort {
    flex-direction: row-reverse;
}

/* ── Карточка клиента ── */
#crm-drawer-overlay {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: none;
    transition: opacity 0.15s;
}
#crm-drawer {
    box-shadow: none;
    border-left: 1px solid var(--gray-200);
    transition: transform 0.2s ease;
}
#crm-drawer .inst-drawer__head {
    border-bottom: 1px solid var(--gray-200);
}
@media (min-width: 641px) {
    #crm-drawer .inst-drawer__head {
        padding: 1rem 1.25rem;
    }
}
#crm-drawer .inst-drawer__eyebrow {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--gray-500);
}
#crm-drawer .inst-drawer__title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}
#crm-drawer .inst-drawer__sub {
    color: var(--gray-500);
}
#crm-drawer .inst-drawer__close {
    background: var(--white);
    border: 1px solid var(--gray-200);
    color: var(--gray-500);
}
#crm-drawer .inst-drawer__close:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}
#crm-drawer .inst-drawer__body {
    padding: 1.25rem;
}
#crm-drawer .crm-phone-edit__caption {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--gray-500);
}
#crm-drawer .crm-phone-edit__input {
    min-width: 11rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
}
#crm-drawer .crm-phone-edit__input:focus {
    border-color: var(--gray-500);
    box-shadow: none;
}
#crm-drawer .inst-detail__section {
    margin-bottom: 1.5rem;
}
#crm-drawer .inst-detail__section-title {
    font-size: 0.9375rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--gray-900);
}
#crm-drawer .inst-dl__dt {
    color: var(--gray-500);
}
#crm-drawer .inst-dl__dd {
    color: var(--gray-900);
    font-weight: 400;
}

/* Статусы: точка + текст, без плашек */
#crm-drawer .crm-status-chip,
#crm-drawer .crm-status-chip[class*="crm-status-chip--"] {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--gray-700);
    white-space: nowrap;
}
#crm-drawer .crm-status-chip::before {
    content: "";
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gray-400);
}
#crm-drawer .crm-status-chip.crm-status-chip--installment::before { background: var(--green-500); }
#crm-drawer .crm-status-chip.crm-status-chip--sold::before { background: var(--green-800); }
#crm-drawer .crm-status-chip.crm-status-chip--reserved::before,
#crm-drawer .crm-status-chip.crm-status-chip--reassignment::before { background: var(--gray-700); }
#crm-drawer .crm-status-chip.crm-status-chip--overdue { color: var(--danger); }
#crm-drawer .crm-status-chip.crm-status-chip--overdue::before { background: var(--danger); }
#crm-drawer .crm-status-chips {
    gap: 0.5rem 1.25rem;
}
#crm-drawer .crm-units-summary {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
}
#crm-drawer .crm-units-summary__total {
    color: var(--gray-700);
}

/* Сделки — список строк вместо узкой таблицы на 6 колонок */
#crm-drawer .crm-deals-totals {
    color: var(--gray-500);
}
#crm-drawer .crm-deals-totals strong {
    color: var(--gray-900);
}
#crm-drawer .crm-deals-totals__debt,
#crm-drawer .crm-deals-totals__debt strong {
    color: var(--danger);
    font-weight: 600;
}
#crm-drawer .crm-deals-table-wrap {
    overflow: hidden;
    border: 1px solid var(--gray-200);
    border-radius: var(--tbl-radius);
    background: var(--white);
}
#crm-drawer .crm-deals-table,
#crm-drawer .crm-deals-table tbody {
    display: block;
    width: 100%;
}
#crm-drawer .crm-deals-table thead {
    display: none;
}
#crm-drawer .crm-deals-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "contract debt"
        "place    action"
        "status   action";
    column-gap: 1rem;
    row-gap: 0.2rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--gray-100);
}
#crm-drawer .crm-deals-table tr:last-child {
    border-bottom: 0;
}
#crm-drawer .crm-deals-table td,
#crm-drawer .crm-deals-row--overdue td,
#crm-drawer .crm-deals-row--overdue:hover td {
    display: block;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--gray-500) !important;
    text-shadow: none !important;
}
#crm-drawer .crm-deals-table td::before {
    display: none !important;
}
#crm-drawer .crm-deals-table td:nth-child(1) {
    grid-area: contract;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}
#crm-drawer .crm-deals-table td:nth-child(1) strong {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
}
#crm-drawer .crm-deals-table td:nth-child(1) strong::before {
    content: "Договор ";
    font-weight: 400;
    color: var(--gray-500);
}
#crm-drawer .crm-deals-table td:nth-child(1) .inst-table__muted {
    display: inline;
    font-size: 0.75rem;
    color: var(--gray-400);
}
#crm-drawer .crm-deals-table td:nth-child(2) {
    grid-area: place;
    color: var(--gray-700) !important;
}
#crm-drawer .crm-deals-table td:nth-child(3) {
    grid-area: status;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
#crm-drawer .crm-deals-table td:nth-child(4) {
    display: none;
}
#crm-drawer .crm-deals-table td.crm-deals-row__debt {
    grid-area: debt;
    justify-self: end;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: var(--gray-900) !important;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
#crm-drawer .crm-deals-table .crm-deals-row--overdue td.crm-deals-row__debt {
    color: var(--danger) !important;
}
#crm-drawer .crm-deals-table td.crm-deals-row__debt .is-empty {
    font-weight: 400;
    color: var(--gray-400);
}
#crm-drawer .crm-deals-table td.crm-deals-row__action:empty {
    display: none;
}
#crm-drawer .crm-deals-row__action {
    grid-area: action;
    justify-self: end;
    align-self: end;
}
#crm-drawer .crm-deal-link {
    padding: 0.25rem 0.625rem !important;
    font-size: 0.75rem !important;
}

/* ── Клиенты: мобильная версия ── */
@media (max-width: 768px) {
    #crm-page .inst-stats {
        display: flex;
    }
    #crm-page .inst-stat,
    #crm-page .inst-stat--warn {
        flex: 1 1 0;
        flex-direction: column;
        gap: 0;
        padding: 0.625rem 0.875rem;
    }
    #crm-page .crm-table-card {
        background: var(--white);
        border: 1px solid var(--gray-200);
        border-radius: var(--tbl-radius);
        overflow: hidden;
        margin: 0;
    }
    #crm-page .inst-table-wrap {
        overflow: visible;
        margin: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
    #crm-page #crm-table {
        min-width: 0;
        width: 100%;
        table-layout: auto;
    }
    #crm-page #crm-table thead {
        display: none;
    }
    #crm-page #crm-table tbody tr,
    #crm-page #crm-table tbody tr.inst-table__row--overdue {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "client debt"
            "contracts contracts";
        gap: 0.25rem 0.75rem;
        padding: 0.75rem 1rem;
        border: 0 !important;
        border-bottom: 1px solid var(--gray-100) !important;
        background: var(--white) !important;
    }
    #crm-page #crm-table tbody tr:last-child {
        border-bottom: 0;
    }
    #crm-page #crm-table td {
        display: block;
        width: auto;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        white-space: normal;
    }
    #crm-page #crm-table td::before {
        display: none !important;
    }
    #crm-page #crm-table .crm-col-client { grid-area: client; }
    #crm-page #crm-table .crm-col-debt { grid-area: debt; }
    #crm-page #crm-table .crm-col-contracts { grid-area: contracts; font-size: 0.8125rem; }
    #crm-page #crm-table .crm-col-property,
    #crm-page #crm-table .crm-col-num {
        display: none;
    }

    #crm-drawer .inst-drawer__head {
        position: sticky;
        flex-wrap: wrap;
        padding: 1.25rem 3.5rem 0.875rem 1rem;
    }
    #crm-drawer .inst-drawer__head::before {
        position: absolute;
        top: 0.45rem;
        left: 50%;
        margin: 0;
        transform: translateX(-50%);
    }
    #crm-drawer .inst-drawer__close {
        position: absolute;
        top: 1rem;
        right: 1rem;
    }
    #crm-drawer .crm-drawer__head-actions {
        margin-right: -2.5rem;
    }
    #crm-drawer .inst-drawer__body {
        padding: 1rem;
    }
}
/* История сделок клиента (переоформлено другому, возврат, закрытая бронь) */
#crm-drawer .crm-history__list {
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--gray-200);
    border-radius: var(--tbl-radius);
    background: var(--white);
}
#crm-drawer .crm-history__row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
}
#crm-drawer .crm-history__row:last-child {
    border-bottom: 0;
}
#crm-drawer .crm-history__main {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
#crm-drawer .crm-history__contract {
    font-size: 0.8125rem;
    color: var(--gray-500);
}
#crm-drawer .crm-history__contract strong {
    font-weight: 500;
    color: var(--gray-700);
}
#crm-drawer .crm-history__date,
#crm-drawer .crm-history__place {
    font-size: 0.75rem;
    color: var(--gray-400);
}
#crm-drawer .crm-history__reason {
    flex-shrink: 0;
    max-width: 50%;
    font-size: 0.75rem;
    color: var(--gray-500);
    text-align: right;
}
/* ===== /Стиль таблиц v2 ===== */

/* ═══════════════════════════════════════════════════════════════
   ШАХМАТКА · Масштаб (ползунок + / −)
   Шахматка уменьшается целиком и пропорционально (transform: scale из chessboard-zoom.js),
   текст в ячейках сохраняется. Ничего не сохраняется между загрузками.
   ═══════════════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════
   ШАХМАТКА · Один общий белый фон на всю шахматку
   Блоки внутри без своих подложек: название + черта под ним + тонкая линия слева.
   ═══════════════════════════════════════════════════════════════ */
#cb-stage .chessboard-map-wrap {
    padding: 1rem 1rem 0.75rem 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
}
#cb-stage .chessboard-map__corner,
#cb-stage .chessboard-map__row-head {
    background: #fff;
    box-shadow: -2px 0 0 #fff;
}
#cb-stage .chessboard-map__col-head,
#cb-stage .chessboard-map__cell,
#cb-stage .chessboard-map__cell--commercial {
    background: transparent;
    border-radius: 0;
    border-left: 1px solid #e2e8f0;
}
#cb-stage .chessboard-map__col-head {
    padding-top: 0.25rem;
    padding-bottom: 0.6rem;
    margin-bottom: calc(var(--cb-unit-gap) / 2);
    box-shadow: inset 0 -1px 0 #e2e8f0;
}
#cb-stage .chessboard-map__block-name {
    color: #0f172a;
}
#cb-stage .chessboard-map__entrance-name {
    color: #64748b;
}
#cb-stage .chessboard-map__cell--last {
    border-radius: 0;
}
#cb-stage .chessboard-map__ground {
    height: 1px;
    margin-top: 0.75rem;
    border-radius: 0;
    background: #e2e8f0;
}
@media (max-width: 768px) {
    #cb-stage .chessboard-map-wrap {
        padding: 0.75rem 0.5rem 0.5rem 0;
        border-radius: 12px;
    }
}

/* При уменьшении колонка этажей «прилипает» через JS (--cb-sticky-x), т.к. sticky внутри transform смещается */
#cb-stage.cb-zoomed .chessboard-map__corner,
#cb-stage.cb-zoomed .chessboard-map__row-head {
    position: relative;
    left: auto;
    transform: translateX(var(--cb-sticky-x, 0px));
}

/* ── Ползунок: строкой под поиском ── */
.cb-head__tools:has(#cb-zoom) {
    flex-wrap: wrap;
    justify-content: flex-end;
}
.cb-head__tools > .cb-zoom {
    flex: 1 0 100%;
}

.cb-zoom {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 22rem;
    margin-top: 0.25rem;
    margin-left: auto;
    user-select: none;
}
.cb-zoom[hidden] {
    display: none;
}
/* Жесты внутри ползунка не прокручивают страницу */
.cb-zoom {
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}
@media (pointer: coarse) {
    .cb-zoom__btn {
        width: 2.75rem;
        height: 2.75rem;
        font-size: 1.35rem;
    }
    .cb-zoom__range {
        height: 2.75rem;
    }
    .cb-zoom__range::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
        margin-top: -11px;
    }
    .cb-zoom__range::-moz-range-thumb {
        width: 22px;
        height: 22px;
    }
}
.cb-zoom__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    font: inherit;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}
.cb-zoom__btn:hover:not(:disabled) {
    border-color: #64748b;
    color: #0f172a;
}
.cb-zoom__btn:disabled {
    color: #cbd5e1;
    cursor: default;
}
.cb-zoom__btn:focus {
    outline: none;
}
.cb-zoom__btn:focus-visible {
    border-color: #0f172a;
}
.cb-zoom__range {
    --cb-zoom-fill: 0%;
    flex: 1 1 auto;
    min-width: 6rem;
    height: 1.5rem;
    margin: 0;
    background: transparent;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}
.cb-zoom__range:focus {
    outline: none;
}
/* Линия: слева тёмная часть до кружка, справа светлая */
.cb-zoom__range::-webkit-slider-runnable-track {
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(to right, #64748b var(--cb-zoom-fill), #e2e8f0 var(--cb-zoom-fill));
}
.cb-zoom__range::-moz-range-track {
    height: 2px;
    border-radius: 2px;
    background: #e2e8f0;
}
.cb-zoom__range::-moz-range-progress {
    height: 2px;
    border-radius: 2px;
    background: #64748b;
}
.cb-zoom__range::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
    margin-top: -7px;
    border: 1.5px solid #64748b;
    border-radius: 50%;
    background: #fff;
    -webkit-appearance: none;
    appearance: none;
}
.cb-zoom__range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 1.5px solid #64748b;
    border-radius: 50%;
    background: #fff;
}
.cb-zoom__range:focus-visible::-webkit-slider-thumb {
    border-color: #0f172a;
}
.cb-zoom__range:focus-visible::-moz-range-thumb {
    border-color: #0f172a;
}
.cb-zoom__value {
    flex-shrink: 0;
    min-width: 2.75rem;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 0.8125rem;
    color: #64748b;
    text-align: right;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}
.cb-zoom__value:hover {
    color: #0f172a;
}
.cb-zoom__value:focus {
    outline: none;
}
@media (max-width: 768px) {
    .cb-zoom {
        max-width: none;
        margin-top: 0.5rem;
    }
}
/* ===== /Шахматка · Масштаб ===== */

/* ═══════════════════════════════════════════════════════════════
   ШАХМАТКА · Телефон: фокус на шахматке, фильтры под кнопкой
   (логика — public/js/chessboard-filters-mobile.js)
   ═══════════════════════════════════════════════════════════════ */
.cb-filters-btn,
.cb-head__break {
    display: none;
}
@media (max-width: 768px) {
    /* Заголовок «Шахматка» не нужен — освобождаем место */
    body:has(#chessboard-page) .app-content__head {
        display: none;
    }
    .cb-head {
        margin-bottom: 0.75rem;
    }
    .cb-head__break {
        display: block;
        flex: 0 0 100%;
        height: 0;
    }
    .cb-head__tools > .cb-zoom {
        flex: 1 1 0;
        min-width: 0;
        margin-top: 0;
    }
    .cb-filters-btn {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        flex: 0 0 auto;
        height: 2.75rem;
        padding: 0 0.85rem;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        background: #fff;
        color: #0f172a;
        font: inherit;
        font-size: 0.875rem;
        font-weight: 500;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: border-color 0.2s ease, background-color 0.2s ease;
    }
    .cb-filters-btn.is-open {
        border-color: #0f172a;
    }
    .cb-filters-btn:focus {
        outline: none;
    }
    .cb-filters-btn:focus-visible {
        border-color: #0f172a;
    }
    .cb-filters-btn__count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 1.25rem;
        height: 1.25rem;
        padding: 0 0.35rem;
        border-radius: 999px;
        background: #0f172a;
        color: #fff;
        font-size: 0.72rem;
        font-weight: 600;
        font-variant-numeric: tabular-nums;
    }
    .cb-filters-btn__count[hidden] {
        display: none;
    }
    /* Компактный ползунок рядом с кнопкой */
    .cb-zoom {
        gap: 0.35rem;
    }
    .cb-zoom__btn {
        width: 2.5rem;
        height: 2.75rem;
    }
    .cb-zoom__value {
        min-width: 2.4rem;
        font-size: 0.75rem;
    }
    /* Встряхивание кнопки после того, как фильтры свернулись (как уведомление) */
    .cb-filters-btn.is-nudge {
        animation: cb-filters-nudge 0.75s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
        border-color: #0f172a;
    }
    .cb-filters-btn.is-nudge svg {
        animation: cb-filters-nudge-icon 0.75s ease both;
    }
    @keyframes cb-filters-nudge {
        0% { transform: none; }
        12% { transform: scale(1.08); }
        24% { transform: scale(1.08) rotate(-5deg); }
        38% { transform: scale(1.06) rotate(5deg); }
        52% { transform: scale(1.04) rotate(-3deg); }
        66% { transform: scale(1.02) rotate(2deg); }
        80% { transform: rotate(-1deg); }
        100% { transform: none; }
    }
    @keyframes cb-filters-nudge-icon {
        0%, 100% { transform: none; }
        30% { transform: translateY(-2px); }
        60% { transform: translateY(1px); }
    }
    /* Свёрнутые фильтры не занимают места и не ловят нажатия */
    .cb-collapsed {
        pointer-events: none;
    }
}
/* ===== /Шахматка · Телефон ===== */

/* ===== Шторки сверки и клиента на телефоне (clean) ===== */
/* Верх шторки — ниже шапки сайта с учётом выреза/строки состояния (сайт открывают и как приложение
   с главного экрана): номер договора и «×» всегда видны. Прокручивается только содержимое,
   внизу запас под полосу жестов iPhone — список листается до конца. */
@media (max-width: 768px) {
    .inst-drawer.inst-drawer--sheet:not([hidden]) {
        display: flex;
        flex-direction: column;
        top: calc(max(0.5rem, env(safe-area-inset-top, 0px)) + 3.4rem) !important;
        bottom: 0 !important;
        height: auto;
        max-height: none;
        padding-bottom: 0;
        overflow: hidden;
        overscroll-behavior: contain;
    }
    .inst-drawer.inst-drawer--sheet .inst-drawer__head,
    #crm-drawer.inst-drawer--sheet .inst-drawer__head {
        position: relative;
        top: auto;
        z-index: 1;
        flex-shrink: 0;
    }
    .inst-drawer.inst-drawer--sheet .inst-drawer__body {
        flex: 1 1 auto;
        min-height: 0;
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }
    /* анимация появления страницы прятала шторку под верхнюю панель сайта */
    body:has(.inst-drawer--sheet:not([hidden])) .app-content {
        overflow: hidden;
        animation: none;
    }
}
/* ===== /Шторки на телефоне ===== */

/* ===== Документы на сервере (clean) ===== */
/* Слева дерево папок (+ / −), справа таблица файлов. Только чтение. */
#doc-srv {
    display: grid;
    grid-template-columns: minmax(20rem, 34rem) minmax(0, 1fr);
    height: calc(100dvh - 11rem);
    min-height: 30rem;
    margin: 1rem 1.25rem 1.5rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
}
#doc-srv .dsf__tree-pane {
    min-height: 0;
    padding: 0.75rem 0.5rem 1rem;
    background: var(--gray-50);
    border-right: 1px solid var(--gray-200);
    overflow-y: auto;
}
#doc-srv .dsf__pane-title {
    margin: 0 0 0.35rem;
    padding: 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-500);
}
#doc-srv .dsf__tree,
#doc-srv .dsf-node__group {
    margin: 0;
    padding: 0;
    list-style: none;
}
#doc-srv .dsf-node__row {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    padding-left: calc(var(--dsf-level, 0) * 1.25rem);
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}
#doc-srv .dsf-node__row:hover { background: var(--gray-100); }
#doc-srv .dsf-node__row.is-active { background: var(--green-50); }
#doc-srv .dsf-node__row.is-active .dsf-node__name { color: var(--green-800); }
#doc-srv .dsf-node__toggle {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: none;
    font: inherit;
    font-size: 1.15rem;
    line-height: 1;
    color: var(--gray-700);
    cursor: pointer;
}
#doc-srv .dsf-node__toggle:hover { background: var(--gray-200); }
#doc-srv .dsf-node__toggle--none { cursor: default; }
#doc-srv .dsf-node__main {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
    min-height: 2.5rem;
    padding: 0.35rem 0.6rem 0.35rem 0.15rem;
    border: 0;
    background: none;
    font: inherit;
    text-align: left;
    color: var(--gray-900);
    cursor: pointer;
}
#doc-srv .dsf-node__toggle:focus-visible,
#doc-srv .dsf-node__main:focus-visible {
    outline: 2px solid var(--green-600);
    outline-offset: -2px;
    border-radius: 6px;
}
#doc-srv .dsf-node__name {
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#doc-srv .dsf-node__meta {
    flex-shrink: 0;
    font-size: 0.8125rem;
    color: var(--gray-500);
    font-variant-numeric: tabular-nums;
}
/* тонкая линия слева от вложенных папок — видно, что внутри чего */
#doc-srv .dsf-node__group { position: relative; }
#doc-srv .dsf-node__group::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0.4rem;
    left: calc(var(--dsf-line, 0) * 1.25rem + 0.875rem);
    border-left: 1px solid var(--gray-200);
}
#doc-srv .dsf-node__loading {
    padding: 0.35rem 0 0.35rem 3.5rem;
    font-size: 0.8125rem;
    color: var(--gray-400);
}
#doc-srv .dsf-ico { flex-shrink: 0; }
#doc-srv .dsf-ico--folder { color: var(--green-600); }
#doc-srv .dsf-ico--file { color: var(--gray-500); }
#doc-srv .dsf__tree-status {
    margin: 0.5rem;
    font-size: 0.8125rem;
    color: var(--gray-500);
}
#doc-srv .is-error { color: var(--danger); }

#doc-srv .dsf__files-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
}
#doc-srv .dsf__files-head {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--white);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--gray-200);
}
#doc-srv .dsf__back { display: none; }
#doc-srv .dsf__files-titles { flex: 1; min-width: 12rem; }
#doc-srv .dsf__files-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}
#doc-srv .dsf__files-path {
    margin: 0.1rem 0 0;
    font-size: 0.8125rem;
    color: var(--gray-500);
}
#doc-srv .dsf__search {
    position: relative;
    display: flex;
    align-items: center;
    width: min(100%, 18rem);
    color: var(--gray-400);
}
#doc-srv .dsf__search svg {
    position: absolute;
    left: 0.75rem;
    pointer-events: none;
}
#doc-srv .dsf__search input {
    width: 100%;
    height: 2.5rem;
    padding: 0 0.75rem 0 2.25rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    font: inherit;
    font-size: 0.875rem;
    color: var(--gray-900);
    transition: border-color 0.15s, box-shadow 0.15s;
}
#doc-srv .dsf__search input:focus {
    outline: none;
    border-color: var(--green-600);
    box-shadow: 0 0 0 3px var(--green-100);
}
#doc-srv .dsf__table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
#doc-srv .dsf__table[hidden] { display: none; }
#doc-srv .dsf__table th {
    height: 40px;
    padding: 0 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: left;
    color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
}
#doc-srv .dsf__table td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}
#doc-srv .dsf__col-size { width: 7rem; text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
#doc-srv th.dsf__col-size .tbl-sort { flex-direction: row-reverse; }
#doc-srv .dsf__col-date { width: 10rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
#doc-srv .dsf__col-act { width: 3.5rem; text-align: right; }
#doc-srv .dsf-row { cursor: pointer; transition: background 0.15s; }
#doc-srv .dsf-row:hover { background: var(--gray-50); }
#doc-srv .dsf-row:focus-visible { outline: 2px solid var(--green-600); outline-offset: -2px; }
#doc-srv .dsf-row__name {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}
#doc-srv .dsf-row__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
#doc-srv .dsf-row__main {
    font-weight: 500;
    color: var(--gray-900);
    overflow-wrap: anywhere;
}
#doc-srv .dsf-row__sub { font-size: 0.8125rem; color: var(--gray-500); }
#doc-srv .dsf-row__dl {
    display: inline-grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    color: var(--gray-700);
    background: var(--white);
}
#doc-srv .dsf-row__dl:hover { border-color: var(--green-600); color: var(--green-700); }
#doc-srv .dsf-row__dl:focus-visible { outline: 2px solid var(--green-600); outline-offset: 2px; }
#doc-srv .dsf__status {
    margin: 0;
    padding: 2.5rem 1rem;
    font-size: 0.875rem;
    text-align: center;
    color: var(--gray-400);
}

@media (max-width: 768px) {
    /* телефон: сначала папки, после выбора — файлы с кнопкой «‹ Папки» */
    #doc-srv {
        display: block;
        height: auto;
        min-height: 0;
        margin: 0.5rem 0 1rem;
    }
    #doc-srv .dsf__files-pane { overflow: visible; }
    #doc-srv .dsf__tree-pane { border-right: 0; background: var(--white); }
    #doc-srv .dsf__files-pane { display: none; }
    #doc-srv.is-files .dsf__tree-pane { display: none; }
    #doc-srv.is-files .dsf__files-pane { display: flex; }
    #doc-srv .dsf-node__main { padding-top: 0.55rem; padding-bottom: 0.55rem; }
    #doc-srv .dsf-node__toggle { width: 2.5rem; height: 2.75rem; }
    #doc-srv .dsf-node__group::before { left: calc(var(--dsf-line, 0) * 1.25rem + 1.25rem); }
    #doc-srv .dsf__files-head { padding: 0.75rem; }
    #doc-srv .dsf__back {
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
        height: 2.5rem;
        padding: 0 0.75rem 0 0.5rem;
        border: 1px solid var(--gray-200);
        border-radius: var(--radius-sm);
        background: var(--white);
        font: inherit;
        font-size: 0.875rem;
        color: var(--gray-700);
        cursor: pointer;
    }
    #doc-srv .dsf__search { order: 3; width: 100%; }
    #doc-srv .dsf__search input { height: 2.75rem; font-size: 16px; }
    #doc-srv .dsf__table thead { display: none; }
    #doc-srv .dsf__table,
    #doc-srv .dsf__table tbody { display: block; }
    #doc-srv .dsf-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem;
        border-bottom: 1px solid var(--gray-100);
    }
    #doc-srv .dsf__table td { display: block; width: auto; padding: 0; border: 0; }
    #doc-srv .dsf__table td.dsf__col-date { display: none; }
    #doc-srv .dsf__col-size { font-size: 0.8125rem; color: var(--gray-500); }
}
/* окно просмотра документа: затемнение, панель с листом A4 */
#doc-srv .dsf-row.is-missing { cursor: default; }
#doc-srv .dsf-row.is-missing .dsf-row__main { color: var(--gray-500); }
#doc-srv .dsf-row.is-missing .dsf-row__sub { color: var(--gray-400); }
#doc-srv .dsf-row.is-missing:hover { background: none; }
html.dsf-open,
html.dsf-open body { overflow: hidden; }
.dsf-viewer {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.4);
}
.dsf-viewer[hidden] { display: none; }
.dsf-viewer__panel {
    display: flex;
    flex-direction: column;
    width: min(64rem, 100%);
    height: min(100%, 60rem);
    overflow: hidden;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}
.dsf-viewer__bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    padding: 0.75rem 0.75rem 0.75rem 1rem;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
}
.dsf-viewer__icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-sm);
    background: var(--green-50);
    color: var(--green-700);
}
.dsf-viewer__titles { flex: 1; min-width: 0; }
.dsf-viewer__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dsf-viewer__meta {
    margin: 0.1rem 0 0;
    font-size: 0.8125rem;
    color: var(--gray-500);
}
.dsf-viewer__download {
    flex-shrink: 0;
    gap: 0.4rem;
    border-width: 1px;
    box-shadow: none;
}
.dsf-viewer__download:hover { transform: none; box-shadow: none; }
.dsf-viewer__close {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--gray-500);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.dsf-viewer__close:hover { background: var(--gray-50); color: var(--gray-900); }
.dsf-viewer__close:focus-visible,
.dsf-viewer__download:focus-visible { outline: 2px solid var(--green-600); outline-offset: 2px; }
.dsf-viewer__desk {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 1.5rem 1rem 2rem;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.dsf-viewer__status {
    max-width: 32rem;
    margin: 3rem auto;
    padding: 1rem 1.25rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    font-size: 0.9rem;
    text-align: center;
    color: var(--gray-700);
}
.dsf-viewer__status.is-error { color: var(--danger); }
.dsf-viewer__status[hidden] { display: none; }
.dsf-viewer__page.doc-preview-content {
    border: 1px solid var(--gray-200);
    border-radius: 0;
    box-shadow: var(--shadow-soft);
}
.dsf-viewer__page:empty { display: none; }
@media (max-width: 768px) {
    .dsf-viewer { padding: 0; }
    .dsf-viewer__panel {
        width: 100%;
        height: 100%;
        border: 0;
        border-radius: 0;
    }
    .dsf-viewer__bar {
        padding: max(0.6rem, env(safe-area-inset-top, 0px)) 0.6rem 0.6rem 0.75rem;
        gap: 0.5rem;
    }
    .dsf-viewer__icon { display: none; }
    .dsf-viewer__download { padding: 0 0.7rem; min-height: 2.5rem; }
    .dsf-viewer__desk { padding: 0.75rem 0.5rem calc(1.5rem + env(safe-area-inset-bottom, 0px)); }
    .dsf-viewer__page.doc-preview-content { padding: 1.25rem 1rem; font-size: 11pt; }
}
/* лист как в окне просмотра продажи: А4 книжная, поля как в DOCX */
.dsf-viewer__page.dsf-sheet {
    box-sizing: border-box;
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    padding: 10.58mm 15.88mm;
    border: 1px solid var(--gray-200);
    background: var(--white);
    box-shadow: var(--shadow-soft);
}
.dsf-viewer__page.dsf-sheet.dsf-sheet--landscape {
    width: 297mm;
    min-height: 210mm;
    padding: 6.35mm 8.82mm;
}
/* чек КО-1: книжный лист с узкими полями */
.dsf-viewer__page.dsf-sheet.dsf-sheet--receipt { padding: 4.94mm 7.06mm; }
.dsf-viewer__page.is-editing {
    border-color: var(--green-600);
    box-shadow: 0 0 0 3px var(--green-100);
    outline: none;
    cursor: text;
}
.dsf-viewer__download:disabled { opacity: 0.5; cursor: default; }
@media (max-width: 480px) {
    .dsf-viewer__btn-label { display: none; }
    .dsf-viewer__desk:has(.dsf-sheet) { padding-left: 0.25rem; padding-right: 0.25rem; }
}
/* ===== /Документы на сервере ===== */

/* ===== Админка как приложение на телефоне (clean) ===== */
/* Открыта с главного экрана: меню, низ страницы и окна не заходят под вырез и полосу жестов. */
.pa-toast {
    top: max(1rem, calc(env(safe-area-inset-top, 0px) + 0.5rem));
}
@media (max-width: 900px) {
    .pa-sidebar {
        padding-top: max(1rem, env(safe-area-inset-top, 0px));
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
        padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
    }
    .pa-topbar {
        padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
        padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
    }
    .pa-content {
        padding-left: max(1rem, env(safe-area-inset-left, 0px));
        padding-right: max(1rem, env(safe-area-inset-right, 0px));
        padding-bottom: calc(3rem + env(safe-area-inset-bottom, 0px));
    }
    .pa-shell--guest .pa-content {
        padding-top: max(1.25rem, env(safe-area-inset-top, 0px));
    }
}
@media (max-width: 560px) {
    .pa-modal__foot {
        padding-bottom: calc(1.35rem + env(safe-area-inset-bottom, 0px));
    }
}
/* ===== /Админка как приложение ===== */

/* ===== Сканер паспорта: фото из галереи (clean) ===== */
.pscam__live {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}
.pscam__live .pscam__shutter { grid-column: 2; }
.pscam__gallery {
    grid-column: 1;
    justify-self: center;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: rgb(255 255 255 / 0.14);
    color: var(--white);
    cursor: pointer;
    transition: background 0.15s;
}
.pscam__gallery:hover { background: rgb(255 255 255 / 0.24); }
.pscam__gallery:focus-within { outline: 3px solid var(--green-500); outline-offset: 3px; }
/* ===== /Сканер паспорта: фото из галереи ===== */

/* ===== Продажи: документы по объекту (clean) ===== */
.sh-docs {
    margin: 0 0 1.5rem;
    padding: 16px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
}
.sh-docs .sh-recent__title { margin-bottom: 4px; }
.sh-docs__text { margin: 0 0 12px; font-size: 13px; color: var(--gray-500); }
.sh-docs__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sh-docs__property { font-size: 14px; font-weight: 500; color: var(--gray-900); margin-right: 4px; }
.sh-docs__select {
    height: 40px;
    min-width: 180px;
    padding: 0 12px;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 14px;
    color: var(--gray-900);
}
.sh-docs__select:focus { outline: none; border-color: var(--green-600); box-shadow: 0 0 0 3px var(--green-100); }
.sh-docs__status { margin: 10px 0 0; font-size: 13px; color: var(--gray-700); font-variant-numeric: tabular-nums; }
.sh-docs__status:empty { display: none; }
.sh-docs__errors { margin: 8px 0 0; padding: 0 0 0 18px; font-size: 13px; color: var(--danger); }
@media (max-width: 768px) {
    .sh-docs__row .btn, .sh-docs__select { width: 100%; }
}
/* ===== /Продажи: документы по объекту ===== */

/* ===== Продажи: доп. соглашение — смена квартиры на шахматке (clean) ===== */
.sh-mode--exchange { --sh-bg: var(--green-50); --sh-ink: var(--green-800); }
.sales-ws-mode-badge--exchange { background: var(--green-50); color: var(--green-800); }

/* шаг 1 — выделены квартиры клиентов, шаг 2 — свободные */
.sales-workspace--exchange .cb-unit,
.sales-workspace--exchange .cb-list__unit { transition: opacity 0.2s, background-color 0.2s, color 0.2s; }
.sales-workspace--exchange:not(.sx-picking) .cb-unit--available,
.sales-workspace--exchange:not(.sx-picking) .cb-list__unit--available { opacity: 0.4; }
.sales-workspace--exchange.sx-picking .cb-unit:not(.cb-unit--available):not(.sx-from),
.sales-workspace--exchange.sx-picking .cb-list__unit:not(.cb-list__unit--available):not(.sx-from) { opacity: 0.3; }
.sales-workspace--exchange .sx-from { outline: 2px solid var(--gray-900); outline-offset: 2px; }
.sales-workspace--exchange .sx-to { outline: 2px solid var(--green-600); outline-offset: 2px; }
.sales-workspace--exchange .cb-unit.sx-done,
.sales-workspace--exchange .cb-list__unit.sx-done { opacity: 1; outline: 2px solid var(--gray-300); outline-offset: 2px; }

/* подсказка снизу */
.sx-bar {
    position: fixed; left: 50%; bottom: 16px; z-index: 140;
    display: flex; align-items: center; gap: 16px;
    width: min(560px, calc(100% - 24px)); box-sizing: border-box;
    padding: 12px 16px; background: var(--white);
    border: 1px solid var(--gray-200); border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    transform: translate(-50%, calc(100% + 24px));
    transition: transform 0.2s ease-out;
}
.sx-bar.is-open { transform: translate(-50%, 0); }
.sx-bar[hidden] { display: none; }
.sx-bar__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.sx-bar__title { font-size: 14px; font-weight: 500; color: var(--gray-900); }
.sx-bar__sub { font-size: 13px; color: var(--gray-500); }
.sales-workspace--exchange.is-detail .sx-bar { display: none; }

/* панель расчёта */
.sx-pane { display: flex; flex-direction: column; gap: 12px; padding-bottom: 16px; }
.sx-pane__head { display: flex; justify-content: space-between; align-items: center; }
.sx-pane__title { margin: 0; font-size: 16px; font-weight: 600; color: var(--gray-900); }
.sx-pane__close {
    width: 32px; height: 32px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
    background: var(--white); color: var(--gray-500); font-size: 20px; line-height: 1; cursor: pointer;
}
.sx-pane__close:hover { color: var(--gray-900); border-color: var(--gray-300); }
.sx-muted { margin: 0; font-size: 13px; color: var(--gray-500); }
.sx-swap { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sx-swap__item {
    display: flex; flex-direction: column; gap: 2px; padding: 10px 12px;
    border: 1px solid var(--gray-200); border-radius: var(--radius-sm); background: var(--white);
}
.sx-swap__item--to { border-color: var(--green-600); }
.sx-swap__label { font-size: 12px; color: var(--gray-500); }
.sx-swap__unit { font-size: 14px; font-weight: 500; color: var(--gray-900); }
.sx-swap__price { font-size: 13px; color: var(--gray-700); font-variant-numeric: tabular-nums; }
.sx-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.sx-fields[hidden] { display: none; }
.sx-pane { min-width: 0; max-width: 100%; box-sizing: border-box; }
.sx-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 13px; color: var(--gray-700); }
.sx-field small { font-size: 12px; color: var(--gray-500); }
.sx-field input, .sx-field textarea {
    width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; padding: 8px 10px; font: inherit; font-size: 14px;
    color: var(--gray-900); background: var(--white);
    border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
}
.sx-field input:focus, .sx-field textarea:focus {
    outline: none; border-color: var(--green-600); box-shadow: 0 0 0 3px var(--green-100);
}
.sx-calc { margin: 0; display: flex; flex-direction: column; }
.sx-calc > div {
    display: flex; justify-content: space-between; gap: 12px; padding: 8px 0;
    border-top: 1px solid var(--gray-100); font-size: 14px;
}
.sx-calc dt { color: var(--gray-500); }
.sx-calc dd { margin: 0; color: var(--gray-900); font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
.sx-calc__total dt, .sx-calc__total dd { color: var(--gray-900); font-weight: 600; }
.sx-options { display: flex; flex-direction: column; gap: 8px; }
.sx-options:empty { display: none; }
.sx-options__title { margin: 0; font-size: 14px; font-weight: 500; color: var(--gray-900); }
.sx-option {
    display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
    border: 1px solid var(--gray-200); border-radius: var(--radius-sm); cursor: pointer;
    transition: border-color 0.15s;
}
.sx-option:hover { border-color: var(--gray-300); }
.sx-option:has(input:checked) { border-color: var(--green-600); }
.sx-option input, .sx-confirm input { margin-top: 3px; accent-color: var(--green-600); }
.sx-option strong { display: block; font-size: 14px; font-weight: 500; color: var(--gray-900); }
.sx-option small { display: block; font-size: 13px; color: var(--gray-500); }
.sx-confirm { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--gray-700); cursor: pointer; }
.sx-error { margin: 0; font-size: 13px; color: var(--danger); }
.sx-error[hidden] { display: none; }
.sx-submit { width: 100%; }
.sx-done-actions { display: flex; flex-direction: column; gap: 8px; }
.sx-done-actions .btn { width: 100%; justify-content: center; }
body:has(.sales-workspace--exchange) .sx-pane .btn--primary {
    background: var(--green-600); border-color: var(--green-600); color: var(--white); box-shadow: none;
}
body:has(.sales-workspace--exchange) .sx-pane .btn--primary:hover { background: var(--green-700); border-color: var(--green-700); }
body:has(.sales-workspace--exchange) .sx-pane .btn--outline {
    background: var(--white); color: var(--gray-700); border: 1px solid var(--gray-300); box-shadow: none;
}
@media (max-width: 900px) {
    .sx-bar { bottom: calc(12px + env(safe-area-inset-bottom)); }
    .sx-swap { grid-template-columns: 1fr; }
    .sx-fields { grid-template-columns: 1fr 1fr; }
    .sx-field input[type="date"] { -webkit-appearance: none; appearance: none; }
}
/* ===== /Продажи: доп. соглашение ===== */

/* ===== Выплаты — зарплата, коммунальные, постоянные расходы (clean) ===== */
.exp-page { display: flex; flex-direction: column; gap: 16px; }
body:has(#exp-page) .btn--primary { background: var(--green-600); border-color: var(--green-600); color: var(--white); box-shadow: none; transition: background-color 0.15s; }
body:has(#exp-page) .btn--primary:hover { background: var(--green-700); border-color: var(--green-700); }
body:has(#exp-page) .btn--outline { background: var(--white); color: var(--gray-700); border: 1px solid var(--gray-300); box-shadow: none; }
body:has(#exp-page) .btn--outline:hover { border-color: var(--gray-500); color: var(--gray-900); }

/* вкладки раздела — сегменты как в приложении */
.exp-tabs, .exp-seg {
    display: inline-flex; flex-wrap: wrap; gap: 4px; align-self: flex-start;
    padding: 4px; background: var(--gray-100); border-radius: var(--radius);
}
.exp-tabs__link, .exp-seg__item {
    padding: 8px 14px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
    color: var(--gray-500); text-decoration: none; transition: background-color 0.15s, color 0.15s;
}
.exp-seg__item { padding: 6px 12px; font-size: 13px; }
.exp-seg__item span { color: var(--gray-400); margin-left: 2px; }
.exp-tabs__link:hover, .exp-seg__item:hover { color: var(--gray-900); }
.exp-tabs__link.is-active, .exp-seg__item.is-active { background: var(--white); color: var(--gray-900); box-shadow: var(--shadow-soft); }

.exp-receipt-note {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
    padding: 14px 16px; background: var(--green-50); border: 1px solid var(--green-100); border-radius: var(--radius);
    font-size: 14px; color: var(--gray-900);
}

.exp-month { display: flex; align-items: center; gap: 10px; }
.exp-month__arrow {
    display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
    border: 1px solid var(--gray-200); border-radius: 50%; background: var(--white);
    color: var(--gray-700); text-decoration: none; transition: border-color 0.15s, color 0.15s;
}
.exp-month__arrow:hover { border-color: var(--green-600); color: var(--green-700); }
.exp-month__label { min-width: 150px; text-align: center; font-size: 20px; font-weight: 600; color: var(--gray-900); }
.exp-month__today { margin-left: 4px; font-size: 13px; color: var(--green-700); text-decoration: none; }

/* итог месяца */
.exp-hero {
    display: flex; flex-direction: column; gap: 12px; padding: 20px;
    background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius);
}
.exp-hero__top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.exp-hero__label { margin: 0 0 2px; font-size: 13px; color: var(--gray-500); }
.exp-hero__sum { margin: 0; font-size: 30px; font-weight: 600; line-height: 1.15; color: var(--gray-900); font-variant-numeric: tabular-nums; }
.exp-hero__sum span { font-size: 16px; font-weight: 500; color: var(--gray-500); }
.exp-hero__pct { margin: 0; display: flex; flex-direction: column; align-items: flex-end; font-size: 22px; font-weight: 600; color: var(--green-700); font-variant-numeric: tabular-nums; }
.exp-hero__pct span { font-size: 12px; font-weight: 400; color: var(--gray-500); }
.exp-hero__stats { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 13px; color: var(--gray-500); }
.exp-hero__stats b { color: var(--gray-900); font-weight: 600; font-variant-numeric: tabular-nums; }
.exp-hero__stats .exp-danger b { color: var(--danger); }

/* полоса прогресса: зелёное — выплачено, серое — осталось */
.exp-bar { position: relative; height: 8px; background: var(--gray-100); border-radius: 999px; overflow: hidden; }
.exp-bar--lg { height: 10px; }
.exp-bar--xl { height: 14px; }
.exp-bar__fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--green-600); border-radius: 999px; transition: width 0.2s ease-out, left 0.2s ease-out; }
.exp-bar__fill--next { background: var(--green-400); border-radius: 0 999px 999px 0; }

/* платежи — карточки */
.exp-group { display: flex; flex-direction: column; gap: 10px; }
.exp-group__title { margin: 4px 0 0; font-size: 14px; font-weight: 600; color: var(--gray-900); }
.exp-group__title span { margin-left: 4px; font-weight: 400; color: var(--gray-400); }
.exp-cards { display: flex; flex-direction: column; gap: 10px; }
.exp-card {
    display: flex; flex-direction: column; gap: 12px; padding: 16px;
    background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius);
    cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
}
.exp-card:hover { border-color: var(--gray-300); box-shadow: var(--shadow-soft); }
.exp-card.is-overdue { border-color: var(--danger); }
.exp-card.is-paid { background: var(--gray-50); }
.exp-card__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.exp-card__who { min-width: 0; }
.exp-card__title { margin: 0; font-size: 16px; font-weight: 600; color: var(--gray-900); }
.exp-card.is-paid .exp-card__title { color: var(--gray-700); }
.exp-card__sub { margin: 2px 0 0; font-size: 13px; color: var(--gray-500); }
.exp-card__rest { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; }
.exp-card__rest-sum { font-size: 20px; font-weight: 600; line-height: 1.2; color: var(--gray-900); font-variant-numeric: tabular-nums; }
.exp-card__rest-sum.exp-muted { font-size: 13px; font-weight: 400; }
.exp-card__rest-label { font-size: 12px; color: var(--gray-500); }
.exp-card__bottom { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.exp-card__progress { margin: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; color: var(--gray-700); font-variant-numeric: tabular-nums; }
.exp-card__progress b { color: var(--gray-900); font-weight: 600; }
.exp-card__due { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--gray-500); }
.exp-card__actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.exp-card__btn { min-width: 128px; justify-content: center; border-radius: var(--radius-sm); }
.exp-card__more {
    display: inline-flex; align-items: center; gap: 4px; padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
    background: none; font: inherit; font-size: 13px; color: var(--gray-500); cursor: pointer; transition: background-color 0.15s, color 0.15s;
}
.exp-card__more:hover { background: var(--gray-100); color: var(--gray-900); }
.exp-card__more svg { transition: transform 0.2s; }
.exp-card.is-open .exp-card__more svg { transform: rotate(180deg); }

/* история раскрывается плавно */
.exp-card__details { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.2s ease-out; cursor: default; }
.exp-card.is-open .exp-card__details { grid-template-rows: 1fr; }
.exp-card__details-inner { overflow: hidden; min-height: 0; }
.exp-card.is-open .exp-card__details-inner { padding-top: 4px; border-top: 1px solid var(--gray-100); }
.exp-payouts { list-style: none; margin: 0 0 8px; padding: 0; }
.exp-payout { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--gray-100); font-size: 14px; }
.exp-payout:last-child { border-bottom: 0; }
.exp-payout__main { display: flex; flex-direction: column; gap: 2px; }
.exp-payout__actions { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.exp-payout__actions form { margin: 0; }
.exp-payout.is-cancelled b { text-decoration: line-through; color: var(--gray-500); }

.exp-link, .exp-link-danger { padding: 4px 0; border: 0; background: none; font: inherit; font-size: 13px; color: var(--green-700); text-decoration: none; cursor: pointer; }
.exp-link:hover { color: var(--green-800); }
.exp-link-danger { color: var(--danger); }
.exp-num { text-align: right; font-variant-numeric: tabular-nums; }
.exp-muted { font-size: 13px; color: var(--gray-400); }
.exp-danger { color: var(--danger); }
.exp-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gray-700); }
.exp-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--gray-300); flex-shrink: 0; }
.exp-dot--done { background: var(--green-700); }
.exp-dot--danger { background: var(--danger); }

.exp-empty, .exp-table-wrap, .exp-cats { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); }
.exp-empty { padding: 40px 16px; text-align: center; }
.exp-empty__title { margin: 0 0 4px; font-size: 16px; font-weight: 600; color: var(--gray-900); }
.exp-empty__text { margin: 0 auto; max-width: 460px; font-size: 14px; color: var(--gray-500); }

.exp-table-wrap { overflow: hidden; }
.exp-table { width: 100%; border-collapse: collapse; }
.exp-table th { height: 40px; padding: 0 16px; text-align: left; font-size: 12px; font-weight: 500; color: var(--gray-500); border-bottom: 1px solid var(--gray-200); }
.exp-table th.exp-num { text-align: right; }
.exp-table td { padding: 12px 16px; font-size: 14px; color: var(--gray-700); border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.exp-table tbody tr:last-child td { border-bottom: 0; }
.exp-table tbody tr { transition: background-color 0.15s; }
.exp-table tbody tr:hover { background: var(--gray-50); }
.exp-row__title { display: block; font-size: 14px; font-weight: 500; color: var(--gray-900); }
.exp-row__sub { display: block; font-size: 13px; color: var(--gray-500); }

.exp-cats { padding: 16px; display: flex; flex-direction: column; gap: 8px; max-width: 640px; }
.exp-cats__title { margin: 0; font-size: 14px; font-weight: 600; color: var(--gray-900); }
.exp-cats__list { margin: 0; font-size: 14px; color: var(--gray-700); }
.exp-cats__form { display: flex; gap: 8px; }
.exp-cats__form input { flex: 1; min-width: 0; }

/* окна: плавное появление, на телефоне — снизу */
body:has(#exp-page) .exp-modal .modal__backdrop { background: rgba(15, 23, 42, 0.4); backdrop-filter: none; opacity: 0; transition: opacity 0.2s; }
body:has(#exp-page) .exp-modal .modal__dialog {
    border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: none; animation: none;
    opacity: 0; transform: translateY(12px); transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}
body:has(#exp-page) .exp-modal.is-open .modal__backdrop { opacity: 1; }
body:has(#exp-page) .exp-modal.is-open .modal__dialog { opacity: 1; transform: none; }
body:has(#exp-page) .exp-modal .modal__title { color: var(--gray-900); font-size: 18px; }
body:has(#exp-page) .exp-modal .field input,
body:has(#exp-page) .exp-modal .field select,
body:has(#exp-page) .exp-cats__form input {
    width: 100%; min-width: 0; box-sizing: border-box; padding: 10px 12px; font: inherit; font-size: 15px;
    color: var(--gray-900); background: var(--white); border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
}
body:has(#exp-page) .exp-modal .field input:focus,
body:has(#exp-page) .exp-modal .field select:focus,
body:has(#exp-page) .exp-cats__form input:focus {
    outline: none; border-color: var(--green-600); box-shadow: 0 0 0 3px var(--green-100);
}
body:has(#exp-page) .exp-modal #exp-pay-amount { font-size: 22px; font-weight: 600; padding: 12px 14px; }
.exp-pay-state { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; padding: 14px; background: var(--gray-50); border-radius: var(--radius-sm); }
.exp-pay-state__text, .exp-pay-state__after { margin: 0; font-size: 14px; color: var(--gray-700); }
.exp-pay-state b { color: var(--gray-900); font-variant-numeric: tabular-nums; }
.exp-pay-state__after.exp-danger { color: var(--danger); }
.exp-quick { display: flex; gap: 8px; margin-top: 8px; }
.exp-quick__btn {
    padding: 6px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); background: var(--white);
    font: inherit; font-size: 13px; color: var(--gray-700); cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.exp-quick__btn:hover { border-color: var(--green-600); color: var(--gray-900); }
.exp-check { display: flex; gap: 8px; align-items: center; margin: 4px 0 12px; font-size: 14px; color: var(--gray-700); }
.exp-check[hidden] { display: none; }
.exp-check input[type="checkbox"] { accent-color: var(--green-600); }

/* большие экраны: карточки в две колонки */
@media (min-width: 1280px) {
    .exp-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
    .exp-cards .exp-card__bottom { flex-direction: column; align-items: stretch; }
    .exp-cards .exp-card__actions { justify-content: space-between; }
}
@media (min-width: 2200px) {
    .exp-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* планшеты: справочник — карточками, без горизонтальной прокрутки */
@media (max-width: 1024px) {
    .exp-table thead { display: none; }
    .exp-table, .exp-table tbody, .exp-table tr, .exp-table td { display: block; width: 100%; }
    .exp-table tr {
        display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; padding: 12px 16px;
        border-bottom: 1px solid var(--gray-100);
    }
    .exp-table td { padding: 0; border: 0; text-align: left; font-size: 13px; color: var(--gray-500); }
    .exp-table td:first-child { grid-column: 1; }
    .exp-table td:nth-child(4) { grid-column: 2; grid-row: 1; text-align: right; font-size: 15px; color: var(--gray-900); }
    .exp-table td:last-child { grid-column: 2; text-align: right; }
    .exp-table td.exp-num { text-align: right; }
}
@media (max-width: 768px) {
    .exp-page { gap: 14px; }
    .exp-tabs { align-self: stretch; }
    .exp-tabs__link { flex: 1; text-align: center; padding: 8px 6px; font-size: 13px; }
    .exp-seg { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
    .exp-seg__item { white-space: nowrap; }
    .exp-hero { padding: 16px; }
    .exp-hero__sum { font-size: 26px; }
    .exp-card { padding: 14px; }
    .exp-card__bottom { flex-direction: column; align-items: stretch; }
    .exp-card__actions { justify-content: space-between; }
    .exp-card__btn { flex: 1; }
    .exp-payout { flex-direction: column; gap: 6px; }
    .exp-month__label { min-width: 0; flex: 1; font-size: 18px; }
    .exp-month { justify-content: space-between; }
    .exp-cats__form { flex-direction: column; }
    body:has(#exp-page) .app-content__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
    body:has(#exp-page) .app-content__actions .btn { justify-content: center; white-space: normal; }
    body:has(#exp-page) .exp-modal { align-items: flex-end; padding: 0; }
    body:has(#exp-page) .exp-modal .modal__dialog {
        width: 100%; max-height: 92dvh; overflow-y: auto; border-radius: var(--radius) var(--radius) 0 0;
        padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); transform: translateY(100%); opacity: 1;
    }
    body:has(#exp-page) .exp-modal .form__actions { flex-direction: column-reverse; }
    body:has(#exp-page) .exp-modal .form__actions .btn { width: 100%; justify-content: center; }
}
/* маленькие телефоны */
@media (max-width: 420px) {
    body:has(#exp-page) .exp-modal .field-row { grid-template-columns: 1fr; }
    .exp-tabs__link { font-size: 12px; padding: 8px 4px; }
    .exp-hero__top { flex-direction: column; align-items: flex-start; gap: 4px; }
    .exp-hero__pct { flex-direction: row; align-items: baseline; gap: 6px; font-size: 16px; }
    .exp-card__top { flex-direction: column; gap: 6px; }
    .exp-card__rest { flex-direction: row; align-items: baseline; gap: 6px; }
    .exp-card__actions { flex-direction: column-reverse; align-items: stretch; }
    .exp-card__more { justify-content: center; }
    body:has(#exp-page) .app-content__actions { grid-template-columns: 1fr; }
}
/* ===== /Выплаты ===== */

/* ===== Бланк договора (clean) ===== */
/* Метка бланка в документе: <div class="doc-blank" data-blank="violet" data-blank-no="0004"> — фон листа и номер внизу по центру. */
.doc-blank { display: none; }
/* На экране лист — сплошная лента без страниц: одна рамка вокруг всей ленты (border-image),
   сетка с розеткой повторяется по длине. На бумаге и в Word рамка своя на каждой странице. */
.dsf-viewer__page.dsf-sheet:has(> .doc-blank),
.scp__page:has(> .doc-blank),
.doce-editor.has-blank {
    position: relative;
    border-style: solid !important;
    border-width: 15.6mm !important;
    border-color: transparent !important;
    border-image-slice: 59;
    border-image-width: 15.6mm;
    border-image-repeat: round;
    padding: 4.4mm 4.4mm 7.4mm !important;
    background-color: var(--white);
    background-origin: border-box;
    background-position: top center;
    background-size: 210mm 297mm;
    background-repeat: repeat-y;
}
.dsf-viewer__page.dsf-sheet:has(> .doc-blank[data-blank="violet"]),
.scp__page:has(> .doc-blank[data-blank="violet"]),
.doce-editor.has-blank--violet {
    background-image: url("../images/blanks/field-violet.svg");
    border-image-source: url("../images/blanks/frame-violet.svg");
}
.dsf-viewer__page.dsf-sheet:has(> .doc-blank[data-blank="green"]),
.scp__page:has(> .doc-blank[data-blank="green"]),
.doce-editor.has-blank--green {
    background-image: url("../images/blanks/field-green.svg");
    border-image-source: url("../images/blanks/frame-green.svg");
}
.dsf-viewer__page.dsf-sheet > .doc-blank,
.scp__page > .doc-blank {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    bottom: -5.1mm;
    height: 0;
    pointer-events: none;
    user-select: none;
}
/* номер — в табличке нижней полосы рамки, как на бумаге и в Word */
.dsf-viewer__page.dsf-sheet > .doc-blank:not([data-blank-no=""])::after,
.scp__page > .doc-blank:not([data-blank-no=""])::after {
    content: attr(data-blank-series) " № " attr(data-blank-no);
    position: absolute;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    text-align: center;
    font: 700 9pt/1 "Times New Roman", Times, serif;
    color: var(--gray-900);
    white-space: nowrap;
}
/* редактор шаблона на телефоне: «Бланк» и кнопки — второй строкой под названием */
@media (max-width: 900px) {
    .doce-topbar { flex-wrap: wrap; row-gap: .5rem; }
    .doce-topbar__right { width: 100%; }
    .doce-topbar__right .doce-topbar__paper { flex: 1 1 100%; }
    .doce-topbar__right .doce-topbar__paper-select { flex: 1; min-width: 0; }
}
/* ===== /Бланк договора ===== */

/* ===== Оформление сделки: поля ввода (clean) ===== */
/* Поля в карточках мастера были без рамки и фона — не видно, куда нажать. Теперь — явное поле:
   серый фон и рамка; наведение — рамка темнее; ввод — белое поле, зелёная рамка и кольцо. */
.sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field {
    padding: 0.7rem 1rem 0.8rem;
}
.sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field:focus-within {
    background: transparent;
}
.sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-label {
    margin: 0 0 0.4rem;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
}
.sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field:focus-within .sales-wizard-label {
    color: var(--gray-900);
}
.sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-input,
.sales-wizard.sales-wizard--v2 .sw-client-picker .sales-wizard-input {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--gray-50) !important;
    box-shadow: none !important;
    color: var(--gray-900);
    font-size: 16px;
    line-height: 1.3;
    cursor: text;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.sales-wizard.sales-wizard--v2 .sw-card select.sales-wizard-input,
.sales-wizard.sales-wizard--v2 .sw-card input[type="date"].sales-wizard-input { cursor: pointer; }
.sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-input--area {
    min-height: 88px;
    padding: 10px 12px;
}
.sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-input::placeholder,
.sales-wizard.sales-wizard--v2 .sw-client-picker .sales-wizard-input::placeholder {
    color: var(--gray-500);
}
.sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-input:hover,
.sales-wizard.sales-wizard--v2 .sw-client-picker .sales-wizard-input:hover {
    border-color: var(--gray-500);
}
.sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-input:focus,
.sales-wizard.sales-wizard--v2 .sw-client-picker .sales-wizard-input:focus {
    outline: none;
    border-color: var(--green-600);
    background: var(--white) !important;
    box-shadow: 0 0 0 3px var(--green-100) !important;
}
/* поля, которые система считает сама, — приглушены, не похожи на поле для ввода */
.sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-input[readonly],
.sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-input:disabled {
    border-color: var(--gray-200);
    background: var(--gray-100) !important;
    color: var(--gray-700);
    cursor: default;
}
/* обязательное поле не заполнено / неверно — после того, как его тронули */
.sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-input:user-invalid {
    border-color: var(--danger);
}
.sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-input:user-invalid:focus {
    box-shadow: none !important;
}
/* результат скана паспорта — цвет поля, а не всей строки */
.sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field:has(.sw-scan-ok),
.sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-field:has(.sw-scan-check) { background: transparent; }
.sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-input.sw-scan-ok { border-color: var(--green-600); background: var(--green-50) !important; }
.sales-wizard.sales-wizard--v2 .sw-card .sales-wizard-input.sw-scan-check { border-color: var(--danger); }
/* ===== /Оформление сделки: поля ввода ===== */
