/* ==========================================================================
   Кабинет владелицы · Строй2026
   --------------------------------------------------------------------------
   Тот же визуальный язык, что у формы рабочего («бумага, графит, патина»),
   но собран как рабочий инструмент бухгалтера: рельс разделов, шапка-паспорт
   отчёта, полоса ключевых чисел, таблицы с тонкими линейками и моно-цифрами.

   Принципы (из DESIGN.md):
   • бумага вместо белого, один акцент на экран, деньги — моно с tabular-nums;
   • глубина — тоном и линейкой, а не тенью и не градиентом;
   • сетка 4/8, максимум 1180 px, никаких «карточек-пузырей» и эмодзи;
   • движение только как отклик: 110–260 мс, transform/opacity;
   • токены и шрифты — в base.css (подключается раньше этого файла).

   Меняя файл — поднимите версию в admin.html (?v=) и CACHE_NAME при надобности.
   ========================================================================== */

/* --- база --------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--canvas);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
  -webkit-tap-highlight-color: transparent;
}

/* Бумага в клетку: едва заметная сетка, а не градиентная заливка.
   Она даёт «чертёжный» характер и при этом не спорит с цифрами. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: radial-gradient(circle, rgba(31, 36, 33, 0.07) 1px, transparent 1.1px);
  background-size: 24px 24px;
  opacity: 0.55;
  pointer-events: none;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent-pressed);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

h1,
h2,
h3,
p,
ul,
ol,
figure {
  margin: 0;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

svg {
  display: block;
}

a {
  color: var(--accent-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.mono {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--ink-muted);
}

.eyebrow {
  color: var(--ink-muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* --- каркас: рельс + страница ------------------------------------------- */

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: 100dvh;
}

.rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100dvh;
  padding: 22px 16px 18px;
  background: rgba(251, 250, 247, 0.86);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

.rail__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
}

.mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent-strong);
  color: #f1eee6;
}

.mark svg {
  width: 19px;
  height: 19px;
}

.brand-lines {
  display: grid;
  min-width: 0;
}

.brand-lines__name {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.brand-lines__role {
  color: var(--ink-muted);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.rail__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px 9px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink-2);
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}

.nav__item svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  color: var(--ink-faint);
}

.nav__item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav__item::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 3px;
  height: 0;
  border-radius: 0 2px 2px 0;
  background: var(--accent-strong);
  transform: translateY(-50%);
  transition: height var(--dur-2) var(--ease);
}

.nav__item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.nav__item.is-active {
  background: var(--accent-tint);
  color: var(--accent-pressed);
  font-weight: 600;
}

.nav__item.is-active svg {
  color: var(--accent-ink);
}

.nav__item.is-active::before {
  height: 18px;
}

.nav__badge {
  margin-left: auto;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: var(--clay);
  color: #fdfeff;
  font-family: var(--font-num);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
}

.rail__foot {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.rail__who {
  display: grid;
  gap: 1px;
  padding: 0 6px;
  font-size: 12px;
  color: var(--ink-muted);
}

.rail__who b {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

/* --- страница ----------------------------------------------------------- */

.page {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 26px clamp(16px, 2.4vw, 34px) 72px;
}

.page__head {
  max-width: 1440px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 24px;
  align-items: end;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.page__title {
  margin-top: 4px;
  font-size: clamp(25px, 1.1vw + 19px, 33px);
  font-weight: 600;
  letter-spacing: -0.026em;
  line-height: 1.08;
}

.page__sub {
  max-width: 62ch;
  margin-top: 6px;
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.45;
}

.page__tools {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 2px;
}

.stamp {
  display: grid;
  justify-items: end;
  color: var(--ink-muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  line-height: 1.35;
  text-transform: uppercase;
}

.stamp b {
  color: var(--ink-2);
  font-family: var(--font-num);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.content {
  display: grid;
  gap: 18px;
  min-width: 0;
  max-width: 1440px;
  margin-top: 20px;
}

/* Широкая таблица не должна растягивать страницу: прокрутка живёт внутри
   панели, иначе «уезжает» весь кабинет вместе с шапкой. */
.tabpane {
  min-width: 0;
}

/* --- панель ------------------------------------------------------------- */

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}

.panel__head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.panel__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.012em;
}

.panel__tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.panel__tools .input {
  width: clamp(150px, 22vw, 220px);
}

.panel__body {
  padding: 18px;
}

.panel__body--tight {
  padding: 12px 14px;
}

.panel__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
  color: var(--ink-muted);
  font-size: 12.5px;
}

/* Пояснение «?» — раскрывается на месте, ничего не перекрывает. */
.hint {
  display: inline-flex;
}

.hint > summary {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  list-style: none;
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease),
    border-color var(--dur-2) var(--ease);
}

.hint > summary::-webkit-details-marker {
  display: none;
}

.hint > summary:hover {
  background: var(--accent-tint);
  border-color: var(--accent-ink);
  color: var(--accent-pressed);
}

.hint[open] > summary {
  background: var(--accent-strong);
  border-color: var(--accent-ink);
  color: #fdfeff;
}

.hint__text {
  max-width: 62ch;
  margin-top: 8px;
  padding: 10px 12px;
  border-left: 2px solid var(--accent-line);
  background: var(--accent-tint);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.45;
}

/* --- полоса ключевых чисел ---------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1px;
  overflow: hidden;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}

.stat {
  display: grid;
  gap: 2px;
  align-content: start;
  padding: 15px 17px 17px;
  background: var(--surface);
}

.stat--key {
  /* «Концентрация»: главное число выделяется мятным градиентом. */
  background: var(--grad-highlight);
}

.stat--key .stat__label,
.stat--key .stat__value,
.stat--key .stat__note,
.stat--key .unit {
  color: #fff;
}

.stat--key.is-neg {
  background: var(--minus-soft);
}

.stat--key.is-neg .stat__label,
.stat--key.is-neg .stat__value,
.stat--key.is-neg .stat__note,
.stat--key.is-neg .unit {
  color: var(--ink);
}

/* Ровно четыре числа — ровно четыре колонки: пустых клеток в полосе нет. */
.stats--four {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.stat__label {
  color: var(--ink-muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.13em;
  line-height: 1.35;
  text-transform: uppercase;
}

.stat__value {
  font-family: var(--font-num);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat__value .unit {
  margin-left: 3px;
  color: var(--ink-faint);
  font-size: 0.62em;
  font-weight: 500;
  letter-spacing: 0;
}

.stat__note {
  color: var(--ink-muted);
  font-size: 11.5px;
  line-height: 1.35;
}


.stat__value--long {
  font-size: 17px;
  letter-spacing: -0.03em;
}

.stat.is-neg .stat__value {
  color: var(--minus-ink);
}

.stat--key.is-neg {
  background: var(--minus-soft);
}

/* --- таблицы ------------------------------------------------------------ */

.tablewrap {
  max-width: 100%;
  max-height: min(64vh, 640px);
  overflow: auto;
  border-radius: 0 0 var(--r-md) var(--r-md);
  overscroll-behavior: contain;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}

/* В отчётах с деньгами последняя колонка (остаток, к выплате) закреплена
   справа: главное число видно всегда, даже если таблица прокручивается. */
.table--pin th:last-child,
.table--pin td:last-child {
  position: sticky;
  right: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: inset 1px 0 0 var(--line-soft);
}

.table--pin thead th:last-child {
  z-index: 3;
}

.table--pin tbody tr:hover td:last-child {
  background: var(--surface-3);
}

.table--pin tr.row--total td:last-child {
  background: var(--surface-2);
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 9px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink-muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-align: left;
  text-transform: uppercase;
  vertical-align: bottom;
  white-space: normal;
}

thead th .hint {
  margin-left: 4px;
  vertical-align: -3px;
}

thead th .hint > summary {
  width: 15px;
  height: 15px;
  font-size: 9.5px;
}

tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: var(--surface-3);
}

/* Первая колонка не уезжает при горизонтальной прокрутке широких отчётов. */
thead th:first-child,
tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 170px;
  max-width: 300px;
  background: var(--surface);
}

tbody tr:hover td:first-child {
  background: var(--surface-3);
}

thead th:first-child {
  z-index: 3;
}

td.num,
th.num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

td.num {
  letter-spacing: -0.01em;
}

td.num.is-neg {
  color: var(--minus-ink);
  font-weight: 600;
}

/* Ноль не должен спорить с рабочими суммами: он есть, но молчит. */
td.num.is-zero {
  color: var(--ink-faint);
}

td.wide {
  min-width: 220px;
  max-width: 360px;
  white-space: normal;
}

/* Список работ в ячейке — не больше двух строк: строка отчёта должна
   оставаться строкой, а не превращаться в абзац. Полный список — в title. */
.clamp {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

/* Строка, где цена взята с одноимённой работы, а не своя (01.11.2026).
   Коралловый — тёплый контраст к голубому акценту кабинета; такую строку
   владелица должна замечать сразу, но она не выглядит как ошибка (не красная). */
tr.row--price-guess td {
  background: var(--focus-soft);
}

tr.row--price-guess td:first-child {
  box-shadow: inset 3px 0 0 var(--focus);
}

tr.row--price-guess:hover td {
  background: var(--focus-soft);
  filter: brightness(0.985);
}

tr.row--price-guess td.num {
  color: var(--focus);
  font-weight: 600;
}

tr.row--total td {
  padding-top: 10px;
  border-top: 2px solid var(--ink);
  border-bottom: 0;
  background: var(--surface-2);
  font-weight: 600;
}

tr.row--total:hover td {
  background: var(--surface-2);
}

td .tag {
  margin-left: 6px;
}

/* --- кнопки ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease),
    color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn--primary {
  background: var(--grad-accent);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn--primary:hover:not(:disabled) {
  background: var(--grad-accent);
  filter: saturate(1.08) brightness(1.04);
}

.btn--primary:active:not(:disabled) {
  background: var(--grad-accent);
  filter: brightness(0.94);
}

.btn--outline {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn--outline:hover:not(:disabled) {
  border-color: var(--accent-ink);
  color: var(--accent-pressed);
}

.btn--quiet {
  color: var(--ink-muted);
}

.btn--quiet:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--ink);
}

.btn--ok {
  border-color: var(--accent-line);
  background: var(--accent-tint);
  color: var(--accent-pressed);
}

.btn--ok:hover:not(:disabled) {
  border-color: var(--accent-ink);
}

.btn--no {
  border-color: #d8e7ed;
  background: transparent;
  color: var(--danger);
}

.btn--no:hover:not(:disabled) {
  background: var(--danger-soft);
}

.btn--mini {
  height: 29px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
}

.btn--wide {
  width: 100%;
}

/* --- таблицы: сортировка и поиск ---------------------------------------- */

.table-box {
  display: grid;
  gap: 10px;
}

.table-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.table-tools .input {
  max-width: 280px;
}

.table-count {
  font-size: 12px;
  margin-left: auto;
}

.th-sort {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.th-sort:hover {
  color: var(--ink);
}

.th-sort.is-sorted {
  color: var(--accent-pressed);
}

/* --- выбор объектов (поиск + несколько) ---------------------------------- */

.picker {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 220px;
}

.picker__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.picker__chip {
  display: inline-flex;
  gap: 2px;
  align-items: center;
  padding: 2px 4px 2px 9px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-pill);
  background: var(--accent-tint);
  color: var(--accent-pressed);
  font-size: 12px;
  white-space: nowrap;
}

.picker__x {
  padding: 1px 4px;
  border: 0;
  background: none;
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.picker__x:hover {
  color: var(--danger);
}

.picker__input {
  flex: 1 1 180px;
  min-width: 170px;
  height: 36px;
}

.picker__menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 30;
  min-width: 260px;
  max-height: 240px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--shadow-2);
}

.picker__item {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}

.picker__item:hover {
  background: var(--accent-tint);
}

.picker__empty {
  margin: 0;
  padding: 8px 10px;
  color: var(--ink-muted);
  font-size: 12.5px;
}

/* --- сворачиваемые блоки ------------------------------------------------ */

.fold {
  margin-top: 12px;
}

.fold__summary {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
  color: var(--ink-muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}

.fold__summary::-webkit-details-marker {
  display: none;
}

.fold__summary::before {
  content: "+";
  width: 12px;
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
}

.fold[open] .fold__summary::before {
  content: "–";
}

.fold__summary:hover {
  color: var(--ink);
}

.fold .tablewrap {
  margin-top: 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
}

/* --- графики ------------------------------------------------------------- */

.chart {
  display: grid;
  gap: 8px;
}

.chart__row {
  display: grid;
  grid-template-columns: 190px 1fr 132px;
  gap: 12px;
  align-items: center;
  font-size: 12.5px;
}

.chart__label {
  overflow: hidden;
  color: var(--ink-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart__track {
  height: 10px;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--r-pill);
}

.chart__fill {
  display: block;
  height: 100%;
  background: var(--accent-strong);
  border-radius: var(--r-pill);
}

.chart__fill.is-clay {
  background: var(--clay);
}

.chart__value {
  font-family: var(--font-num);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.chart__note {
  margin: 0;
  color: var(--ink-muted);
  font-size: 12px;
}

/* Пары «приход / расход» одного объекта: подпись объекта, под ней две полосы. */
.chart__group {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
}

.chart__group-title {
  margin: 0;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart__sublabel {
  color: var(--ink-faint);
  font-size: 12px;
}

/* Минус на диаграмме — сигнальный красный из палитры (не коричневый). */
.chart__fill.is-neg {
  background: var(--minus);
}

.chart__value.is-neg {
  color: var(--minus-ink);
  font-weight: 600;
}

.chart--donut {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
}

.chart__ring {
  flex: 0 0 auto;
  width: 132px;
  height: 132px;
}

.chart__sum {
  fill: var(--ink);
  font-family: var(--font-num);
  font-size: 13px;
}

.chart__legend {
  display: grid;
  flex: 1 1 240px;
  gap: 6px;
  min-width: 220px;
}

.chart__legend-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 12.5px;
}

.chart__mark {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.chart__legend-name {
  flex: 1 1 auto;
  color: var(--ink-2);
}

.chart__legend-value {
  color: var(--ink-muted);
  font-family: var(--font-num);
  font-size: 11.5px;
  white-space: nowrap;
}

/* --- формы ручного ввода ------------------------------------------------ */

.entry-form {
  padding: 14px 16px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-md);
  background: var(--accent-tint);
}

.entry-form__head {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.entry-form__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.entry-form__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px 12px;
  align-items: end;
}

.entry-form__grid .field--wide {
  grid-column: span 2;
}

.entry-form .btn--primary {
  grid-column: 1 / -1;
  justify-self: start;
}

.entry-form .field input,
.entry-form .field select {
  height: 36px;
}

@media (max-width: 760px) {
  .chart__row {
    grid-template-columns: 120px 1fr 100px;
  }

  .entry-form__grid .field--wide {
    grid-column: span 1;
  }
}

/* --- подразделы справочников -------------------------------------------- */

.subtabs {
  display: flex;
  gap: 3px;
  width: max-content;
  max-width: 100%;
  padding: 3px;
  overflow-x: auto;
  background: var(--surface-2);
  border-radius: var(--r-pill);
  scrollbar-width: none;
}

.subtabs::-webkit-scrollbar {
  display: none;
}

.subtabs button {
  padding: 6px 13px;
  border: 0;
  border-radius: var(--r-pill);
  background: none;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}

.subtabs button:hover {
  color: var(--ink);
}

.subtabs button.is-active {
  background: var(--surface);
  box-shadow: var(--shadow-1);
  color: var(--ink);
  font-weight: 600;
}

/* Форма в одну строку: добавить работника, открыть акт, завести работу. */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}

.inline-form .input {
  width: auto;
  min-width: 150px;
  flex: 1 1 170px;
}

.inline-form select.input {
  flex: 0 1 170px;
}

.act-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.act {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px 2px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: 12px;
  white-space: nowrap;
}

.act.is-open {
  border-color: var(--accent-line);
  background: var(--accent-tint);
}

.act__paid {
  margin-left: 2px;
  padding: 1px 6px 1px 7px;
  border: 0;
  border-left: 1px solid var(--accent-line);
  border-radius: 0 var(--r-pill) var(--r-pill) 0;
  background: transparent;
  color: var(--accent-pressed);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.act__paid:hover {
  background: var(--accent-soft);
}

.act__close {
  margin-left: 2px;
  padding: 1px 6px 1px 7px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-muted);
  font-size: 11.5px;
  cursor: pointer;
}

.act__close:hover {
  background: var(--surface-3);
  color: var(--danger);
}

/* Действия в строке не переносим: две кнопки должны стоять в одну линию. */
.rowline--nowrap {
  flex-wrap: nowrap;
}

.cell-note {
  display: block;
  margin-top: 2px;
  color: var(--ink-muted);
  font-size: 11px;
}

/* Действия в таблицах справочников — текстом, а не кнопками:
   иначе каждая строка выглядит как панель инструментов. */
.btn--text {
  height: 28px;
  padding: 0 8px;
  border-color: transparent;
  background: none;
  color: var(--accent-pressed);
  font-weight: 500;
}

.btn--text:hover:not(:disabled) {
  background: var(--accent-tint);
  color: var(--accent-pressed);
}

.btn--text.is-danger {
  color: var(--danger);
}

.btn--text.is-danger:hover:not(:disabled) {
  background: var(--danger-soft);
  color: var(--danger);
}

/* --- поля --------------------------------------------------------------- */

.field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.field__label {
  color: var(--ink-muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.input,
.field input,
.field select {
  height: 40px;
  min-width: 0;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  font-size: 15px;
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}

.input::placeholder {
  color: var(--ink-faint);
}

.input:focus,
.field input:focus {
  border-color: var(--accent-ink);
  outline: none;
  box-shadow: 0 0 0 3px rgba(47, 93, 80, 0.16);
}

.input--num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

/* --- выбор вариантов (конструктор) -------------------------------------- */

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.choice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease),
    color var(--dur-2) var(--ease);
}

.choice:hover {
  border-color: var(--accent-ink);
}

.choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.choice input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.choice:has(input:checked) {
  background: var(--accent-tint);
  border-color: var(--accent-line);
  color: var(--accent-pressed);
  font-weight: 600;
}

.choice:has(input:checked)::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-strong);
}

.choice input:not(:checked) + span {
  color: var(--ink-2);
}

/* --- метки состояний ---------------------------------------------------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.tag--wait {
  border-color: var(--clay-line);
  background: var(--clay-soft);
  color: #8f5a20;
}

.tag--ok {
  border-color: var(--accent-line);
  background: var(--accent-tint);
  color: var(--accent-pressed);
}

.tag--bad {
  border-color: #d8e7ed;
  background: var(--danger-soft);
  color: var(--danger);
}

/* --- списки и мелочи ---------------------------------------------------- */

.stack {
  display: grid;
  gap: 10px;
}

.rowline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
}

.divider {
  height: 1px;
  margin: 14px 0;
  background: var(--line-soft);
  border: 0;
}

.list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.list li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px;
}

.list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.list b {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.rule-note {
  padding: 10px 12px;
  border-left: 2px solid var(--accent-line);
  background: var(--accent-tint);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.45;
}

/* --- пустое состояние и скелетоны --------------------------------------- */

.empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 26px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--ink-muted);
  text-align: center;
}

.empty svg {
  width: 24px;
  height: 24px;
  color: var(--line-strong);
}

.empty__title {
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
}

.empty__text {
  max-width: 40ch;
  font-size: 12.5px;
}

.skeleton {
  height: 14px;
  border-radius: 5px;
  background: linear-gradient(100deg, var(--surface-2) 28%, var(--surface-3) 46%, var(--surface-2) 64%);
  background-size: 220% 100%;
  animation: sheen 1.5s linear infinite;
}

.skeleton--tall {
  height: 44px;
  border-radius: 10px;
}

/* --- уведомления -------------------------------------------------------- */

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 14px;
  border: 1px solid var(--clay-line);
  border-radius: var(--r-sm);
  background: var(--clay-soft);
  color: #8f5a20;
  font-size: 13px;
  line-height: 1.4;
}

.notice--bad {
  border-color: #d8e7ed;
  background: var(--danger-soft);
  color: var(--danger);
}

.notice svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.toast {
  position: fixed;
  bottom: calc(22px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 40;
  width: max-content;
  max-width: min(92vw, 560px);
  padding: 11px 17px;
  border-radius: 10px;
  background: #2a1b22;
  box-shadow: var(--shadow-2);
  color: #fdfeff;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  transform: translateX(-50%);
  animation: toast-in 220ms var(--ease) both;
}

.toast.bad {
  background: var(--danger);
}

/* --- вход --------------------------------------------------------------- */

.auth {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px 16px;
}

.auth__card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  width: min(880px, 100%);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 48px -34px rgba(31, 36, 33, 0.65);
}

.auth__aside {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  padding: 28px 26px;
  background: var(--accent-pressed);
  color: #eef1ea;
  overflow: hidden;
}

.auth__aside::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(240, 244, 236, 0.16) 1px, transparent 1.2px);
  background-size: 22px 22px;
  opacity: 0.5;
  pointer-events: none;
}

.auth__aside > * {
  position: relative;
}

.auth__aside .mark {
  background: rgba(240, 244, 236, 0.14);
  color: #f2efe6;
}

.auth__claim {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.28;
}

.auth__claim small {
  display: block;
  margin-top: 10px;
  color: rgba(238, 241, 234, 0.72);
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.5;
}

.auth__facts {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: rgba(238, 241, 234, 0.8);
  font-size: 12.5px;
}

.auth__facts li {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.auth__facts li::before {
  content: "—";
  color: rgba(238, 241, 234, 0.5);
}

.auth__form {
  display: grid;
  gap: 14px;
  align-content: center;
  padding: 30px clamp(20px, 4vw, 34px);
}

.auth__title {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.auth__sub {
  margin-top: -6px;
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.45;
}

.auth__err {
  min-height: 0;
}

/* --- движение ----------------------------------------------------------- */

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes sheen {
  from { background-position: 130% 0; }
  to { background-position: -30% 0; }
}

/* Раздел меняется мгновенно: владелица щёлкает по разделам десятки раз за
   сессию, и затухание на каждое переключение — это шум, а не отклик. */
.tabpane {
  animation: none;
}

/* --- узкие экраны ------------------------------------------------------- */

@media (max-width: 960px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .rail {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(242, 239, 233, 0.94);
  }

  .rail__brand {
    padding: 0;
  }

  .brand-lines__role {
    display: none;
  }

  .rail__nav {
    order: 3;
    flex-direction: row;
    gap: 4px;
    width: 100%;
    max-width: 100%;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .rail__nav::-webkit-scrollbar {
    display: none;
  }

  .nav__item {
    width: auto;
    padding: 7px 11px;
    border-radius: var(--r-pill);
    white-space: nowrap;
  }

  .nav__item::before {
    display: none;
  }

  .nav__item svg {
    display: none;
  }

  .rail__foot {
    margin: 0 0 0 auto;
    padding: 0;
    border: 0;
  }

  .rail__who {
    display: none;
  }

  .page {
    padding: 18px 14px 64px;
  }

  .page__head {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .page__tools {
    justify-content: space-between;
  }

  .content {
    gap: 14px;
    margin-top: 14px;
  }

  .panel__head,
  .panel__body,
  .panel__foot {
    padding-right: 14px;
    padding-left: 14px;
  }

  .stats,
  .stats--four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat {
    padding: 12px 13px 14px;
  }

  .stat__value {
    font-size: 18px;
  }

  .tablewrap {
    max-height: none;
  }

  thead th:first-child,
  tbody td:first-child {
    position: static;
  }

  .auth__card {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth__aside {
    display: none;
  }

  .btn {
    height: 42px;
  }
}

@media (max-width: 620px) {
  .stats {
    grid-template-columns: minmax(0, 1fr);
  }

  .page__title {
    font-size: 24px;
  }
}

/* --- уважение к настройке «меньше движения» ----------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .skeleton {
    background: var(--surface-2);
  }
}

/* --- шапка таблиц: спокойный «печатный» вид ----------------------------- */

thead th {
  padding: 11px 12px;
  background: linear-gradient(180deg, var(--surface-3) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--line-strong);
  box-shadow: inset 0 -2px 0 var(--accent-line);
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
}

/* тонкие разделители между колонками — чтобы шапка читалась как сетка */
thead th + th {
  border-left: 1px solid var(--line-soft);
}

tbody td {
  padding: 10px 12px;
}

/* метка «источник» — тихая, не спорит с данными */
.tag--soft {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  color: var(--ink-muted);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

/* --- фильтры журнала: сетка, а не «всё подряд» --------------------------- */

.journal-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px 16px;
  align-items: end;
}

.journal-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.journal-filter .field-note {
  margin: 0;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.journal-filter .input {
  width: 100%;
  min-height: 42px;
}

.journal-filters > .btn {
  justify-self: start;
  min-height: 42px;
  padding: 0 20px;
}

@media (max-width: 640px) {
  .journal-filters {
    grid-template-columns: 1fr 1fr;
  }

  .journal-filters > .btn {
    grid-column: 1 / -1;
    justify-self: stretch;
  }
}

/* --- печать вкладки ------------------------------------------------------ */

.page__tools {
  display: flex;
  justify-content: flex-end;
  margin: -6px 0 6px;
}

.print-area {
  display: none;
}

@media print {
  /* Печатаем только подготовленный лист: остальное не занимает место. */
  body > *:not(.print-area) {
    display: none !important;
  }

  /* Яркая печать: чёрный текст, плотные рамки, без серой «тусклости».
     print-color-adjust заставляет печатать заливку шапки таблицы. */
  html,
  body {
    background: #fff;
    color: #000;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-area {
    display: block !important;
    width: 100%;
    padding: 0;
    background: #fff;
    color: #000;
    font-size: 11pt;
    line-height: 1.4;
  }

  .print-area p {
    margin: 0 0 3mm;
    color: #000;
    font-size: 11pt;
  }

  .print-head {
    margin-bottom: 8mm;
    border-bottom: 2pt solid #7a2f4f;
    padding-bottom: 3mm;
  }

  .print-head__brand {
    margin: 0 0 1.5mm;
    color: #7a2f4f;
    font-size: 9pt;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  .print-head__title {
    margin: 0 0 2mm;
    color: #000;
    font-size: 18pt;
    font-weight: 700;
    line-height: 1.15;
  }

  .print-head__sub {
    margin: 0 0 1mm;
    color: #000;
    font-size: 10.5pt;
  }

  .print-head__date {
    margin: 0;
    color: #222;
    font-size: 9pt;
  }

  /* Таблицы: без прокрутки, с повтором шапки на каждой странице. */
  .print-area .tablewrap,
  .print-area .table-box {
    max-height: none;
    overflow: visible;
    border: 0;
  }

  .print-area table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10pt;
  }

  .print-area thead {
    display: table-header-group;
  }

  .print-area thead th {
    position: static;
    padding: 6pt 5pt;
    background: #e6e0d4;
    border: 0.9pt solid #000;
    box-shadow: none;
    color: #000;
    font-size: 9.5pt;
    font-weight: 700;
    text-align: left;
  }

  .print-area tbody td {
    position: static;
    padding: 5pt;
    border: 0.75pt solid #6b6b6b;
    background: #fff;
    color: #000;
    font-size: 10pt;
  }

  .print-area tbody tr:nth-child(even) td {
    background: #f5f2ec;
  }

  .print-area tr {
    break-inside: avoid;
  }

  .print-area .tag,
  .print-area .tag--soft,
  .print-area .tag--ok {
    padding: 0;
    border: 0;
    background: none;
    color: #000;
    font-size: 9.5pt;
  }

  .print-area .panel {
    border: 0;
    box-shadow: none;
    padding: 0;
    margin: 0 0 8mm;
    break-inside: avoid;
  }

  .print-area .panel__title {
    margin: 0 0 3mm;
    font-size: 13pt;
    font-weight: 700;
    color: #000;
  }

  .print-area strong,
  .print-area b {
    font-weight: 700;
  }
}

/* --- переключатель формата печати --------------------------------------- */

.page__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.print-orient {
  display: inline-flex;
  padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
}

.print-orient__item {
  padding: 7px 14px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}

.print-orient__item:hover {
  color: var(--ink-2);
}

.print-orient__item.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

/* --- фильтр по колонке (как в Excel) ------------------------------------- */

.th-filter {
  position: relative;
  display: inline-block;
  margin-left: 4px;
  vertical-align: middle;
}

.th-filter__btn {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-muted, #556d77);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.th-filter__btn:hover {
  border-color: var(--line, #d8e7ed);
  background: var(--surface, #fdfeff);
}

.th-filter__btn.is-active {
  border-color: var(--accent, #0095b6);
  color: var(--accent, #0095b6);
  background: var(--surface, #fdfeff);
}

.filter-pop {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 30;
  width: 300px;
  max-width: calc(100vw - 32px);
  padding: 8px;
  background: var(--surface, #fdfeff);
  border: 1px solid var(--line-strong, #b3aa99);
  border-radius: 10px;
  box-shadow: 0 16px 36px -20px rgba(31, 36, 33, 0.7);
  text-align: left;
}

.filter-pop__search {
  width: 100%;
  margin-bottom: 6px;
  font-size: 13px;
}

.filter-pop__list {
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 6px;
}

.filter-pop__item {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  padding: 3px 4px;
  font-size: 13px;
  line-height: 1.35;
  cursor: pointer;
  border-radius: 4px;
}

.filter-pop__item:hover {
  background: var(--surface-3, #efebe3);
}

.filter-pop__tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line, #d8e7ed);
  padding-top: 8px;
}

.filter-pop__tools .btn {
  white-space: nowrap;
  flex: 0 0 auto;
}


/* --- обращения рабочих: чаты --------------------------------------------- */

/* Список чатов: строка = работник. Три столбца — когда, кто, что от меня надо.
   Нажимаю на имя — под строкой раскрывается переписка (`.chat-body`). */
.chats {
  display: grid;
}

/* Чаты с закрытыми работниками: свёрнутый хвост под списком действующих
   (просьба владелицы 01.11.2026). Открывается по нажатию, по умолчанию закрыт. */
.chats-closed {
  margin-top: 4px;
  border-top: 1px solid var(--line-soft);
}

.chats-closed > summary {
  padding: 12px 16px;
  color: var(--ink-muted);
  font-size: 13.5px;
  cursor: pointer;
  list-style: none;
}

.chats-closed > summary::-webkit-details-marker {
  display: none;
}

.chats-closed > summary::before {
  content: "▸ ";
}

.chats-closed[open] > summary::before {
  content: "▾ ";
}

.chats-closed .chat-row {
  opacity: 0.75;
}

.chat-row {
  display: grid;
  grid-template-columns: 104px 1fr minmax(150px, 210px);
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--line-soft);
}

.chat-row:first-child {
  border-top: 0;
}

.chat-row:hover {
  background: var(--surface-3);
}

/* Новое сообщение: подсветка строки, чтобы её было видно в списке сразу. */
.chat-row.is-new,
.chat-row.is-new:hover {
  background: var(--clay-soft);
  box-shadow: inset 3px 0 0 var(--clay);
}

.chat-row__date {
  color: var(--ink-muted);
  font-family: var(--font-num);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chat-row__who {
  min-width: 0;
}

.chat-row__name {
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  cursor: pointer;
}

.chat-row__name:hover {
  color: var(--accent-ink);
  text-decoration-color: var(--accent-ink);
}

.chat-row__tech {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  text-align: right;
}

.chat-row__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--clay);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
}

/* Раскрытая переписка: шапка, лента сообщений, поле ответа. */
.chat-body {
  padding: 0 16px 14px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
}

.chat-body__head {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 0;
}

.chat-body__title {
  font-weight: 600;
}

.chat-body__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: auto;
}

.chat-feed {
  display: grid;
  gap: 8px;
  max-height: min(52vh, 460px);
  overflow: auto;
  padding: 10px 2px;
  overscroll-behavior: contain;
}

.chat-day {
  justify-self: center;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-muted);
  font-size: 11px;
}

.bubble {
  justify-self: start;
  max-width: min(560px, 82%);
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.bubble--own {
  justify-self: end;
  border-color: var(--accent-line);
  background: var(--accent-tint);
}

.bubble__text {
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bubble__meta {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-top: 6px;
  color: var(--ink-muted);
  font-size: 11px;
}

.bubble__state {
  color: var(--accent-pressed);
}

.bubble__state.is-wait {
  color: var(--clay);
}

.bubble__tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* Сверка после отправки работ — системная карточка по центру ленты. */
.chat-check {
  justify-self: center;
  max-width: min(600px, 96%);
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
}

.chat-check__state {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  color: var(--ink-muted);
  font-size: 11px;
}

.chat-reply {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-top: 4px;
}

.chat-reply__input {
  flex: 1 1 auto;
  min-height: 44px;
  resize: vertical;
}

/* Узкий экран: статус уезжает под имя, дата остаётся слева. */
@media (max-width: 900px) {
  .chat-row {
    grid-template-columns: 92px 1fr;
  }

  .chat-row__tech {
    grid-column: 1 / -1;
    justify-content: flex-start;
    text-align: left;
  }
}

/* --- ведомость «К выплате» ---------------------------------------------- */

.table--payroll .payroll__check {
  width: 36px;
  text-align: center;
  vertical-align: middle;
}

.table--payroll .payroll__name {
  font-weight: 600;
  color: var(--ink);
}

.table--payroll .payroll__object {
  color: var(--ink-muted);
  max-width: 240px;
}

.table--payroll .payroll__pay {
  font-weight: 700;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}

.table--payroll tr.payroll__row {
  cursor: pointer;
}

.table--payroll tr.payroll__row:hover td {
  background: var(--accent-tint);
}

.table--payroll tr.is-off td {
  color: var(--ink-faint);
}

.table--payroll tr.is-off .payroll__pay {
  color: var(--ink-faint);
}

.table--payroll tr.is-off .payroll__name {
  color: var(--ink-faint);
  text-decoration: line-through;
  text-decoration-color: var(--line-strong);
}

td.payroll__detail {
  padding: 0 10px 10px;
  background: var(--surface-3);
}

tr:hover td.payroll__detail {
  background: var(--surface-3);
}

.payroll__details {
  border-left: 2px solid var(--accent-line);
  padding-left: 10px;
}

.payroll__summary {
  cursor: pointer;
  color: var(--ink-muted);
  font-size: 11.5px;
  padding: 4px 0;
  list-style: none;
}

.payroll__summary::-webkit-details-marker {
  display: none;
}

.payroll__summary::before {
  content: "▸ ";
  color: var(--line-strong);
}

.payroll__details[open] > .payroll__summary::before {
  content: "▾ ";
}

.payroll__summary:hover {
  color: var(--accent-ink);
}

.table--inner {
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  overflow: hidden;
}

.table--inner thead th {
  position: static;
  background: var(--surface-2);
  font-size: 11px;
  padding: 5px 8px;
}

.table--inner tbody td {
  padding: 5px 8px;
  font-size: 12px;
}

/* --- вкладка «Рабочие» ---------------------------------------------------- */

.people__name {
  font-weight: 600;
  color: var(--accent-ink);
}

.people__objects {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.people__object {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--surface);
  overflow: hidden;
}

.people__head {
  display: grid;
  grid-template-columns: minmax(160px, 1.4fr) minmax(180px, 2fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.people__head:hover {
  background: var(--accent-tint);
}

.people__object-name {
  font-weight: 600;
  color: var(--ink);
}

.people__pairs {
  color: var(--ink-muted);
  font-size: 12px;
}

.people__rest {
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}

.people__rest--minus {
  color: var(--clay);
}

.people__works {
  border-top: 1px solid var(--line-soft);
}

/* --- карточка рабочего поверх списка -------------------------------------- */

body.is-locked {
  overflow: hidden;
}

.person-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 16px;
  overflow: auto;
  background: rgba(31, 36, 33, 0.45);
  backdrop-filter: blur(2px);
}

.person-modal__sheet {
  width: 100%;
  max-width: 940px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: 0 24px 60px rgba(31, 36, 33, 0.28);
  padding-bottom: 16px;
}

.person-modal__sheet .panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line-soft);
}

.person-modal__body {
  padding: 12px 16px 0;
}

@media (max-width: 720px) {
  .person-modal {
    padding: 0;
  }

  .person-modal__sheet {
    min-height: 100%;
    border-radius: 0;
  }

  .people__head {
    grid-template-columns: 1fr auto;
    row-gap: 4px;
  }

  .people__pairs {
    grid-column: 1 / -1;
  }
}

/* --- к выплате: ручные строки и итоги ------------------------------------- */

.payroll__extras {
  margin: 10px 0 6px;
  padding: 10px 0 4px;
  border-top: 1px solid var(--line-soft);
}

.payroll__totals {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  display: grid;
  gap: 4px;
}

.payroll__total-row {
  color: var(--ink-2);
  font-size: 13px;
}

.payroll__total-row--grand {
  font-weight: 700;
  font-size: 15px;
  color: var(--accent-ink);
}

/* --- чат поверх окон ------------------------------------------------------ */

/* Переписка больше не растягивает строку списка: открывается оверлеем,
   список остаётся под ней (просьба владелицы 24.10.2026). */
.chat-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(31 36 33 / 45%);
}

.chat-modal__frame {
  /* +50% к прежнему размеру (было 900 px): владелица попросила 24.10.2026. */
  inline-size: min(1350px, 100%);
  max-block-size: min(94vh, 1380px);
  overflow: auto;
  border-radius: var(--r-md);
  background: var(--surface-2);
  box-shadow: 0 24px 60px rgb(31 36 33 / 32%);
  overscroll-behavior: contain;
}

.chat-modal__frame .chat-body {
  border-top: 0;
}

.chat-modal__frame .chat-feed {
  max-height: min(69vh, 630px);
}

/* --- правки работ из чата ------------------------------------------------ */

.changes-frame {
  display: grid;
  gap: 12px;
  padding: 14px 16px 16px;
  inline-size: min(1080px, 100%);
}

.changes-note {
  margin: 0;
  color: var(--ink-muted);
  font-size: 12.5px;
}

.changes-table {
  inline-size: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.changes-table th,
.changes-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line-soft);
  text-align: start;
  vertical-align: top;
}

.changes-table th {
  color: var(--ink-muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.changes-table td.num {
  text-align: end;
  white-space: nowrap;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

.changes-totals {
  display: flex;
  gap: 20px;
  justify-content: flex-end;
  font-weight: 600;
}

.ask-actions {
  margin-left: 0;
  justify-content: flex-end;
}

/* Пять счётчиков в шапке (обращения: добавилась рассылка). */
.stats--five {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

/* --- вложения в чате ------------------------------------------------------ */

.chat-reply--rich {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}

.chat-reply__row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-reply__tools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.chat-reply__chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip--file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: 11.5px;
}

.chip__drop {
  border: 0;
  background: none;
  padding: 0 2px;
  color: var(--clay);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

/* Кнопка записи во время наговора — заметно «живая». */
.btn.is-recording {
  border-color: var(--clay);
  background: var(--clay-soft);
  color: var(--clay);
}

/* Полный текст в ячейке: вопросы и ответы Аси не обрезаем. */
.fulltext {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 520px;
  line-height: 1.4;
}

/* --- помощник по данным (раздел «Помощник») ------------------------------
   Кабинет читают как отчёт: поле вопроса крупное, подсказки — «таблетками»
   по темам (иначе кнопки слипаются), у каждой таблицы итоговая строка.
   Карточек внутри карточек нет: глубину дают тон и линейки (DESIGN.md §6). */

.assist {
  display: grid;
  gap: 20px;
}

.assist__form {
  display: grid;
  gap: 6px;
}

.assist__label {
  margin: 0;
  color: var(--ink-muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.11em;
  line-height: 1.3;
  text-transform: uppercase;
}

.assist__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

/* Поле вопроса — главное на экране: крупный текст и большая зона касания. */
.assist__input {
  height: 56px;
  min-width: 0;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}

.assist__input::placeholder {
  color: var(--ink-faint);
}

.assist__input:focus-visible {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 149, 182, 0.18);
}

.assist__send {
  min-width: 168px;
  height: 56px;
  padding: 0 24px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--grad-accent);
  color: #fff;
  font: inherit;
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
  transition: filter var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
}

.assist__send:hover:not(:disabled) {
  filter: brightness(1.07);
}

.assist__send:active:not(:disabled) {
  transform: translateY(1px);
}

.assist__send:focus-visible {
  outline: 2px solid var(--accent-pressed);
  outline-offset: 2px;
}

.assist__send:disabled {
  background: var(--surface-2);
  color: var(--ink-muted);
  cursor: progress;
}

/* Быстрые вопросы: три темы, в каждой — свои «таблетки» с отступами. */
.assist__groups {
  display: grid;
  gap: 16px;
}

.assist__group {
  display: grid;
  gap: 8px;
}

.assist__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ask-chip {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color var(--dur-2) var(--ease), background var(--dur-2) var(--ease),
    color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
}

.ask-chip:hover {
  border-color: var(--accent-line);
  background: var(--accent-tint);
  color: var(--accent-pressed);
}

.ask-chip:active {
  transform: translateY(1px);
}

.ask-chip:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 2px;
}

.ask-chip--ghost {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--ink-muted);
  font-size: 12.5px;
}

/* Ответ: не карточка в карточке, а раздел отчёта — линейка и место. */
.assist__answer:empty {
  display: none;
}

.assist__card {
  display: grid;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.assist__asked {
  margin: 0;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.4;
}

.assist__text {
  display: grid;
  gap: 8px;
  max-width: 82ch;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.55;
}

.assist__p {
  margin: 0;
}

.assist__list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 20px;
}

.assist__table {
  display: grid;
  gap: 8px;
}

.assist__table-head {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
  justify-content: space-between;
}

.assist__caption {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.assist__count {
  color: var(--ink-muted);
  font-family: var(--font-num);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.assist__table .tablewrap {
  max-height: min(56vh, 520px);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}

.assist__grid {
  font-size: 12.5px;
}

/* Первая колонка — дата или квартира: 170 px из общего стиля ей много. */
.assist__grid th:first-child,
.assist__grid td:first-child {
  min-width: 120px;
}

.assist__grid td.is-empty {
  color: var(--ink-faint);
}

/* Итоговая строка — верхняя линейка 2 px, как в отчётах кабинета. */
.assist__grid tr.row--total td {
  background: var(--surface-2);
}

.assist__note {
  margin: 0;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.45;
}

.assist__tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: flex-end;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.assist__wait,
.assist__error {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  line-height: 1.45;
}

.assist__wait {
  background: var(--surface-2);
  color: var(--ink-muted);
}

.assist__error {
  background: var(--danger-soft);
  color: var(--danger);
}

.assist__history {
  display: grid;
  gap: 8px;
}

@media (max-width: 720px) {
  .assist__row {
    grid-template-columns: minmax(0, 1fr);
  }

  .assist__send {
    min-width: 0;
    width: 100%;
  }

  /* меньше 16 px iPhone зумит страницу при вводе */
  .assist__input {
    font-size: 16px;
  }

  /* На телефоне отчёт плотнее: влезает больше колонок до прокрутки. */
  .assist__grid {
    font-size: 12px;
  }

  .assist__grid thead th,
  .assist__grid tbody td {
    padding: 7px 6px;
  }

  .assist__grid th:first-child,
  .assist__grid td:first-child {
    min-width: 82px;
    max-width: 160px;
  }
}

/* Компактная таблица прихода и расхода — вместо диаграммы (28.10.2026). */
.flow-compact .tablewrap {
  max-height: none;
}

.flow-compact td:first-child {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- доступ рабочих: плашка сверху и карточки запросов (31.10.2026) -------
   Владелица просила, чтобы запрос на вход с нового телефона нельзя было
   пропустить: плашка висит под шапкой, пока не решено, и не исчезает сама. */

.access-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 12px 16px;
  border: 1px solid var(--clay-line);
  border-radius: var(--r-md);
  background: var(--clay-soft);
  color: var(--clay);
  box-shadow: var(--shadow-1);
}

.access-alert__text {
  flex: 1 1 260px;
  font-weight: 600;
}

.access-card {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
}

.access-card:first-child {
  border-top: 0;
  padding-top: 0;
}

.access-card__top {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}

.access-card__name {
  font-size: 15px;
}

.access-card__phone {
  color: var(--ink-muted);
  font-size: 13px;
}

.access-card__mark {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-muted);
}

.access-card__mark.is-warn {
  color: var(--danger);
  font-weight: 600;
}

.access-clues {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.55;
}

.access-person {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
}

.access-person:first-child {
  border-top: 0;
  padding-top: 0;
}

/* Памятка «что происходит с доступом» — по просьбе владелицы, чтобы не забыть. */
.access-guide {
  margin-top: 14px;
  border-left: 3px solid var(--accent);
}

.access-guide__steps {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}

.access-guide__steps li {
  padding-left: 2px;
}

.access-guide__steps b {
  font-weight: 650;
}

/* --- чат: отметки на сообщениях и правка (31.10.2026) --------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-muted);
  font: inherit;
  font-size: 12.5px;
  line-height: 1;
  cursor: pointer;
}

.chip--mine {
  border-color: var(--accent-line);
  background: var(--accent-tint);
  color: var(--accent-ink);
  font-weight: 600;
}

.chip-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}

.bubble__edited {
  font-size: 11px;
  color: var(--ink-muted);
  opacity: 0.85;
}

.bubble__edit {
  width: 100%;
  min-height: 70px;
  padding: 8px 10px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  resize: vertical;
}

.bubble__edit-tools {
  display: flex;
  gap: 8px;
  padding-top: 6px;
}
