/* ТехКарта — кабинет: оболочка кабинета, заголовок страницы и боковое меню (разделы 3–4). Порядок файлов — см. base.css. */

/* ============================================================ 3. Оболочка */
.tk-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  background: var(--bg);
  color: var(--ink);
  transition: filter var(--duration-base) var(--ease-standard);
}

.tk-shell[data-blur="true"] {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}

/* Рабочая область: поля 32 / 24 / 16, содержимое не шире 1200 (4.4) */
.tk-main {
  display: grid;
  gap: 24px;
  align-content: start;
  min-width: 0;
  width: 100%;
  max-width: calc(var(--content-max) + 2 * var(--page-pad));
  margin: 0 auto;
  padding: 32px var(--page-pad) 64px;
}

/* Шапка страницы: подпись раздела и h1 слева, действия справа */
.tk-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px 24px;
  flex-wrap: wrap;
}

.tk-page-head > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

/* Подпись над h1 — обычный регистр, без разрядки (4.3) */
.tk-crumb {
  font: 600 14px/20px var(--font-sans);
  color: var(--muted);
}

/* Хлебные крошки (partials/breadcrumbs.html): ссылки синие, разделитель —
   шеврон, текущая страница серая и в одну строку с многоточием */
.tk-crumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 0;
  margin: 0 0 4px;
  padding: 0;
  list-style: none;
  font: 400 14px/20px var(--font-sans);
}

.tk-crumbs li {
  display: flex;
  align-items: center;
  min-width: 0;
}

.tk-crumbs li + li::before {
  content: "";
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin: 0 6px;
  background: var(--muted);
  -webkit-mask: url("/static/img/ui-399cbeca.svg") center / contain no-repeat;
  mask: url("/static/img/ui-399cbeca.svg") center / contain no-repeat;
}

.tk-crumbs a {
  color: var(--link);
  text-decoration: none;
}

.tk-crumbs a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.tk-crumbs [aria-current="page"] {
  max-width: 48ch;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tk-page-head h1 {
  font: var(--t-h1);
  color: var(--ink);
  text-wrap: balance;
  overflow-wrap: break-word;
}

/* ============================================================ 4. Меню */
/* Белая панель во всю высоту экрана с линией справа (4.6). Новое устройство
   меню (кнопка «Создать документ», 5 пунктов) — этап 2; здесь только размеры
   в реальных пикселях: 240 px, свёрнутое — 72 px, без анимации ширины, чтобы
   подписи не «ехали» вместе с панелью (1.1.4). */
.tk-side {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.tk-side__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 8px 8px 16px;
}

.tk-side__mark {
  width: 28px;
  height: 28px;
  border-radius: var(--r-4);
  background: var(--ink);
  color: var(--on-primary);
  display: grid;
  place-items: center;
  font: 700 17px/1 var(--font-serif);
  text-decoration: none;
  flex-shrink: 0;
}

.tk-side__brand {
  font: 700 20px/28px var(--font-serif);
  color: var(--ink);
  text-decoration: none;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tk-side__brand:hover {
  color: var(--ink);
}

.tk-side__toggle {
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-8);
  color: var(--text-2);
  flex-shrink: 0;
}

.tk-side__toggle:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.tk-side__toggle .tk-icon--expand {
  display: none;
}

.tk-side__user {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 16px 16px;
}

.tk-side__avatar {
  width: 24px;
  height: 24px;
  margin-top: 1px;
  color: var(--muted);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.tk-side__who {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.tk-side__caption {
  font: var(--t-small);
  color: var(--text-2);
  text-wrap: pretty;
  overflow-wrap: anywhere;
}

.tk-side__caption .badge {
  font-variant-numeric: tabular-nums;
}

.tk-side__action {
  appearance: none;
  margin: 0;
  padding: 4px 0;
  border: 0;
  background: none;
  cursor: pointer;
  min-height: 32px;
  font: 600 14px/20px var(--font-sans);
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.tk-side__action:hover {
  color: var(--primary-hover);
  text-decoration-thickness: 2px;
}

.tk-side__nav {
  flex: 1;
  padding: 0 8px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 4px;
}

/* Названия групп — обычный регистр (4.3); в этапе 2 группы уходят совсем */
.tk-side__title {
  font: 600 14px/20px var(--font-sans);
  color: var(--muted);
  padding: 12px 8px 4px;
}

.tk-side__item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 44px;
  padding: 0 8px;
  border-radius: var(--r-8);
  cursor: pointer;
  color: var(--ink);
  background: transparent;
  font: 500 16px/24px var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  list-style: none;
}

.tk-side__item::-webkit-details-marker {
  display: none;
}

.tk-side__item:hover {
  color: var(--ink);
  background: var(--surface-2);
}

/* Выбранное — синее (4.6): подложка --primary-tint и полоса слева */
.tk-side__item.is-active,
.tk-side__sub.is-active {
  background: var(--primary-tint);
  box-shadow: inset 3px 0 0 var(--primary);
  font-weight: 600;
}

.tk-side__item--muted {
  color: var(--text-2);
}

.tk-side__item--muted:hover {
  color: var(--ink);
}

.tk-side__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tk-side__chev {
  margin-left: -4px;
  color: var(--muted);
}

.tk-side__group[open] > .tk-side__item .tk-icon--down,
.tk-side__group:not([open]) > .tk-side__item .tk-icon--up {
  display: none;
}

.tk-side__group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  min-width: 0;
}

.tk-side__sub {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 40px;
  padding: 0 8px 0 38px;
  border-radius: var(--r-8);
  color: var(--ink);
  background: transparent;
  font: 400 14px/20px var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
}

.tk-side__sub:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.tk-side__count {
  font: var(--t-caption);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.tk-side__foot {
  border-top: 1px solid var(--line);
  padding: 8px;
}

.tk-side__foot form {
  margin: 0;
}

.tk-side__foot button.tk-side__item {
  appearance: none;
  margin: 0;
  border: 0;
  width: 100%;
  text-align: left;
}

/* Свёрнутое меню: 72 px, только значки */
.tk-shell[data-collapsed="true"] {
  grid-template-columns: var(--side-w-collapsed) minmax(0, 1fr);
}

.tk-shell[data-collapsed="true"] .tk-side__head {
  flex-direction: column;
  gap: 8px;
  padding: 16px 0 8px;
}

.tk-shell[data-collapsed="true"] .tk-side__brand,
.tk-shell[data-collapsed="true"] .tk-side__user,
.tk-shell[data-collapsed="true"] .tk-side__label,
.tk-shell[data-collapsed="true"] .tk-side__chev,
.tk-shell[data-collapsed="true"] .tk-side__sub,
.tk-shell[data-collapsed="true"] .tk-side__foot .tk-side__label {
  display: none;
}

.tk-shell[data-collapsed="true"] .tk-side__toggle .tk-icon--expand {
  display: block;
}

.tk-shell[data-collapsed="true"] .tk-side__toggle .tk-icon--collapse {
  display: none;
}

.tk-shell[data-collapsed="true"] .tk-side__item,
.tk-shell[data-collapsed="true"] .tk-side__foot button.tk-side__item {
  justify-content: center;
  padding: 0;
}

.tk-shell[data-collapsed="true"] .tk-side__title {
  height: 1px;
  padding: 0;
  margin: 8px 12px;
  background: var(--line);
  overflow: hidden;
  color: transparent;
}

/* Верхняя панель для узких экранов: скрыта на десктопе */
.tk-topbar {
  display: none;
}

/* ------------------------------------------------------------ Из main после ответвления дизайна
   (тарифы #87, techkarta-back#108): правила main как есть, старые токены — через
   совместимые имена в base.css. */
/* Тариф и счётчик лимита «28/42» под почтой (#87) — ссылка на «Мой тариф» */
.tk-side__plan {
  color: var(--ink);
  font-weight: 500;
}
.tk-side__plan:hover {
  color: var(--primary);
}
