/* ==========================================================================
   Кабинет владелицы · Строй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(--accent);
  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);
  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);
  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);
  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);
}

.nav__item.is-active::before {
  height: 18px;
}

.nav__badge {
  margin-left: auto;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: var(--clay);
  color: #fdf7f0;
  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);
  color: var(--accent-pressed);
}

.hint[open] > summary {
  background: var(--accent);
  border-color: var(--accent);
  color: #f4f2ea;
}

.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(--accent-tint);
}

/* Ровно четыре числа — ровно четыре колонки: пустых клеток в полосе нет. */
.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(--clay);
}

.stat--key.is-neg {
  background: var(--clay-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(--clay);
}

/* Ноль не должен спорить с рабочими суммами: он есть, но молчит. */
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;
}

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(--accent);
  color: #f7f4ec;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn--primary:active:not(:disabled) {
  background: var(--accent-pressed);
}

.btn--outline {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn--outline:hover:not(:disabled) {
  border-color: var(--accent);
  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);
}

.btn--no {
  border-color: #e2bab2;
  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);
  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);
  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--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);
  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);
}

.choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.choice input:focus-visible + span {
  outline: 2px solid var(--accent);
  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);
}

.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: #7a4520;
}

.tag--ok {
  border-color: var(--accent-line);
  background: var(--accent-tint);
  color: var(--accent-pressed);
}

.tag--bad {
  border-color: #e2bab2;
  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: #7a4520;
  font-size: 13px;
  line-height: 1.4;
}

.notice--bad {
  border-color: #e2bab2;
  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: #26302b;
  box-shadow: var(--shadow-2);
  color: #f5f3ec;
  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);
  }
}
