:root {
  /* Тема «Лаванда». Значения - литералы (#rrggbb / rgba): tests/designTokens.test.js читает их статически.
     Предыдущая тема (бренд ink/paper) сохранена в style-v1.css и showroom-v1.css (не подключены, только для отката). */
  --bg: #F6F5FF;
  --card: #FFFFFF;
  --ink: #1E1B3A;
  --muted: #6B6890;
  --line: #ECEAF7;
  --accent: #6C5CE7;
  --accent-2: #8F7DFF;
  --accent-soft: #EFEDFF;
  --accent-ink: #4B3FC4;

  /* Статусы помещения. Сплошной цвет (--free/--booked/--sold/--no-sale) - клетка шахматки, точки легенды, полосы сводки,
     зоны на плане этажа; -sel - цвет номера на этой заливке. Мягкая пара (-bg / -tx) - бейджи и подписи: светлый фон и тёмный
     текст того же оттенка (красный текст - только -tx: на белом --sold даёт лишь 4.5:1 впритык). */
  --free: #15845D;
  --free-bg: #E3F6EE;
  --free-tx: #13734F;
  --free-sel: #FFFFFF;
  --booked: #F5A524;
  --booked-bg: #FFF0D4;
  --booked-tx: #8F5600;
  --booked-sel: #3A2400;
  --sold: #D93C3A;
  --sold-bg: #FDE7E7;
  --sold-tx: #B3261E;
  --sold-sel: #FFFFFF;
  --no-sale: #6E6B8A;
  --no-sale-sel: #FFFFFF;
  --nosale-bg: #EEEDF3;
  --nosale-tx: #5E5B78;
  --danger: #D93C5B;
  --danger-bg: #FDE7EC;
  --danger-tx: #A51E3C;

  --shadow: 0 1px 2px rgba(30,27,58,.05), 0 10px 30px rgba(30,27,58,.06);
  --shadow-hover: 0 6px 14px rgba(30,27,58,.12);
  --shadow-sm: 0 1px 2px rgba(30,27,58,.05);
  --r: 16px;
  --r-ctl: 14px;
  --r-cell: 10px;

  --warning: #F5A524;
  --info: #4B3FC4;
  --sidebar-bg: #FFFFFF;
  --sidebar-text: #6B6890;
  --sidebar-active: #EFEDFF;
  --sidebar-active-bg: #F6F5FF;
  --table-head-bg: #F6F5FF;
  --table-head-text: #6B6890;
  --row-hover: #FAF9FF;
  --header-h: 64px;
  --sidebar-w: 235px;

  /* Прежние имена: на них ссылаются inline-стили в public/js/*.js и index.html (JS по условию задачи не меняем). */
  --text: #1E1B3A;
  --text-muted: #6B6890;
  --border: #ECEAF7;
  --primary: #4B3FC4;
  --empty: #EEEEF3;
  --ink-soft: #6B6890;
  --booked-text: #8F5600;
  --booked-ink: #8F5600;
  --focus: #6C5CE7;
}

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

body { font-family: 'Golos Text', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }

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

/* ─── LAYOUT ─── */
#app { display: flex; height: 100vh; overflow: hidden; }
#sidebar { width: var(--sidebar-w); background: var(--sidebar-bg); flex-shrink: 0; margin: 16px 0 16px 16px;
  border-radius: var(--r); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow-y: auto; }
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
#header { height: var(--header-h); background: transparent;
  display: flex; align-items: center; padding: 0 1.5rem; gap: 1rem; flex-shrink: 0; }
#content { flex: 1; overflow-y: auto; padding: 1.5rem; }
#content.page-fade { animation: pageFade .18s ease; }
@keyframes pageFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ─── SIDEBAR ─── */
.sidebar-logo { padding: 1rem 1rem; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: .65rem; }
.sidebar-logo .logo-img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.sidebar-logo .logo-text { color: var(--ink); font-size: 1.05rem; font-weight: 800; letter-spacing: .04em; }

.sidebar-user { padding: .65rem 1rem; border-bottom: 1px solid var(--line);
  color: var(--sidebar-text); font-size: .8rem; }
.sidebar-user .user-name { font-weight: 600; color: var(--ink); font-size: .82rem; }

.nav-section { padding: .75rem .75rem; }
.nav-section-title { padding: .9rem 1rem .4rem; font-size: .65rem; font-weight: 700; letter-spacing: .1em;
  color: var(--muted); text-transform: uppercase; }
.nav-section-title:first-child { padding-top: .4rem; }
.nav-item { display: flex; align-items: center; gap: .7rem; min-height: 42px; padding: .6rem .75rem;
  color: var(--sidebar-text); cursor: pointer; transition: color .2s, background .2s;
  font-size: .9rem; font-weight: 500; margin: 0 0 .2rem;
  border-radius: 12px; }
/* Пункт меню - ссылка: глобальное подчёркивание ссылок при наведении ему не нужно. */
.nav-item, .nav-item:hover { text-decoration: none; }
.nav-item:hover { color: var(--ink); background: var(--sidebar-active-bg); }
.nav-item.active { color: var(--accent-ink); background: var(--sidebar-active); font-weight: 700; }
.nav-item .nav-icon { display: flex; flex-shrink: 0; opacity: .8; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-item .nav-icon svg { width: 17px; height: 17px; }
.nav-badge { display: inline-block; background: var(--danger-tx); color: #fff;
  border-radius: 10px; font-size: .72rem; font-weight: 400; padding: 0 .5rem;
  margin-left: auto; line-height: 1.6; }

/* ─── HEADER ─── */
#header .page-title { font-size: 1.25rem; font-weight: 700; color: var(--ink); flex: 1; letter-spacing: -.015em; }
.header-actions { display: flex; align-items: center; gap: .75rem; }

/* Защита данных: плашка в шапке и карточка на «Настройки → Сервер и бэкапы» */
.dp-banner { padding: .35rem .85rem; border: 0; border-radius: 16px; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer;
  max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: .75rem; }
.dp-banner:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.dp-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.dp-banner.warning { background: var(--booked-bg); color: var(--booked-tx); }
.dp-banner.critical { background: var(--danger-bg); color: var(--danger-tx); }
.dp-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.25rem; margin-bottom: 1.5rem;
  box-shadow: var(--shadow); }
.dp-card.dp-warning { border-color: var(--booked); }
.dp-card.dp-critical { border-color: var(--danger); }
.dp-head { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.dp-head h3 { margin: 0; }
.dp-badge { padding: .15rem .65rem; border-radius: 16px; font-size: .78rem; font-weight: 600; background: var(--free-bg); color: var(--free-tx); }
.dp-warning .dp-badge { background: var(--booked-bg); color: var(--booked-tx); }
.dp-critical .dp-badge { background: var(--danger-bg); color: var(--danger-tx); }
.dp-card .kpi-value { background: none; color: #1E1B3A; }
.dp-card .kpi-card.warning .kpi-value { background: none; color: #965A00; }
.dp-card .kpi-card.danger .kpi-value { background: none; color: #A51E3C; }
.dp-reasons { margin: .25rem 0 1rem 1.1rem; }
.kpi-sub { font-size: .75rem; color: var(--muted); margin-top: .15rem; }
.dp-reasons li { margin-bottom: .25rem; }
.lang-switcher { display: flex; gap: .25rem; }
.lang-btn { padding: .2rem .5rem; min-width: 28px; min-height: 28px; border: 1px solid var(--line); border-radius: 8px;
  background: none; cursor: pointer; font-size: .75rem; color: var(--muted); transition: all .15s; }
.lang-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ─── CARDS ─── */
.card { background: var(--card); border-radius: var(--r);
  border: 1px solid var(--line); box-shadow: var(--shadow); padding: 1.25rem;
  position: relative; overflow: hidden; }
.card-title { font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: .5rem; text-transform: uppercase; letter-spacing: .04em; }
.card-value { font-size: 1.6rem; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
.card-sub { font-size: .8rem; color: var(--muted); margin-top: .25rem; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi-card { background: var(--card); border-radius: var(--r); padding: 1.25rem;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; align-items: center; gap: .9rem; }
/* Класс «purple» остался в leadsReport.js от прежней палитры: иконка и число у него - обычный лиловый акцент. */
.kpi-icon { flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; }
.kpi-card.danger .kpi-icon { background: var(--danger-bg); color: var(--danger-tx); }
.kpi-card.warning .kpi-icon { background: var(--booked-bg); color: var(--booked-tx); }
.kpi-card.success .kpi-icon { background: var(--free-bg); color: var(--free-tx); }
.kpi-label { font-size: .75rem; color: var(--muted); margin-bottom: .3rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.kpi-value { font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi-card.danger .kpi-value { color: var(--danger-tx); }
.kpi-card.warning .kpi-value { color: var(--booked-tx); }
.kpi-card.success .kpi-value { color: var(--free-tx); }

/* ─── TABLES ─── */
.table-wrap { background: var(--card); border-radius: var(--r);
  border: 1px solid var(--line); box-shadow: var(--shadow); overflow-x: auto; }
.table-toolbar { padding: .75rem 1rem; display: flex; align-items: center; gap: .75rem;
  border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--card); }
.table-title { font-weight: 600; font-size: .9rem; flex: 1; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
thead th { background: var(--table-head-bg); padding: .75rem .5rem .75rem 1.5rem; text-align: left;
  font-size: 13px; font-weight: 600; color: var(--table-head-text); border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0; z-index: 1; }
tbody tr { border-bottom: 1px solid var(--line); transition: background .12s; cursor: pointer; }
tbody tr:hover { background: var(--row-hover); }
tbody td { padding: .75rem .5rem .75rem 1.5rem; font-size: .85rem; }
tbody tr:last-child { border-bottom: none; }

/* Просторная разметка таблицы договоров (запрошено под референс GOALL) */
.table-lg thead th { padding: 1.1rem .75rem 1.1rem 1.5rem; font-size: .88rem; }
.table-lg tbody td { padding: 1.25rem .75rem 1.25rem 1.5rem; font-size: .88rem; }

/* ─── BADGES ─── */
.badge { display: inline-flex; align-items: center; padding: .15rem .65rem; border-radius: 999px;
  font-size: 13px; font-weight: 700; white-space: nowrap; }
/* Статусы помещения те же, что на шахматке: свободно - зелёный, забронировано - янтарный, продано - красный. */
.badge-free { background: var(--free-bg); color: var(--free-tx); }
.badge-no-sale { background: var(--nosale-bg); color: var(--nosale-tx); }
.badge-booked { background: var(--booked-bg); color: var(--booked-tx); }
.badge-sold { background: var(--sold-bg); color: var(--sold-tx); }
.badge-active { background: var(--free-bg); color: var(--free-tx); }
.badge-initial { background: var(--nosale-bg); color: var(--muted); }
.badge-cancelled { background: var(--danger-bg); color: var(--danger-tx); }
.badge-completed { background: var(--accent-soft); color: var(--accent-ink); }
.badge-new { background: var(--accent-soft); color: var(--accent-ink); }
.badge-inactive { background: var(--booked-bg); color: var(--booked-tx); }
.badge-blocked { background: var(--danger-bg); color: var(--danger-tx); }
.badge-overdue { background: var(--danger-tx); color: #fff; padding: .2rem .65rem; }
.badge-danger { background: var(--danger-tx); color: #fff; padding: .2rem .65rem; border-radius: 20px; font-weight: 700; }

/* ─── TOOLBAR HELPERS ─── */
.tb-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.tb-select { width: auto !important; min-width: 110px; }
.tb-search { flex: 1; min-width: 160px; max-width: 260px; }

/* ─── BUTTONS ─── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .5rem 1.2rem;
  border-radius: var(--r-ctl); border: none; font-size: .9rem; font-weight: 600;
  cursor: pointer; transition: transform .2s, box-shadow .2s, background .2s, border-color .2s, color .2s;
  white-space: nowrap; font-family: inherit; }
/* Основная кнопка - лиловый градиент (по ТЗ темы: accent -> accent-2). Белый текст на светлом конце градиента даёт около 3.2:1 - см. отчёт. */
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700;
  box-shadow: 0 6px 18px rgba(108,92,231,.30); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(108,92,231,.40); }
.btn-primary:active { transform: translateY(0); }
.btn-success { background: var(--free-tx); color: #fff; }
.btn-success:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); }
/* Опасная кнопка - пастельная, без градиента. */
.btn-danger { background: var(--danger-bg); color: var(--danger-tx); font-weight: 700; }
.btn-danger:hover { box-shadow: var(--shadow-hover); }
.btn-warning { background: var(--warning); color: var(--booked-sel); }
.btn-warning:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.btn-outline { background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent-ink); }
/* Опасное действие в строке таблицы (отмена брони): не заливка на каждой строке, красным видно только слово. */
.btn-outline-danger { background: var(--card); border: 1px solid var(--line); color: var(--danger-tx); }
.btn-outline-danger:hover { border-color: var(--danger); }
.btn-sm { min-height: 34px; padding: .3rem .8rem; font-size: .8rem; border-radius: 10px; }
.btn-icon { padding: .45rem; background: var(--card); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; color: var(--muted); font-family: inherit; transition: border-color .2s, color .2s; }
.btn-icon:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ─── FORMS ─── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .8rem; font-weight: 500; color: var(--ink);
  margin-bottom: .3rem; }
.form-label.required::after { content: ' *'; color: var(--danger-tx); }
.form-control { width: 100%; min-height: 44px; padding: .55rem .9rem; border: 1px solid var(--line);
  border-radius: var(--r-ctl); font-size: .9rem; color: var(--ink); background: var(--card);
  transition: border-color .2s, box-shadow .2s; font-family: inherit; }
.form-control:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft); }
select.form-control {
  cursor: pointer;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B6890' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right .7rem center;
  background-size: 13px;
  padding-right: 2.1rem;
}
select.form-control:hover { border-color: var(--accent-2); }
/* Фильтр-список: ширина по самому длинному пункту (в любом языке), но не шире строки фильтров. */
select.filter-select { width: auto; max-width: 100%; }

/* ─── SEARCH SELECT (Область / Город, регион и т.п.) ─── */
.search-select { position: relative; }
.search-select .form-control { padding-right: 2.1rem; background-image:
  url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B6890' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
  background-repeat: no-repeat; background-position: right .7rem center; background-size: 13px; }
.search-select-list { display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 220px; overflow-y: auto; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow-hover); z-index: 50; }
.search-select-item { padding: .5rem .75rem; font-size: .875rem; cursor: pointer; }
.search-select-item:hover { background: var(--accent-soft); }
.search-select-empty { padding: .5rem .75rem; font-size: .82rem; color: var(--muted); }

/* ─── MODALS ─── */
.modal-overlay { position: fixed; inset: 0; background: rgba(30,27,58,.35);
  backdrop-filter: blur(2px); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-box { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
  max-height: 90vh; overflow-y: auto; width: 100%; max-width: 600px;
  animation: modalIn .15s ease; }
.modal-box.modal-lg { max-width: 900px; }
.modal-box.modal-xl { max-width: 1100px; }
.modal-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-body { padding: 1.25rem; }

/* ─── BREADCRUMBS ─── */
.breadcrumb { display: flex; align-items: center; gap: .4rem; font-size: .85rem;
  color: var(--muted); margin-bottom: 1rem; }
.breadcrumb-link { cursor: pointer; transition: color .15s; }
.breadcrumb-link:hover { color: var(--accent-ink); text-decoration: underline; }
.breadcrumb-sep { opacity: .6; }
.breadcrumb-current { color: var(--ink); font-weight: 600; }
.breadcrumb-sm { font-size: .78rem; margin-bottom: 2px; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--line);
  display: flex; gap: .5rem; justify-content: flex-end; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(.98); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* ─── TABS ─── */
.tabs { display: flex; border-bottom: 2px solid var(--line); margin-bottom: 1rem; }
.tab { padding: .6rem 1rem; cursor: pointer; font-size: .875rem; border-bottom: 2px solid transparent;
  margin-bottom: -2px; color: var(--muted); transition: all .15s; }
.tab.active { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 700; }
.tab:hover { color: var(--ink); }

/* ─── INPUTS / SEARCH ─── */
.search-box { position: relative; }
.search-box input { padding-left: 2rem; }
.search-box .search-icon { position: absolute; left: .6rem; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none; }

/* ─── PAGINATION ─── */
.pagination-wrap { display: flex; align-items: center; justify-content: space-between;
  padding: .6rem 1rem; border-top: 1px solid var(--line); }
.pager-info { font-size: .75rem; font-weight: 400; color: var(--muted); }
.pagination { display: flex; gap: .3rem; align-items: center; }
.pagination button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); cursor: pointer; font-size: .85rem; color: var(--ink); font-family: inherit; transition: all .15s; }
.pagination button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination button:hover:not(.active) { background: var(--bg); border-color: var(--muted); }

/* ─── TOASTS ─── */
#toasts { position: fixed; top: 1rem; right: 1rem; z-index: 9999; display: flex; flex-direction: column; gap: .5rem; }
.toast { padding: .75rem 1.25rem; border-radius: var(--r-ctl); color: #fff;
  box-shadow: 0 8px 24px rgba(30,27,58,.2); animation: slideIn .3s ease; min-width: 250px; }
.toast-success { background: var(--free-tx); }
.toast-error { background: var(--danger-tx); }
.toast-info { background: var(--info); }
@keyframes slideIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── CHESS BOARD ─── */
.chess-wrap { display: flex; gap: 1rem; align-items: flex-start; min-height: calc(100vh - 210px); cursor: grab; user-select: none; }
.chess-wrap.dragging { cursor: grabbing; }
/* padding-bottom: кольцо выбранной клетки в нижнем ряду (3px + отступ 2px) иначе обрезается краем прокручиваемой области. */
.chess-grid { flex: 1; overflow-x: auto; overflow-y: visible; padding-bottom: 8px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
/* Chrome и Safari: своя тонкая полоса. scrollbar-width / scrollbar-color сбрасываем в auto: Chrome 121+ при любом другом их значении
   игнорирует ::-webkit-scrollbar. Firefox остаётся на стандартных свойствах выше. */
@supports selector(::-webkit-scrollbar) {
  .chess-grid { scrollbar-width: auto; scrollbar-color: auto; }
  .chess-grid::-webkit-scrollbar { height: 6px; }
  .chess-grid::-webkit-scrollbar-track { background: transparent; }
  .chess-grid::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }
  .chess-grid::-webkit-scrollbar-thumb:hover { background: var(--muted); }
}
.chess-sections { display: flex; gap: 6px; align-items: flex-start; padding-right: 6px; }
.chess-section { flex: none; }
.chess-section-title { text-align: center; padding: .3rem .5rem; margin-bottom: 4px; white-space: nowrap; }
.chess-section-num { font-size: .95rem; font-weight: 700; color: var(--ink); }
.chess-section-entrance { font-size: .68rem; color: var(--muted); margin-top: 1px; }
.chess-floor { display: flex; gap: 3px; margin-bottom: 3px; align-items: center; }
.chess-floor-num { width: 20px; text-align: right; padding-right: 5px; font-size: .68rem; color: var(--muted); flex-shrink: 0; }
.chess-apt { width: 36px; height: 36px; border-radius: var(--r-cell); display: flex; align-items: center;
  justify-content: center; font-size: .875rem; font-weight: 700; cursor: pointer; color: #fff;
  box-shadow: 0 2px 6px rgba(30,27,58,.10);
  transition: transform .2s, box-shadow .2s, filter .2s; border: 0; overflow: hidden; }
.chess-apt:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
/* Сплошные заливки, номер на них - цвет -sel. Подобраны под AA: белый номер даёт на --free 4.68:1, на --sold 4.51:1, на --no-sale 5.08:1,
   тёмный на янтарном 7.18:1. При наведении фильтра яркости нет: filter затрагивает и номер, и у --sold запас 0.01 (brightness(1.05) даёт 4.14:1, (.95) - 4.40:1);
   отклик - подъём на 2px и тень.
   Статус не только цветом: у клетки есть подсказка, в карточке - текст. */
.chess-apt.free { background: var(--free); color: var(--free-sel); }
.chess-apt.booked { background: var(--booked); color: var(--booked-sel); }
.chess-apt.sold { background: var(--sold); color: var(--sold-sel); }
.chess-apt.no_sale { background: var(--no-sale); color: var(--no-sale-sel); }
/* Выбранная клетка (Showroom.showAptPanel ставит .selected): та же заливка, выделяет тёмное кольцо. Белое кольцо на белом фоне не видно. */
.chess-apt.selected { transform: scale(1.06); outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 8px 20px rgba(30,27,58,.18); }
.chess-apt-placeholder { width: 36px; height: 36px; border-radius: var(--r-cell); flex-shrink: 0;
  border: 1px dashed var(--line); box-sizing: border-box; }
.chess-apt-group-start { margin-left: 10px; }
.chess-panel { width: 300px; flex-shrink: 0; }
.chess-reorder-mode { cursor: default; }
.chess-reorder-mode .chess-apt { cursor: grab; outline: 1px dashed rgba(30,27,58,.45); outline-offset: -3px; }
.chess-apt.chess-apt-dragging { opacity: .35; }
#cx-reorder-toggle.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ─── CRM KANBAN ─── */
.kanban-wrap { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem; min-height: 500px; }
.kanban-col { min-width: 260px; max-width: 300px; background: var(--bg); border-radius: var(--r);
  display: flex; flex-direction: column; border: 1px solid var(--line); }
.kanban-col-header { padding: .75rem 1rem; border-radius: var(--r) var(--r) 0 0;
  color: #fff; font-weight: 600; font-size: .85rem; display: flex; justify-content: space-between; align-items: center; }
.kanban-col-meta { font-size: .75rem; opacity: .85; }
.kanban-body { padding: .5rem; flex: 1; min-height: 100px; }
.kanban-card { background: var(--card); border-radius: 12px; padding: .75rem; margin-bottom: .5rem;
  box-shadow: var(--shadow-sm); cursor: grab; border-left: 3px solid transparent;
  border: 1px solid var(--line); border-left: 3px solid transparent; transition: box-shadow .15s; }
.kanban-card:hover { box-shadow: var(--shadow-hover); }
.kanban-card .card-client { font-weight: 600; font-size: .875rem; }
.kanban-card .card-phone { font-size: .8rem; color: var(--muted); }
.kanban-card .card-tag { display: inline-block; padding: .15rem .45rem; border-radius: 20px;
  font-size: .7rem; font-weight: 600; margin: .2rem .1rem 0; }

/* ─── TASKS COLUMNS ─── */
.tasks-wrap { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.task-col { background: var(--card); border-radius: var(--r); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--line); }
.task-col-header { padding: .75rem 1rem; font-weight: 600; font-size: .875rem;
  border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.task-col-count { background: var(--bg); border-radius: 20px; padding: .1rem .5rem; font-size: .78rem; }
.task-item { padding: .75rem 1rem; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.task-item:hover { background: var(--bg); }
.task-item .task-title { font-weight: 500; font-size: .85rem; }
.task-item .task-meta { font-size: .77rem; color: var(--muted); margin-top: .25rem; }
.task-item .task-type { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; }
.task-item.overdue { border-left: 3px solid var(--danger); }
.task-item.overdue .task-meta { color: var(--danger-tx); }

/* ─── Лента активностей и напоминания в карточках лида и клиента (activities.js, leads.js) ─── */
.act-box { margin-top: 1rem; }
.act-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem;
  font-size: .82rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.act-form { display: grid; grid-template-columns: 9rem 1fr auto; gap: .5rem; align-items: start; margin-bottom: .75rem; }
.act-list { display: flex; flex-direction: column; gap: .5rem; max-height: 22rem; overflow-y: auto; }
.act-item { border: 1px solid var(--line); border-radius: var(--r-ctl); padding: .5rem .75rem; background: var(--card); }
.act-item.act-system { background: var(--accent-soft); border-color: transparent; }
.act-head { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; font-size: .78rem; color: var(--muted); }
.act-kind { font-weight: 600; color: var(--ink); }
.act-del { margin-left: auto; }
.act-text { margin-top: .25rem; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ─── Доска и отчёт воронки лидов (leadsBoard.js, leadsReport.js) ─── */
.lb-hint { margin: .25rem 1rem .75rem; font-size: .82rem; color: var(--muted); }
.lb-board { display: flex; gap: .75rem; padding: 0 1rem 1rem; overflow-x: auto; align-items: flex-start; }
.lb-col { flex: 1 0 11.5rem; min-width: 11.5rem; background: var(--bg); border-radius: var(--r-ctl); padding: .5rem; }
.lb-head { display: flex; justify-content: space-between; align-items: center; padding: .25rem .4rem .5rem;
  font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.lb-count { background: var(--card); border-radius: 999px; padding: 0 .55rem; font-size: .78rem; color: var(--ink); }
.lb-cards { display: flex; flex-direction: column; gap: .5rem; min-height: 4rem; }
.lb-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: .6rem .7rem;
  cursor: grab; font-size: .84rem; }
.lb-card:hover { border-color: var(--accent); }
.lb-card.lb-locked { cursor: pointer; }
.lb-ghost { opacity: .4; }
.lb-name { font-weight: 600; overflow-wrap: anywhere; }
.lb-phone, .lb-meta, .lb-apt, .lb-reason, .lb-date { color: var(--muted); font-size: .78rem; margin-top: .15rem; }
.lb-meta { display: flex; flex-wrap: wrap; gap: .1rem .6rem; }
.lb-more { margin-top: .5rem; font-size: .78rem; color: var(--muted); text-align: center; }
.lr-controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.lr-controls .form-control { width: auto; }
.lr-presets { display: flex; flex-wrap: wrap; gap: .4rem; }
.lr-card { padding: 1rem 1.25rem; margin-bottom: 1rem; }
.lr-title { font-size: .9rem; margin: 0 0 .75rem; }
.lr-table { margin-bottom: 1rem; padding: 1rem 1.25rem; overflow-x: auto; }
.lr-table .num { text-align: right; white-space: nowrap; }
/* Колонка с числами - фиксированной ширины: иначе у каждой строки полоска своей длины, и этапы нельзя сравнивать на глаз. */
.lr-stage { display: grid; grid-template-columns: 9rem 1fr 25rem; gap: .75rem; align-items: center; margin-bottom: .5rem; }
.kpi-grid.lr-kpis { grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); }
.lr-bar { height: .9rem; background: var(--bg); border-radius: 999px; overflow: hidden; }
.lr-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.lr-fill-lost { background: var(--danger); }
.lr-stage-num { font-size: .85rem; }
.lr-note { font-size: .78rem; color: var(--muted); margin: 0 0 1rem; }

/* ─── LOGIN PAGE ─── */
#login-page { position: fixed; inset: 0;
  background: var(--bg);
  display: none; align-items: center; justify-content: center; }
.login-box { background: var(--card); border-radius: var(--r); padding: 2.5rem; width: 400px;
  box-shadow: var(--shadow); border: 1px solid var(--line); }
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo-img { width: 52px; height: 52px; border-radius: 12px; display: inline-block; margin-bottom: .85rem;
  box-shadow: 0 4px 14px rgba(30,27,58,.25); }
.login-logo h1 { font-size: 1.5rem; font-weight: 800; color: var(--ink); letter-spacing: .04em; }
.login-logo p { color: var(--muted); font-size: .875rem; margin-top: .3rem; }
.login-error { color: var(--danger-tx); margin-top: .75rem; font-size: .85rem; }
.login-lang { justify-content: center; margin-top: 1.25rem; }

/* ─── MISC HELPERS ─── */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-sm { gap: .5rem; }
.gap-md { gap: 1rem; }
.gap-lg { gap: 1.5rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--muted); font-size: .85rem; }
/* Картинка, которой Files (public/js/files.js) ещё не выдал подписанную ссылку: без src браузер рисовал бы значок битой картинки и alt. */
img[data-signed-src]:not([src]) { visibility: hidden; }
.text-danger { color: var(--danger-tx); font-weight: 600; }
/* Суммы и числа в таблицах: вправо, разряды друг под другом, без переноса «16 500 000 / UZS». */
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart-title { font-size: .95rem; font-weight: 600; color: var(--ink); margin-bottom: .5rem; }
.stat-legend-row { display: flex; align-items: center; gap: .4rem; }
.stat-legend-row b { margin-left: auto; padding-left: .75rem; }
.stat-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.text-right { text-align: right; }
.fw-600 { font-weight: 600; }
.w-full { width: 100%; }
.empty-state { text-align: center; padding: 3rem; color: var(--muted); }
.empty-state .empty-icon { width: 60px; height: 60px; margin: 0 auto 1rem; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; }
.empty-state .empty-icon svg { width: 26px; height: 26px; }
.empty-state .empty-icon.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.section-title { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }
.chip { display: inline-block; padding: .2rem .6rem; background: var(--bg); border-radius: 20px;
  font-size: .75rem; margin: .15rem; cursor: pointer; border: 1px solid var(--line); transition: all .15s; }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.divider { border: none; border-top: 1px solid var(--line); margin: 1rem 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; flex-shrink: 0; user-select: none;
  border: none; font-family: inherit; cursor: pointer; }
/* Журнал действий (Настройки → Безопасность): ошибки красным, подробности раскрываются по клику */
.log-row-clickable { cursor: pointer; }
.log-row-error td { background: var(--danger-bg); }
.log-row-error td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
.log-row-error .log-summary, .log-error-text { color: var(--danger-tx); }
.log-detail td { background: var(--bg); font-size: .82rem; line-height: 1.6; }
.log-caret { display: inline-block; width: 1em; color: var(--muted); }
.info-row { display: flex; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.info-row:last-child { border-bottom: none; }
.info-label { width: 180px; font-size: .82rem; color: var(--muted); flex-shrink: 0; }
.info-value { font-size: .85rem; font-weight: 500; }
.toggle { position: relative; width: 40px; height: 22px; }
.toggle input { display: none; }
.toggle-slider { position: absolute; inset: 0; background: var(--line); border-radius: 22px; cursor: pointer; transition: .3s; }
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle-slider::before { content: ''; position: absolute; width: 16px; height: 16px;
  left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .3s; }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }
.color-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

/* ─── SHOWROOM APT PANEL ─── */
.apt-card-panel { padding: 1rem; }
.apt-panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.apt-panel-title { font-weight: 700; font-size: .95rem; color: var(--ink); }
.apt-panel-status { font-size: .78rem; font-weight: 600; }
.apt-panel-price { font-size: 1.35rem; font-weight: 800; color: var(--ink); letter-spacing: -.02em; margin-bottom: .15rem; }
.apt-panel-price-m2 { font-size: .78rem; color: var(--muted); margin-bottom: 1rem; }
.apt-panel-rows { border-top: 1px solid var(--line); }
.apt-panel-row { display: flex; justify-content: space-between; padding: .45rem 0;
  border-bottom: 1px solid var(--line); font-size: .83rem; }
.apt-panel-row span:first-child { color: var(--muted); }
.apt-panel-row span:last-child { font-weight: 500; }

/* ─── APT INFO MODAL (CALCULATOR) ─── */
.calc-room-badge { display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
  color: #fff; font-size: .72rem; font-weight: 700; margin-right: .4rem; }
.calc-apt-title { font-size: .95rem; font-weight: 600; color: var(--ink); }
#apt-info-modal .modal-header { padding: 1.1rem 1.5rem; }
#apt-info-modal .modal-body { padding: 1.25rem 1.5rem 1.5rem; }
.calc-price-row { padding: .5rem 0 1.5rem; border-bottom: 1px solid var(--line); margin-bottom: 0; }
.calc-total-price { display: block; font-size: 2rem; font-weight: 800; color: var(--ink); letter-spacing: -.03em; margin-bottom: .4rem; }
.calc-price-m2 { font-size: .9rem; color: var(--muted); margin-top: .1rem; }
.calc-section-title { font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); margin-top: 1.5rem; margin-bottom: .75rem; }
.calc-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.calc-card { background: var(--accent-soft); border: 1px solid var(--line); border-radius: var(--r-cell); padding: .85rem 1rem; }
.calc-card-label { font-size: .75rem; color: var(--muted); margin-bottom: .35rem; }
.calc-card-value { font-size: 1rem; font-weight: 700; color: var(--accent-ink); }
.calc-inputs-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.calc-input-group { display: flex; flex-direction: column; gap: .35rem; }
.calc-currency { display: flex; align-items: center; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.calc-chips-row { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.calc-chip { padding: .3rem .75rem; border: 1px solid var(--line); border-radius: 20px;
  background: var(--card); cursor: pointer; font-size: .82rem; font-weight: 500; color: var(--ink);
  transition: all .15s; font-family: inherit; }
.calc-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.calc-chip:hover:not(.active) { border-color: var(--accent); color: var(--accent-ink); }

/* кнопка-ссылка на цену/м² */
.calc-price-edit { background: none; border: none; cursor: pointer; font-size: inherit;
  font-family: inherit; color: var(--accent-ink); font-weight: 600;
  text-decoration: underline dotted; padding: 0; transition: color .15s; }
.calc-price-edit:hover { color: var(--ink); }

/* попап скидки */
.dsc-popup { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 1rem; box-shadow: 0 8px 24px rgba(30,27,58,.14);
  display: flex; flex-direction: column; gap: .6rem;
  max-width: 320px; margin-top: .5rem; animation: fadeSlideUp .15s ease; }
.dsc-popup-title { font-size: .82rem; font-weight: 600; color: var(--ink); }
.dsc-discount-label { font-size: .8rem; color: var(--booked-tx); font-weight: 500; }

/* ─── SHOWROOM LEGEND ─── */
.legend { display: flex; gap: 1rem; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--muted); }
.legend-dot { width: 14px; height: 14px; border-radius: 3px; }
/* Точку «Не продаётся» JS красит inline через var(--empty): без !important стиль из файла её не перебьёт. */
.legend-dot[style*="var(--empty)"] { background: var(--no-sale) !important; border-color: transparent !important; }

/* ─── SIDEBAR SCROLLBAR ─── */
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(30,27,58,.12); border-radius: 4px; }

/* ─── PERMISSIONS MATRIX ─── */
.perm-table { border-collapse: collapse; width: 100%; }
.perm-table th, .perm-table td { padding: .5rem .75rem; border: 1px solid var(--line); text-align: center; font-size: .82rem; }
.perm-table th:first-child, .perm-table td:first-child { text-align: left; }
.perm-table thead th { background: var(--bg); font-weight: 700; }
.perm-table tbody tr:hover { background: var(--bg); }

/* ─── SETTINGS LAYOUT ─── */
.settings-layout { display: flex; gap: 1rem; min-height: calc(100vh - 120px); }
.settings-sidebar { width: 220px; flex-shrink: 0; background: var(--card); border-radius: var(--r);
  padding: .5rem 0; box-shadow: var(--shadow); border: 1px solid var(--line); }
.settings-nav-item { padding: .65rem 1rem; cursor: pointer; font-size: .875rem; display: flex; align-items: center; gap: .5rem; color: var(--muted); transition: all .15s; }
.settings-nav-item:hover { background: var(--bg); color: var(--ink); }
.settings-nav-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.settings-content { flex: 1; background: var(--card); border-radius: var(--r); padding: 1.5rem;
  box-shadow: var(--shadow); border: 1px solid var(--line); overflow-y: auto; }

/* ─── PERM MATRIX ─── */
.perm-matrix { border-collapse: collapse; width: 100%; }
.perm-matrix th, .perm-matrix td { padding: .45rem .75rem; border: 1px solid var(--line); font-size: .82rem; }
.perm-matrix thead th { background: var(--bg); font-weight: 700; text-align: center; }
.perm-matrix tbody td:first-child { text-align: left; }

/* ─── KPIS ─── */
.kpi-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.col-count { background: rgba(0,0,0,.15); border-radius: 12px; padding: 0 7px; font-size: .75rem; font-weight: 600; }

/* ─── DEBT PAGE ─── */
.debt-summary { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.debt-summary .kpi-card { flex: 1; min-width: 180px; }
.debt-chart-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 1.25rem; margin-bottom: 1rem; }

/* ─── STATS CHARTS ─── */
.stats-charts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1rem; }
.stat-chart-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 1.25rem; }
.stat-chart-card h4 { font-size: .875rem; font-weight: 600; color: var(--ink); margin-bottom: 1rem; }

/* ─── MISC ─── */
.p-2 { padding: 2rem; }
.my-2 { margin: .75rem 0; }
.hr { border: none; border-top: 1px solid var(--line); }
hr.my-2 { border: none; border-top: 1px solid var(--line); margin: .75rem 0; }
.surface { background: var(--card); }

/* ─── GOALL FILTER BAR ─── */
.goall-toolbar { display: flex; align-items: center; gap: .75rem; padding: .875rem 1rem;
  background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; position: relative; }
.goall-filter-btn { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: .45rem 1rem;
  border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--card);
  font-size: .88rem; font-weight: 600; cursor: pointer; color: var(--ink); transition: border-color .2s, color .2s;
  font-family: inherit; }
.goall-filter-btn:hover, .goall-filter-btn.open { border-color: var(--accent); color: var(--accent-ink); }
.goall-search { display: flex; align-items: center; gap: .4rem; min-height: 44px; border: 1px solid var(--line);
  border-radius: var(--r-ctl); padding: .42rem .9rem; background: var(--card); flex: 1; max-width: 320px;
  transition: border-color .2s, box-shadow .2s; }
.goall-search input { border: none; outline: none; font-size: .84rem; width: 100%;
  color: var(--ink); font-family: inherit; background: transparent; }
.goall-search input::placeholder { color: var(--muted); }
.goall-search svg { color: var(--muted); flex-shrink: 0; }
.goall-tb-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

/* ─── GOALL FILTER DROPDOWN PANEL ─── */
.goall-filter-panel { position: absolute; top: calc(100% + 4px); left: 1rem; z-index: 50;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-hover); padding: 1rem; min-width: 220px;
  display: none; flex-direction: column; gap: .65rem; }
.goall-filter-panel.open { display: flex; }
.goall-filter-panel .form-control { font-size: .82rem; }
.goall-primary-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .45rem 1.1rem;
  border: none; border-radius: var(--r-ctl); background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  font-size: .88rem; font-weight: 700; cursor: pointer; font-family: inherit;
  box-shadow: 0 6px 18px rgba(108,92,231,.30); transition: transform .2s, box-shadow .2s; }
.goall-primary-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(108,92,231,.40); }
.goall-icon-btn { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--card); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--muted); transition: border-color .2s, color .2s; }
.goall-icon-btn:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ─── GOALL TABLE HEAD ─── */
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--ink); }
thead th .sort-icon { margin-left: .3rem; opacity: .5; font-size: .7rem; }

/* ─── SETTINGS GRID TILES ─── */
.settings-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.settings-tile { background: var(--card); border-radius: var(--r); padding: 1.5rem;
  border: 1px solid var(--line); box-shadow: var(--shadow); cursor: pointer; transition: transform .2s, box-shadow .2s, border-color .2s;
  display: flex; flex-direction: column; gap: .75rem; }
.settings-tile:hover { border-color: var(--accent-2); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.settings-tile-icon { width: 44px; height: 44px; border-radius: var(--r-cell); background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.settings-tile-title { font-size: .95rem; font-weight: 700; color: var(--ink); }
.settings-tile-desc { font-size: .82rem; color: var(--muted); line-height: 1.5; }

/* ─── GOALL CHANGES PAGE ─── */
.changes-layout { display: flex; gap: 1.5rem; }
.changes-form { flex: 1; background: var(--card); border-radius: var(--r); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 1.5rem; }
.changes-panel { width: 300px; flex-shrink: 0; }
.changes-panel .panel-card { background: var(--card); border-radius: var(--r); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.changes-panel-search { padding: .75rem; border-bottom: 1px solid var(--line); display: flex; gap: .5rem; }
.changes-panel-search input { flex: 1; min-height: 44px; border: 1px solid var(--line); border-radius: var(--r-ctl); padding: .4rem .8rem; font-size: .85rem; font-family: inherit; color: var(--ink); background: var(--card); }
.changes-panel-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.changes-panel-result { padding: .5rem; max-height: 300px; overflow-y: auto; }
.changes-panel-item { padding: .5rem .65rem; border-radius: 10px; cursor: pointer; font-size: .83rem; }
.changes-panel-item:hover { background: var(--bg); }
.changes-panel-item .cp-name { font-weight: 600; color: var(--ink); }
.changes-panel-item .cp-phone { color: var(--muted); font-size: .78rem; }

/* ─── BOSS DASHBOARD ─── */
.boss-header-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.boss-header-card { border-radius: var(--r); padding: 1.25rem 1.5rem; position: relative;
  overflow: hidden; box-shadow: var(--shadow); }
.boss-header-card.orange { background: var(--accent-ink); color: #fff; }
.boss-header-card.red    { background: var(--danger-tx); color: #fff; }
.boss-header-card .bh-icon { position: absolute; top: 1rem; right: 1rem; width: 36px; height: 36px;
  border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; }
.boss-header-card .bh-label { font-size: .8rem; opacity: .85; margin-bottom: .4rem; padding-right: 2.5rem; }
.boss-header-card .bh-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.boss-charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.boss-chart-card { background: var(--card); border-radius: var(--r); padding: 1.25rem; border: 1px solid var(--line); box-shadow: var(--shadow); }
.boss-chart-card h4 { font-size: .875rem; font-weight: 600; margin-bottom: .25rem; }
.boss-chart-card .bcc-total { font-size: 1.4rem; font-weight: 800; color: var(--accent-ink); margin-bottom: 1rem; }
.boss-stat-col { background: var(--card); border-radius: var(--r); padding: 1.25rem; border: 1px solid var(--line); box-shadow: var(--shadow); }
.boss-stat-col h4 { font-size: .875rem; font-weight: 700; color: var(--accent-ink); margin-bottom: .75rem;
  display: flex; align-items: center; gap: .4rem; }
.boss-stat-row { display: flex; justify-content: space-between; padding: .35rem 0;
  border-bottom: 1px solid var(--line); font-size: .85rem; }
.boss-stat-row:last-child { border-bottom: none; }
.boss-stat-row .bs-label { color: var(--muted); }
.boss-stat-row .bs-value { font-weight: 700; }
.boss-bottom { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
/* Сводка по квартирам: полоса сверху и цвет заголовка - как у статуса помещения (В продаже / Проданные / Забронированные).
   Заголовки двух последних красит JS inline (var(--sold), var(--booked-text)), поэтому их цвет здесь с !important. */
.boss-bottom > .boss-stat-col:nth-child(1) { box-shadow: inset 0 3px 0 var(--free), var(--shadow); }
.boss-bottom > .boss-stat-col:nth-child(2) { box-shadow: inset 0 3px 0 var(--sold), var(--shadow); }
.boss-bottom > .boss-stat-col:nth-child(3) { box-shadow: inset 0 3px 0 var(--booked), var(--shadow); }
.boss-bottom > .boss-stat-col:nth-child(1) h4 { color: var(--free-tx) !important; }
.boss-bottom > .boss-stat-col:nth-child(2) h4 { color: var(--sold-tx) !important; }
.boss-bottom > .boss-stat-col:nth-child(3) h4 { color: var(--booked-tx) !important; }

@media print {
  body > *:not(#print-overlay):not(#apt-print-modal) { display: none !important; }
  #print-overlay { display: block !important; position: static !important; }
}
#print-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 99999;
  background: #fff; overflow: auto; padding: 20px;
}

/* ─── ПЕЧАТНЫЕ ФОРМЫ: остаются строгими и такими же, как до темы «Лаванда» ───
   Предложение по квартире (#apt-print-modal) и печать плана (#print-overlay) собирает JS, цвета берутся из var(--...) в inline-стилях.
   Чтобы тема не перекрасила и не растянула бумажную форму, внутри них действуют прежние токены, 14px и обычный интерлиньяж. */
#apt-print-modal, #print-overlay {
  --ink: #1C2A29;
  --ink-soft: #4A5856;
  --paper: #F1F3F2;
  --line: #CBD3D0;
  --empty: #E2E7E5;
  --free: #5FAE8C;
  --booked: #E2AC2F;
  --sold: #2C5C8C;
  --focus: #2C5C8C;
  --on-booked: #3A2A00;
  --free-bg: #DCEFE6;
  --free-ink: #1F5E45;
  --booked-bg: #F7E7B8;
  --booked-ink: #5C4200;
  --booked-text: #8A5A00;
  --sold-bg: #D6E3F0;
  --sold-ink: #1D4468;
  --danger-bg: #F4DAD6;
  --danger-ink: #8A241B;
  --primary: #1C2A29;
  --primary-light: #4A5856;
  --primary-bg: #E2E7E5;
  --accent: #2B7A5A;
  --danger: #B3382C;
  --warning: #E2AC2F;
  --info: #2C5C8C;
  --bg: #F1F3F2;
  --sidebar-bg: #FFFFFF;
  --sidebar-text: #4A5856;
  --sidebar-active: #1C2A29;
  --sidebar-active-bg: #E2E7E5;
  --card-bg: #FFFFFF;
  --border: #CBD3D0;
  --border-soft: #E2E7E5;
  --text: #1C2A29;
  --text-heading: #1C2A29;
  --text-muted: #4A5856;
  --table-head-bg: #E2E7E5;
  --table-head-text: #4A5856;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(28,42,41,.06);
  --shadow: 0 1px 2px rgba(28,42,41,.05);
  --shadow-hover: 0 6px 18px rgba(28,42,41,.12);
  font-size: 14px; line-height: normal; color: var(--ink);
}
#apt-print-modal table, #print-overlay table { font-variant-numeric: normal; }
#apt-print-modal thead th, #print-overlay thead th { font-size: .85rem; }
#apt-print-modal a, #print-overlay a { color: var(--sold); }

/* ─── PHONE INPUT ─── */
.phone-input-row { display: flex; align-items: center; gap: .5rem; }
.phone-flag-box { display: flex; align-items: center; gap: .3rem; padding: .5rem .55rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-size: .95rem;
  color: var(--muted); flex-shrink: 0; }
.phone-flag-box .chevron { font-size: .6rem; }
.phone-check-box { width: 34px; height: 34px; flex-shrink: 0; border-radius: 8px;
  background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: .85rem; }
.add-phone-link { display: inline-flex; align-items: center; gap: .35rem; color: var(--accent-ink);
  font-size: .85rem; margin-top: .6rem; cursor: pointer; text-decoration: none; }
.add-phone-link:hover { text-decoration: underline; }
.add-phone-link .plus-circle { width: 16px; height: 16px; border: 1.5px solid var(--accent);
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .7rem; }

/* ─── DATE INPUT (text + calendar icon) ─── */
.date-input-wrap { position: relative; }
.date-input-wrap .date-input { padding-right: 2.1rem; width: 100%; }
.date-input-wrap .date-input-icon { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none; display: flex; }
.date-input-wrap .date-input-native { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; opacity: 0; cursor: pointer; padding: 0; margin: 0; border: none; background: none; }

.search-btn { padding: .6rem .9rem !important; border-radius: 10px !important; font-size: 1rem; }

.passport-upload-row { display: flex; align-items: center; gap: .75rem; padding: .75rem;
  border: 1px dashed var(--line); border-radius: 10px; background: var(--bg); }
.passport-upload-icon { width: 34px; height: 34px; border-radius: 8px; background: var(--card);
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
  color: var(--muted); flex-shrink: 0; }

/* ─── CONTRACT DETAIL VIEW ─── */
.contract-actions-bar { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.btn-text-danger { background: none; border: none; color: var(--danger-tx); font-size: .875rem;
  font-weight: 500; cursor: pointer; padding: .5rem .25rem; }
.btn-text-danger:hover { text-decoration: underline; }
.contract-detail-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 800px) { .contract-detail-layout { grid-template-columns: 1fr; } }
.contract-detail-side .card { position: sticky; top: 0; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.detail-field { background: var(--bg); border-radius: 10px; padding: .85rem 1rem; position: relative; }
.detail-field-label { font-size: .78rem; color: var(--muted); margin-bottom: .35rem; }
.detail-field-value { font-size: .92rem; font-weight: 600; color: var(--ink); }
.detail-field-strike { font-size: .78rem; color: var(--muted); text-decoration: line-through;
  margin-left: .5rem; font-weight: 400; display: block; margin-top: 2px; }
.detail-field-badge { position: absolute; top: -8px; right: 10px; background: var(--booked-bg); color: var(--booked-tx);
  font-size: .7rem; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.pay-info-card { background: var(--accent-soft); border-radius: var(--r-cell); padding: 1rem; display: flex;
  align-items: center; gap: .75rem; margin-bottom: .75rem; }
.pay-info-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--card); display: flex;
  align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.pay-info-label { font-size: .78rem; color: var(--muted); }
.pay-info-value { font-size: 1.1rem; font-weight: 700; color: var(--accent-ink); }

.amount-scale { font-size: .82em; font-weight: 500; color: var(--muted); }

/* ─── ДОСТУПНОСТЬ: фокус с клавиатуры и системная настройка «меньше анимации» ─── */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* У поля поиска рамка своя, а у input внутри outline: none - фокус показываем на рамке. */
.goall-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important; }
  /* Крутилка загрузки - не украшение: без неё не видно, что идёт загрузка. */
  .empty-icon.spin svg { animation-duration: 1s !important; animation-iteration-count: infinite !important; }
  /* Лавандовая тема двигает кнопки и клетки при наведении и выборе - без анимации они остаются на месте. */
  .btn, .btn:hover, .goall-primary-btn, .goall-primary-btn:hover, .chess-apt, .chess-apt:hover, .chess-apt.selected,
  .nav-item, .nav-item:hover, .settings-tile:hover { transition: none !important; transform: none !important; }
}
/* ─── УЗКИЕ ЭКРАНЫ: боковое меню выезжает по кнопке ─── */
/* На широком экране кнопки и затемнения нет: меню всегда на виду. */
.nav-toggle { display: none; align-items: center; justify-content: center; flex-shrink: 0;
  width: 40px; height: 40px; border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--card); color: var(--ink); cursor: pointer; }
.nav-toggle:hover { border-color: var(--accent); color: var(--accent-ink); }
/* Бублик статистики и его легенда: рядом, а на узкой карточке - друг под другом. */
.donut-row { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; }
/* Копия переключателя языков внутри меню: на телефоне в шапке ей нет места (см. ниже). */
.sidebar-bottom { margin-top: auto; }
.sidebar-lang { display: none; padding: .75rem 1rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
.nav-backdrop { display: none; position: fixed; inset: 0; z-index: 40; background: rgba(30,27,58,.5); }

@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  /* Меню - панель поверх страницы. Закрытое прячем и через visibility (с задержкой на время
     анимации), иначе Tab ходил бы по невидимым пунктам. Фон непрозрачный: под ним текст страницы. */
  #sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 50; width: min(var(--sidebar-w), 86vw);
    margin: 0; border-radius: 0 var(--r) var(--r) 0; background: var(--sidebar-bg);
    transform: translateX(-100%); visibility: hidden;
    transition: transform .22s ease, visibility 0s linear .22s; }
  body.nav-open #sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-hover);
    transition: transform .22s ease, visibility 0s; }
  body.nav-open .nav-backdrop { display: block; }
  #header { padding: 0 1rem; gap: .75rem; }
  #header .page-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.1rem; }
  #content { padding: 1rem; }
  /* Двухколонные раскладки - в одну колонку, четырёхколонные - в две. */
  .settings-layout, .changes-layout { flex-direction: column; min-height: 0; }
  .settings-sidebar, .changes-panel { width: 100%; }
  .boss-charts-row, .boss-bottom, .stats-charts { grid-template-columns: 1fr; }
  /* Ячейка сетки по умолчанию не уже своего содержимого: без этого карточка с бубликом распирала колонку. */
  .boss-charts-row > *, .boss-bottom > * { min-width: 0; }
  .tasks-wrap, .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4, .tasks-wrap, .calc-cards, .calc-inputs-row, .detail-grid, .boss-header-cards, .act-form { grid-template-columns: 1fr; }
  /* Язык переключается из меню: в шапке пять кнопок съедали заголовок страницы («Проек…»). */
  .header-actions .lang-switcher { display: none; }
  .tabs { flex-wrap: wrap; }
  /* Шахматка: карточка квартиры встаёт под сетку на всю ширину. Сбоку (300px) она сжимала сетку до одной колонки и выходила за край экрана. */
  .chess-wrap { flex-direction: column; align-items: stretch; }
  .chess-panel { width: 100%; }
  .lr-stage { grid-template-columns: 1fr; gap: .25rem; }
  .lb-col { flex-basis: 11rem; min-width: 11rem; }
  .sidebar-lang { display: flex; }
}
