/* ============================================================
   AIOS Технологического института — design tokens
   Светлая тема · пыльный зелёный + золотой
   ============================================================ */

:root {
  --paper:      #FAF8F3;
  --paper-soft: #F3F0E8;
  --card:       #FFFFFF;
  --ink:        #2C3128;
  --ink-soft:   #6A7060;
  --line:       #E4E0D4;

  --green:      #7C8B6C;   /* пыльный зелёный */
  --green-deep: #5D6C50;
  --green-ink:  #F4F6EF;

  --gold:       #C2A054;   /* золотой */
  --gold-soft:  #E9DCBB;

  --radius-lg: 20px;
  --radius-md: 14px;

  --shadow-card: 0 1px 2px rgba(44, 49, 40, .05), 0 8px 24px rgba(44, 49, 40, .06);
  --shadow-lift: 0 2px 4px rgba(44, 49, 40, .06), 0 16px 40px rgba(93, 108, 80, .16);

  --font: "Segoe UI", "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* ---------- Каркас: левое меню-лента + контент ---------- */

.layout {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  width: 236px;
  flex: none;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 26px 16px 20px;
  border-right: 1px solid var(--line);
  background: var(--paper);
}

.sidebar .wordmark { margin: 0 10px 26px; }

.page {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 32px 96px;
  box-sizing: border-box;
}

/* ---------- Логотип ---------- */

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}

.wordmark .sigil {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--green) 0%, var(--green-deep) 100%);
  position: relative;
  flex: none;
}

.wordmark .sigil::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 4px;
  border: 2px solid var(--gold-soft);
}

/* ---------- Левое меню-лента ---------- */

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* заголовки групп внутри ленты (некликабельные) */
.side-group-title {
  margin: 14px 12px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.side-nav > .side-group-title:first-child { margin-top: 2px; }

/* контейнер раздела «Рабочее пространство»: целиком виден
   только вошедшим (переключает workspace.js по #wsGroup) */
.side-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side-link {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border: none;
  border-radius: 10px;
  background: none;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--ink-soft);
  text-align: left;
  cursor: pointer;
  transition: color .2s ease, background .2s ease;
}

.side-link:hover { color: var(--green-deep); background: var(--paper-soft); }

/* Неактивный пункт меню («Полигоны» в разработке): не кликается, приглушён */
.side-link--disabled { pointer-events: none; opacity: 0.55; }

.side-link.active {
  color: var(--green-deep);
  background: var(--paper-soft);
  font-weight: 600;
}

/* золотое выделение «Рабочего чата» в ленте */
.side-link--chat {
  border: 1px solid var(--gold);
  background: var(--gold-soft);
  color: var(--ink);
  font-weight: 600;
}

.side-link--chat:hover {
  background: #E2D1A3;
  color: var(--ink);
}

/* приглушённая приписка «в разработке» в пункте «Полигоны» */
.side-note {
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-soft);
}

/* display:block/flex выше перебивает атрибут hidden — пункты меню
   и раздел были бы видны всем; парные правила обязательны */
.side-link[hidden],
.side-group[hidden],
.side-group-title[hidden] { display: none; }

/* ---------- Нижняя часть меню: настройки, админ-панель, вход ---------- */

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sidebar-footer .btn-login {
  margin-left: 0;
  margin-top: 8px;
  width: 100%;
  box-sizing: border-box;
}

/* ---------- Титульный блок ---------- */

.hero {
  padding: 88px 0 56px;
  max-width: 760px;
}

.hero h1 {
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 750;
  letter-spacing: -.02em;
  line-height: 1.08;
}

.hero h1 .accent { color: var(--green-deep); }

.hero .subtitle {
  margin-top: 20px;
  font-size: clamp(17px, 2vw, 21px);
  color: var(--ink-soft);
  max-width: 560px;
}

.hero .rule {
  margin-top: 32px;
  width: 64px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold), var(--green));
}

/* ---------- Цели ---------- */

.goals-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 24px;
}

.goals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 72px;
}

.goal {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 26px 26px 30px;
  box-shadow: var(--shadow-card);
}

.goal .num {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--gold);
  margin-bottom: 14px;
}

.goal .text {
  font-size: 16.5px;
  font-weight: 550;
  line-height: 1.45;
}

/* ---------- Плашки разделов ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 20px;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 28px;
  min-height: 148px;
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
  border-color: var(--gold-soft);
}

.tile::after {
  content: "→";
  position: absolute;
  top: 22px;
  right: 24px;
  font-size: 18px;
  color: var(--gold);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity .25s ease, transform .25s ease;
}

.tile:hover::after { opacity: 1; transform: translateX(0); }

.tile .tile-title {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.tile--std { grid-column: span 2; }

/* --- Плашка в разработке: без перехода, приглушённая --- */

.tile--wip {
  cursor: default;
  background: var(--paper-soft);
  box-shadow: none;
}
.tile--wip:hover { transform: none; box-shadow: none; border-color: var(--line); }
.tile--wip::after { content: none; }
.tile--wip .tile-title { color: var(--ink-soft); }
.tile-status {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gold);
}

/* --- Большая акцентная плашка --- */

.tile--hero {
  grid-column: span 6;
  min-height: 260px;
  justify-content: space-between;
  background:
    radial-gradient(1200px 400px at 85% -20%, rgba(194, 160, 84, .28), transparent 60%),
    linear-gradient(135deg, var(--green) 0%, var(--green-deep) 100%);
  border: none;
  color: var(--green-ink);
  padding: 36px;
}

.tile--hero::after { color: var(--gold-soft); font-size: 22px; top: 30px; right: 32px; }

.tile--hero .tile-title {
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 700;
  letter-spacing: -.015em;
}

.tile--hero .tile-sub {
  margin-top: 12px;
  font-size: 16px;
  line-height: 1.5;
  color: rgba(244, 246, 239, .82);
  max-width: 620px;
}

/* --- Прогресс-бар --- */

.progress { margin-top: 34px; }

.progress-track {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.progress-seg {
  height: 8px;
  border-radius: 999px;
  background: rgba(244, 246, 239, .28);
}

.progress-labels {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.progress-labels span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  color: rgba(244, 246, 239, .85);
}

.progress-labels .n {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--gold-soft);
  margin-bottom: 2px;
}

/* ---------- Внутренняя страница раздела ---------- */

.section-head { padding: 72px 0 0; max-width: 760px; }

.backlink {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--green-deep);
  margin-bottom: 28px;
}

.backlink:hover { color: var(--gold); }

.section-head h1 {
  font-size: clamp(30px, 4.4vw, 48px);
  font-weight: 750;
  letter-spacing: -.02em;
  line-height: 1.1;
}

.section-head .rule {
  margin-top: 28px;
  width: 64px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold), var(--green));
}

/* ---------- Адаптив ---------- */

@media (max-width: 900px) {
  .goals { grid-template-columns: 1fr; }
  .tile--std { grid-column: span 3; }
  .hero { padding: 56px 0 44px; }
}

@media (max-width: 560px) {
  .page { padding: 0 20px 64px; }
  .tile--std { grid-column: span 6; }
  .tile--hero { padding: 26px; }
  .progress-labels span { font-size: 10.5px; }
}

/* Сайдбар → горизонтальная верхняя панель на узких экранах */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar {
    position: static;
    height: auto;
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 14px 20px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .sidebar .wordmark { margin: 0 10px 0 0; }
  .side-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }
  /* разделы в строку: контейнер прозрачен для flex, заголовки — метки */
  .side-group { display: contents; }
  .side-group-title {
    margin: 0 0 0 10px;
    font-size: 10px;
    align-self: center;
  }
  .side-nav > .side-group-title:first-child { margin-left: 0; }
  .side-link {
    width: auto;
    padding: 7px 12px;
    border-radius: 999px;
  }
  .side-note { display: none; }
  .sidebar-footer {
    margin-top: 0;
    margin-left: auto;
    padding-top: 0;
    border-top: none;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }
  .sidebar-footer .btn-login { margin-top: 0; width: auto; }
  .user-menu {
    bottom: auto;
    top: calc(100% + 10px);
    left: auto;
    right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile, .tile::after, .side-link { transition: none; }
}

/* ---------- Страница «Статус пилотного проекта» ---------- */

.pilot-wrap { padding-bottom: 80px; }

.pilot-legend {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  margin: 6px 0 18px;
  font-size: 14px;
  color: var(--ink-soft);
}
.pl-item { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.pl-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.pl-dot--0 { background: #E4E0D4; }
.pl-dot--1 { background: var(--gold-soft); box-shadow: inset 0 0 0 2px var(--gold); }
.pl-dot--2 { background: var(--gold); }
.pl-dot--3 { background: var(--green-deep); }

.pl-hint { margin-left: auto; font-size: 13.5px; }
.pl-link {
  color: var(--green-deep);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px dashed var(--green-deep);
}
.pl-link:hover { color: var(--gold); border-color: var(--gold); }

.pilot-table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.pilot-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.pilot-table th {
  background: var(--green-deep);
  color: #F4F6EF;
  font-size: 12px;
  font-weight: 650;
  text-align: left;
  padding: 11px 12px;
  line-height: 1.35;
  vertical-align: bottom;
}
.pilot-table td {
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
  line-height: 1.3;
}
.pilot-table tbody tr:hover td { background: #F7F5EE; }

.pt-num { width: 34px; font-weight: 750; color: var(--ink-soft); }
.pt-topic { min-width: 260px; }
.pt-lead { min-width: 150px; font-weight: 650; color: var(--green-deep); }

.pt-cell { min-width: 108px; }

.pt-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
  user-select: none;
}
/* кликабельный чип: «гипотеза сформулирована» и далее — пояснение с гипотезой;
   «не начато» — смена статуса (только администратор) */
.pt-pill--clickable { cursor: pointer; }
.pt-pill--clickable:hover { outline: 2px solid var(--gold-soft); }

/* служебные строки таблицы: загрузка, пусто, ошибка */
.pt-msg {
  text-align: center;
  color: var(--ink-soft);
  padding: 26px 14px !important;
  font-size: 14px;
}
.pt-msg--error { color: #8C3B2E; }
.pt-retry {
  border: none;
  background: none;
  padding: 0;
  color: var(--green-deep);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.pt-retry:hover { color: var(--gold); }

/* пояснение по клику на чип статуса (поповер поверх таблицы) */
.pt-pop {
  position: fixed;
  z-index: 90;
  width: 360px;
  max-width: calc(100vw - 16px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 14px 34px rgba(31, 42, 33, .18);
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.45;
}
.pt-pop-head {
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--green-deep);
  padding-right: 22px;
}
.pt-pop-project {
  margin-top: 3px;
  font-weight: 650;
  color: var(--ink);
}
.pt-pop-status { margin-top: 7px; color: var(--ink-soft); }
.pt-pop-hyp {
  margin-top: 8px;
  white-space: pre-line;
}
.pt-pop-hyp--empty {
  color: var(--ink-soft);
  font-style: italic;
}
.pt-pop-close {
  position: absolute;
  top: 6px;
  right: 10px;
  border: none;
  background: none;
  font-size: 20px;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
}
.pt-pop-close:hover { color: var(--ink); }

/* смена статуса в пояснении (режим администратора) */
.pt-pop-admin {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.pt-pop-admin-title {
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-soft);
}
.pt-pop-statuses {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}
.pt-status-btn {
  padding: 4px 9px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: inherit;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.pt-status-btn:hover { border-color: var(--gold); }
.pt-status-btn--current {
  background: var(--green-deep);
  border-color: var(--green-deep);
  color: #F4F6EF;
}
.pt-status-btn[disabled] { opacity: .6; cursor: default; }
.pt-pop-error { margin-top: 8px; color: #8C3B2E; }
.pt-pop-error[hidden] { display: none; }

.pt-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex: none;
}
.pt-pill--0 { background: #F1EFE7; color: var(--ink-soft); }
.pt-pill--0 .pt-dot { background: #D8D3C2; }
.pt-pill--1 { background: #F6EEDC; color: #8A6F35; }
.pt-pill--1 .pt-dot { background: var(--gold-soft); box-shadow: inset 0 0 0 2px var(--gold); }
.pt-pill--2 { background: #F0E3C3; color: #7A6028; }
.pt-pill--2 .pt-dot { background: var(--gold); }
.pt-pill--3 { background: var(--green-deep); color: #F4F6EF; }
.pt-pill--3 .pt-dot { background: #B9C4A6; }

@media (max-width: 900px) {
  .pilot-table-wrap { overflow-x: auto; }
  .pilot-table { min-width: 980px; }
  .pl-hint { margin-left: 0; }
}

/* ---------- Кнопка входа и модальное окно ---------- */

.btn-login {
  margin-left: 14px;
  padding: 9px 22px;
  border: none;
  border-radius: 999px;
  background: var(--green-deep);
  color: #F4F6EF;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease, transform .15s ease;
}
.btn-login:hover { background: var(--green); transform: translateY(-1px); }
.btn-login:active { transform: translateY(0); }

.btn-login--user {
  background: var(--card);
  color: var(--green-deep);
  border: 1.5px solid var(--green-deep);
}
.btn-login--user:hover { background: var(--green-deep); color: #F4F6EF; }

/* Выпадающее меню пользователя: живёт в нижней части сайдбара,
   раскрывается вверх */
.sidebar-user { position: relative; }

.user-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  z-index: 90;
  min-width: 240px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(44, 49, 40, .18);
  padding: 10px;
}
.user-menu[hidden] { display: none; }

.user-menu-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 12px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.user-menu-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.user-menu-role {
  display: inline-flex;
  align-self: flex-start;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.user-menu-item {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border: none;
  border-radius: 9px;
  background: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.user-menu-item:hover { background: var(--paper); }
/* display:block выше перебивает атрибут hidden — без этого правила
   «Пилот: режим администратора» и «Сменить пароль» видны всем */
.user-menu-item[hidden] { display: none; }
.user-menu-logout { color: #A5483D; font-weight: 650; }
.user-menu-logout:hover { background: #F7ECEA; }

/* Сообщения в форме входа */
.login-msg {
  margin: 0;
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.45;
}
.login-msg[hidden] { display: none; }
.login-msg--error { background: #F7ECEA; color: #A5483D; border: 1px solid #E5C6C0; }
.login-msg--note { background: var(--gold-soft); color: var(--ink); border: 1px solid var(--line); }
.resend-link { display: block; margin: -8px 0 12px; font-size: 12px; color: var(--green-deep); text-decoration: underline; }
.resend-link:hover { color: var(--ink); }
.resend-link[hidden] { display: none; }

body.modal-open { overflow: hidden; }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(44, 49, 40, 0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.modal-overlay[hidden] { display: none; }

.modal {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(44, 49, 40, .22);
  padding: 30px 30px 26px;
}
.modal h2 {
  margin: 0 0 20px;
  font-size: 24px;
  color: var(--ink);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 15px;
  cursor: pointer;
}
.modal-close:hover { background: var(--gold-soft); color: var(--ink); }

.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 650; color: var(--ink-soft); }
/* display:flex выше перебивает [hidden] из UA-стилей — скрываем явно (поле «Повторите пароль» видно только в режиме регистрации) */
.login-form label[hidden] { display: none; }
.login-form input {
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  background: var(--paper);
}
.login-form input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(124,139,108,.18); }

.btn-primary {
  margin-top: 4px;
  padding: 12px 18px;
  border: none;
  border-radius: 12px;
  background: var(--green-deep);
  color: #F4F6EF;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary:hover { background: var(--green); }

.modal-alt {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: var(--ink-soft);
}
.btn-register {
  padding: 8px 16px;
  border: 1.5px solid var(--green-deep);
  border-radius: 999px;
  color: var(--green-deep);
  font-weight: 700;
  font-size: 13.5px;
  text-decoration: none;
}
.btn-register:hover { background: var(--green-deep); color: #F4F6EF; }

@media (prefers-reduced-motion: reduce) {
  .btn-login { transition: none; }
}

/* ---------- Страница «Модели» ---------- */

/* отступ между разделителем заголовка и первым спойлером */
.section-head + .spoiler { margin-top: 32px; }

/* спойлеры разделов */
.spoiler {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  overflow: hidden;
}
.spoiler + .spoiler { margin-top: 16px; }

.spoiler-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 18px 22px;
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background .15s ease;
}
.spoiler-toggle:hover { background: var(--paper); }

.spoiler-title {
  font-size: 18px;
  font-weight: 750;
  color: var(--green-deep);
}

.spoiler-chevron {
  flex: none;
  width: 12px;
  height: 12px;
  border-right: 2.5px solid var(--green-deep);
  border-bottom: 2.5px solid var(--green-deep);
  transform: rotate(45deg);
  transition: transform .2s ease;
}
.spoiler--open .spoiler-chevron { transform: rotate(-135deg); }

.spoiler-body {
  padding: 4px 22px 26px;
  border-top: 1px solid var(--line);
  overflow: hidden;
}
.spoiler-body[hidden] { display: none; }

.spoiler-cta { margin-top: 16px; }
.spoiler-cta:disabled {
  background: var(--line);
  color: var(--ink-soft);
  cursor: default;
}

.models-section { margin-top: 22px; }

.models-title {
  margin: 0 0 20px;
  font-size: 22px;
  font-weight: 750;
  color: var(--green-deep);
}

.models-divider {
  margin: 40px 0 36px;
  border: none;
  border-top: 1px solid var(--line);
}

.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}

.model-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: box-shadow .2s ease, transform .15s ease, border-color .2s ease;
}
.model-card:hover {
  border-color: var(--green);
  box-shadow: 0 10px 28px rgba(44, 49, 40, .10);
  transform: translateY(-2px);
}

.model-card-media {
  display: block;
  aspect-ratio: 8 / 5;
  background: #F1EEE4;
  border-bottom: 1px solid var(--line);
}
.model-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.model-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px 16px;
}
.model-card-name {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--ink);
}
.model-card-sub {
  font-size: 13px;
  color: var(--ink-soft);
}

.model-card--placeholder .model-card-media img { opacity: .85; }

/* скелетоны загрузки */
.model-card--skeleton {
  cursor: default;
  pointer-events: none;
  min-height: 230px;
  background:
    linear-gradient(100deg, transparent 30%, rgba(255,255,255,.65) 50%, transparent 70%) 0 0 / 200% 100%,
    var(--card);
  animation: model-shimmer 1.4s linear infinite;
}
@keyframes model-shimmer {
  from { background-position: 200% 0, 0 0; }
  to { background-position: -100% 0, 0 0; }
}

/* состояния ошибки и пустого результата */
.models-error, .models-empty {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 18px 20px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--card);
  font-size: 14px;
  color: var(--ink-soft);
}
.models-retry { flex: none; }

/* модальное окно подробностей */
.modal--model { max-width: 460px; }

.mm-media {
  margin: -6px -6px 18px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #F1EEE4;
  aspect-ratio: 8 / 5;
}
.mm-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal--model h2 { margin: 0 0 10px; font-size: 22px; }

.mm-desc {
  margin: 0 0 14px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
}

.mm-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.tag-chip {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 650;
}

.mm-source {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 18px;
}

.mm-actions { display: flex; }
.mm-btn {
  display: inline-block;
  text-decoration: none;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}
.mm-btn:disabled {
  background: var(--line);
  color: var(--ink-soft);
  cursor: default;
}

@media (prefers-reduced-motion: reduce) {
  .model-card { transition: none; }
  .model-card--skeleton { animation: none; }
}

/* ---------- Страница «Агенты и навыки» ---------- */

/* сетка навыков */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 22px;
}

/* карточка навыка: иконка файла + название */
.skill-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 26px 16px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  transition: box-shadow .2s ease, transform .15s ease, border-color .2s ease;
}
.skill-card:hover {
  border-color: var(--green);
  box-shadow: 0 10px 28px rgba(44, 49, 40, .10);
  transform: translateY(-2px);
}

.skill-card-icon {
  position: relative;
  width: 46px;
  height: 58px;
  border: 2px solid var(--green-deep);
  border-radius: 6px;
  background: var(--paper);
}
.skill-card-icon::before {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background: var(--card);
  border-left: 2px solid var(--green-deep);
  border-bottom: 2px solid var(--green-deep);
  border-radius: 0 4px 0 6px;
}
.skill-card-icon::after {
  content: '';
  position: absolute;
  left: 9px;
  right: 9px;
  top: 20px;
  height: 18px;
  background:
    linear-gradient(var(--green) 0 0) 0 0 / 100% 2.5px no-repeat,
    linear-gradient(var(--green) 0 0) 0 7.5px / 100% 2.5px no-repeat,
    linear-gradient(var(--gold) 0 0) 0 15px / 70% 2.5px no-repeat;
}

.skill-card-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}
.skill-card-domain {
  font-size: 12.5px;
  color: var(--ink-soft);
}

/* модальное окно навыка */
.skill-meta {
  margin: 0 0 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.skill-meta-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.skill-meta-row dt {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-soft);
}
.skill-meta-row dd {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
}

.skill-actions {
  flex-direction: column;
  gap: 10px;
}

@media (prefers-reduced-motion: reduce) {
  .skill-card { transition: none; }
}

/* ============================================================
   Рабочее пространство: золотая кнопка на главной + чат-панель
   ============================================================ */

/* --- Акцентная кнопка-плашка на главной --- */

.tile--workspace {
  grid-column: span 6;
  min-height: 96px;
  border: none;
  background:
    radial-gradient(800px 300px at 85% -40%, rgba(255, 255, 255, .35), transparent 60%),
    linear-gradient(135deg, var(--gold) 0%, #A98A3F 100%);
  color: #2C3128;
  font-family: inherit;
  font-size: inherit;
  text-align: left;
  cursor: pointer;
}
.tile[hidden] { display: none; }

.tile--workspace .tile-title { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.tile--workspace .tile-sub { margin-top: 6px; font-size: 14px; color: rgba(44, 49, 40, .72); }
.tile--workspace::after { color: #2C3128; }

/* --- Overlay и панель --- */

.ws-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(44, 49, 40, 0); /* затемнение появляется с классом */
  transition: background .3s ease;
}
.ws-overlay[hidden] { display: none; }
.ws-overlay.ws-overlay--show { background: rgba(44, 49, 40, .45); }

.ws-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 120;
  width: 560px;
  max-width: 100vw;
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: -16px 0 40px rgba(44, 49, 40, .18);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s ease;
}
.ws-panel[hidden] { display: none; }
.ws-panel.ws-open { transform: translateX(0); }
body.ws-dragging .ws-panel { transition: none; }
body.ws-dragging { user-select: none; }

/* хендл растягивания за левой кромкой */
.ws-grip {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 6;
  background: transparent;
}
.ws-grip:hover { background: rgba(194, 160, 84, .35); }

/* --- Шапка панели --- */

.ws-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.ws-head-title h2 { font-size: 18px; letter-spacing: -.01em; }
.ws-model-label { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-soft); }
.ws-head-actions { display: flex; gap: 6px; flex: none; }

.ws-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 9px;
  background: var(--paper-soft);
  color: var(--ink-soft);
  font-size: 15px;
  cursor: pointer;
}
.ws-btn:hover { background: var(--gold-soft); color: var(--ink); }

/* --- Лента сообщений --- */

.ws-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ws-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.ws-msg--user {
  align-self: flex-end;
  background: var(--green-deep);
  color: var(--green-ink);
  border-bottom-right-radius: 4px;
}
.ws-msg--assistant {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

/* индикатор «печатает…» */
.ws-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.ws-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-soft);
  animation: ws-blink 1.2s infinite ease-in-out;
}
.ws-typing span:nth-child(2) { animation-delay: .2s; }
.ws-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes ws-blink {
  0%, 60%, 100% { opacity: .25; }
  30% { opacity: 1; }
}

/* --- Поповер настроек LLM --- */

.ws-settings {
  position: absolute;
  top: 64px;
  right: 16px;
  z-index: 10;
  width: 320px;
  max-width: calc(100% - 32px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lift);
  padding: 16px;
}
.ws-settings[hidden] { display: none; }
.ws-settings-title { font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.ws-settings-list { display: flex; flex-direction: column; gap: 2px; }
.ws-model-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13.5px;
}
.ws-model-option:hover { background: var(--paper-soft); }
.ws-model-option input { margin-top: 3px; accent-color: var(--green-deep); }
.ws-model-name { display: block; font-weight: 650; }
.ws-model-sub { display: block; font-size: 12px; color: var(--ink-soft); }

/* --- Композер --- */

.ws-composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--card);
  flex: none;
}
.ws-composer textarea {
  flex: 1;
  resize: none;
  max-height: 140px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  background: var(--paper);
}
.ws-composer textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(124, 139, 108, .18); }
.ws-send {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: var(--green-deep);
  color: var(--green-ink);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  flex: none;
}
.ws-send:hover { background: var(--green); }

/* --- Выбор навыка в композере --- */

.ws-skillpick { position: relative; flex: none; }
.ws-skillpick[hidden] { display: none; }
.ws-skillpick-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 17px;
  cursor: pointer;
}
.ws-skillpick-btn:hover { background: var(--gold-soft); color: var(--ink); border-color: var(--gold); }
.ws-skillpick-btn[aria-expanded="true"] { background: var(--gold-soft); color: var(--ink); border-color: var(--gold); }
.ws-skillpick-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 240px;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 12px 32px rgba(44, 49, 40, .16);
  z-index: 20;
}
.ws-skillpick-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: none;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-skillpick-item:hover { background: var(--paper-soft); }
.ws-skillpick-empty {
  padding: 10px;
  font-size: 13px;
  color: var(--ink-soft);
}

/* --- Адаптив --- */

@media (max-width: 560px) {
  .ws-panel { width: 100vw !important; max-width: 100vw; }
  .ws-grip { display: none; }
  .ws-head { padding: 14px 16px; }
  .ws-messages { padding: 16px; }
  .ws-composer { padding: 12px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .ws-overlay, .ws-panel { transition: none; }
  .ws-typing span { animation: none; }
  .ws-cursor { animation: none; }
}

/* ---------- Рабочее пространство: клиент AIOS Harness ---------- */

/* Потоковый текст ассистента и курсор печати */
.ws-msg-text { white-space: pre-wrap; overflow-wrap: break-word; }

.ws-cursor {
  display: inline-block;
  width: 8px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--gold);
  animation: ws-blink 1s steps(1) infinite;
}

@keyframes ws-blink {
  50% { opacity: 0; }
}

.ws-msg--error { border-color: #D9B2AD; background: #F7ECEA; }
.ws-msg--error .ws-msg-text { color: #A3413B; }

/* Карточка вызова инструмента */
.ws-tool {
  margin: 6px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-soft);
  overflow: hidden;
}

.ws-tool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 12px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
}

.ws-tool-head:hover { background: var(--gold-soft); color: var(--ink); }

.ws-tool-name { font-weight: 600; }
.ws-tool-chev { transition: transform .2s ease; }
.ws-tool-head[aria-expanded="true"] .ws-tool-chev { transform: rotate(180deg); }

.ws-tool-body { padding: 0 12px 10px; }

.ws-tool-body pre {
  margin: 0;
  max-height: 240px;
  overflow: auto;
  font-size: 11.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  color: var(--ink-soft);
}

.ws-tool--ok .ws-tool-name::after { content: ' · готово'; color: var(--green-deep); }

.ws-tool--err { border-color: #D9B2AD; }
.ws-tool--err .ws-tool-name::after { content: ' · ошибка'; color: #A3413B; }

/* Markdown в сообщениях ассистента (безопасный мини-рендер) */
.ws-msg--md, .ws-msg--md .ws-msg-text { white-space: normal; }
.ws-msg--md { max-width: 92%; }
.ws-msg--md p { margin: 0 0 8px; }
.ws-msg--md p:last-child { margin-bottom: 0; }
.ws-msg--md h1, .ws-msg--md h2, .ws-msg--md h3, .ws-msg--md h4 {
  margin: 10px 0 6px;
  line-height: 1.3;
  letter-spacing: -.01em;
}
.ws-msg--md h1 { font-size: 16.5px; }
.ws-msg--md h2 { font-size: 15.5px; }
.ws-msg--md h3, .ws-msg--md h4 { font-size: 14.5px; }
.ws-msg--md h1:first-child, .ws-msg--md h2:first-child,
.ws-msg--md h3:first-child, .ws-msg--md h4:first-child { margin-top: 0; }
.ws-msg--md ul, .ws-msg--md ol { margin: 2px 0 8px; padding-left: 20px; }
.ws-msg--md li { margin: 2px 0; }
.ws-msg--md li > ul, .ws-msg--md li > ol { margin: 2px 0; }
.ws-msg--md blockquote {
  margin: 6px 0;
  padding: 4px 12px;
  border-left: 3px solid var(--gold);
  background: rgba(233, 220, 187, .3);
  border-radius: 0 8px 8px 0;
  color: var(--ink-soft);
}
.ws-msg--md hr { border: none; border-top: 1px solid var(--line); margin: 10px 0; }
.ws-msg--md a { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }
.ws-msg--md a:hover { color: var(--green-deep); }
.ws-msg--md del { opacity: .6; }
.ws-msg--md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em;
  background: rgba(194, 160, 84, .14);
  border: 1px solid rgba(194, 160, 84, .28);
  border-radius: 5px;
  padding: 1px 5px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.ws-msg--md pre.ws-code {
  margin: 6px 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--green-deep);
  color: var(--green-ink);
  overflow-x: auto;
}
.ws-msg--md pre.ws-code code {
  display: block;
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  color: inherit;
}
.ws-msg--md table {
  border-collapse: collapse;
  margin: 6px 0 10px;
  font-size: 13px;
  display: block;
  max-width: 100%;
  overflow-x: auto;
}
.ws-msg--md th, .ws-msg--md td {
  border: 1px solid var(--line);
  padding: 5px 9px;
  text-align: left;
  vertical-align: top;
}
.ws-msg--md th { background: rgba(233, 220, 187, .5); font-weight: 650; }

/* Карточки инструментов и прочие дети ленты не должны сплющиваться
   в полоску: overflow:hidden у .ws-tool давал min-content 0, и
   flexbox сжимал карточку до нуля при длинном контенте */
.ws-messages > * { flex-shrink: 0; }

/* Индикация генерации: пульсирующая золотая точка в шапке панели
   и на триггерах (плашка на главной, пункт меню) */
.ws-live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
  flex: none;
  animation: ws-pulse 1.4s ease-out infinite;
}
.ws-live-dot[hidden] { display: none; }
.ws-trigger-busy { position: relative; }
.ws-trigger-busy::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  border: 1.5px solid var(--paper);
  animation: ws-pulse 1.4s ease-out infinite;
}
@keyframes ws-pulse {
  0% { box-shadow: 0 0 0 0 rgba(194, 160, 84, .55); }
  70% { box-shadow: 0 0 0 9px rgba(194, 160, 84, 0); }
  100% { box-shadow: 0 0 0 0 rgba(194, 160, 84, 0); }
}

/* Плашка «Ответ готов», когда панель свернули во время генерации */
.ws-ready-badge {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 130;
  padding: 10px 18px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 650;
  box-shadow: var(--shadow-lift);
  cursor: pointer;
  animation: ws-badge-in .25s ease;
}
.ws-ready-badge[hidden] { display: none; }
.ws-ready-badge:hover { background: var(--gold-soft); }
@keyframes ws-badge-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ws-live-dot, .ws-trigger-busy::after { animation: none; }
  .ws-ready-badge { animation: none; }
}

/* ---------- Админ-панель ---------- */

.admin-denied { margin-top: 28px; }
.admin-denied[hidden] { display: none; }
.admin-denied-hint { margin-top: 12px; font-size: 14px; color: var(--ink-soft); }

.admin-wrap { margin-top: 28px; }
.admin-wrap[hidden] { display: none; }

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.admin-count { margin: 0; font-size: 14px; color: var(--ink-soft); }
.admin-count span { font-weight: 700; color: var(--ink); }

.admin-msg { margin: 0 0 14px; }

.admin-table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th {
  background: var(--green-deep);
  color: #F4F6EF;
  font-size: 12px;
  font-weight: 650;
  text-align: left;
  padding: 11px 12px;
  line-height: 1.35;
  vertical-align: bottom;
  white-space: nowrap;
}
.admin-table td {
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
  line-height: 1.3;
}
.admin-table tbody tr:hover td { background: #F7F5EE; }

.at-num { width: 34px; font-weight: 750; color: var(--ink-soft); }
.at-name { font-weight: 650; color: var(--green-deep); min-width: 150px; }
.at-login { color: var(--ink-soft); }
.at-date { white-space: nowrap; color: var(--ink-soft); font-size: 13px; }
.at-actions { width: 1%; white-space: nowrap; }
.at-self { font-size: 12px; color: var(--ink-soft); font-weight: 600; }

.role-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.role-pill--admin { background: #F0E3C3; color: #7A6028; }
.role-pill--user { background: #E7ECDF; color: var(--green-deep); }

.adm-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.adm-btn {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.adm-btn:hover { border-color: var(--green); color: var(--green-deep); }
.adm-btn--danger { color: #A5483D; }
.adm-btn--danger:hover { background: #F7ECEA; border-color: #E5C6C0; }

/* ссылка «Войти» в режиме регистрации модалки */
.btn-login-alt[hidden] { display: none; }

/* ---------- Админ-панель: настройки внешних API (LLM) ---------- */

.admin-h2 {
  margin: 0;
  font-size: 19px;
  color: var(--ink);
}

.admin-wrap--llm { margin-bottom: 34px; }

.llm-form {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.llm-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-soft);
}
.llm-form label em { font-style: normal; font-weight: 500; color: var(--ink-soft); }
.llm-form input {
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  background: var(--paper);
}
.llm-form input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(124,139,108,.18);
}

.llm-model-row { display: flex; gap: 8px; }
.llm-model-row input { flex: 1; min-width: 0; }

.llm-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.llm-save { margin-top: 0; }

/* метка «LLM не настроена» в рабочем пространстве */
.ws-model-label--off { color: #A5483D; font-weight: 600; }

/* ---------- Админ-панель: раздел «Об организации» ---------- */

.admin-wrap--org { margin-top: 28px; }

.org-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 22px 24px;
  margin-bottom: 24px;
}
.org-card[hidden] { display: none; }

.org-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.org-h3 { margin: 0; font-size: 17px; color: var(--ink); }
.org-h4 {
  margin: 0 0 12px;
  font-size: 13.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.org-type {
  font-size: 12px;
  font-weight: 650;
  color: var(--green-deep);
  background: #E7ECDF;
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.org-form {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.org-form[hidden] { display: none; }

.org-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.org-field-title { font-weight: 650; color: var(--ink-soft); }
.org-field input,
.org-field textarea,
.org-source input,
.org-upload-form input,
.org-upload-form textarea,
.org-edit-form input,
.org-edit-form select,
.org-edit-form textarea {
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14.5px;
  background: var(--paper);
  color: var(--ink);
}
.org-field textarea { resize: vertical; line-height: 1.45; }
.org-field input:focus,
.org-field textarea:focus,
.org-source input:focus,
.org-upload-form input:focus,
.org-upload-form textarea:focus,
.org-edit-form input:focus,
.org-edit-form select:focus,
.org-edit-form textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(124,139,108,.18);
}
.org-field--metric input { max-width: 320px; }

.org-source { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 650; color: var(--ink-soft); }

.org-aliases { display: flex; flex-direction: column; gap: 8px; }
.org-alias-row { display: flex; gap: 8px; align-items: stretch; }
.org-alias-row input { flex: 1; min-width: 0; }
.org-alias-del {
  width: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
}
.org-alias-del:hover { border-color: #E5C6C0; background: #F7ECEA; color: #A5483D; }
.org-alias-add { align-self: flex-start; margin-top: 2px; }

.org-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.org-save { margin-top: 0; }
.org-updated { font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }

/* --- документы организации --- */

.org-doc-group { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.org-doc-group:first-child { border-top: none; margin-top: 8px; padding-top: 0; }

.org-doc-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.org-doc-group-head .org-h4 { margin: 0; }
.org-doc-count {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #E7ECDF;
  color: var(--green-deep);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.org-doc-list { display: flex; flex-direction: column; gap: 10px; }
.org-doc-empty { margin: 0 0 4px; font-size: 13px; color: var(--ink-soft); }

.org-doc {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  overflow: hidden;
}
.org-doc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.org-doc-main {
  flex: 1;
  min-width: 240px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
}
.org-doc-main:hover .org-doc-title { color: var(--green-deep); text-decoration: underline; }
.org-doc-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #F0E3C3;
  color: #7A6028;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
}
.org-doc-icon[data-ext="pdf"] { background: #F7E0DC; color: #A3413B; }
.org-doc-icon[data-ext="doc"],
.org-doc-icon[data-ext="docx"],
.org-doc-icon[data-ext="rtf"],
.org-doc-icon[data-ext="odt"] { background: #E3ECF4; color: #2E5E8C; }
.org-doc-icon[data-ext="xls"],
.org-doc-icon[data-ext="xlsx"],
.org-doc-icon[data-ext="csv"] { background: #E3F1E6; color: #2F7A45; }
.org-doc-icon[data-ext="ppt"],
.org-doc-icon[data-ext="pptx"] { background: #FBE9D6; color: #B4622A; }
.org-doc-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.org-doc-title { font-weight: 650; font-size: 14.5px; overflow-wrap: anywhere; }
.org-doc-meta { font-size: 12.5px; color: var(--ink-soft); overflow-wrap: anywhere; }
.org-doc-side { display: flex; gap: 8px; padding: 0 14px; flex-wrap: wrap; }

.org-doc-summary {
  border-top: 1px dashed var(--line);
  padding: 10px 14px 12px;
  font-size: 13px;
  color: var(--ink-soft);
}
.org-doc-summary[hidden] { display: none; }
.org-doc-summary-title {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.org-doc-summary pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
  line-height: 1.45;
  max-height: 200px;
  overflow: auto;
}
.org-doc-summary--empty { font-style: italic; }

.org-upload-form,
.org-edit-form {
  margin-top: 10px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13px;
}
.org-upload-form[hidden] { display: none; }
.org-upload-form label,
.org-edit-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 650; color: var(--ink-soft); }
.org-edit-form { border-top: none; padding-top: 0; }

@media (max-width: 900px) {
  .org-doc-main { min-width: 100%; }
  .org-doc-side { padding: 0 14px 12px; }
}


@media (max-width: 900px) {
  .admin-table-wrap { overflow-x: auto; }
  .admin-table { min-width: 860px; }
}
/* ---------- Страница «Кабинет» ---------- */

.cab-wrap { margin-top: 28px; }

.cab-denied {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 26px 28px;
}
.cab-denied[hidden] { display: none; }
.cab-denied p { margin: 0; }
.cab-denied .login-msg { margin-bottom: 10px; }
.cab-denied-hint { color: var(--ink-soft); font-size: 13.5px; }
.cab-link-btn {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-weight: 650;
  color: var(--green-deep);
  text-decoration: underline;
  cursor: pointer;
}
.cab-link-btn:hover { color: var(--green); }

.cab-card { margin-top: 0; }
.cab-card[hidden] { display: none; }

.cab-note { margin: 6px 0 0; font-size: 13px; color: var(--ink-soft); }

.cab-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 900px) {
  .cab-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Рабочий чат: быстрые ответы (aios-choices),
   ссылка на «Проекты» после сохранения карточки
   ============================================================ */

/* метка навыка на первом сообщении нового диалога */
.ws-msg-skill {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--gold-soft);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: baseline;
}

/* быстрые ответы: кнопки вместо fenced-блока aios-choices */
.ws-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.ws-choice-btn {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}

.ws-choice-btn:hover:not(:disabled) {
  background: var(--gold-soft);
  border-color: rgba(194, 160, 84, .55);
}

.ws-choice-btn:disabled { opacity: .45; cursor: default; }

/* путь на «Проекты» после save_project_card */
.ws-projects-action { text-align: right; }

.ws-projects-link {
  display: inline-block;
  margin-top: 6px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-soft);
  color: var(--green-deep);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.ws-projects-link:hover { background: var(--gold-soft); }

/* ============================================================
   «Проекты»: сетка карточек
   ============================================================ */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 32px;
}

.prj-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper-soft);
  text-align: left;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}

.prj-card:hover { border-color: rgba(194, 160, 84, .55); }
.prj-card--draft { border-style: dashed; }

.prj-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.prj-card-title { font-weight: 700; font-size: 16px; }

.prj-card-sub { font-size: 12.5px; color: var(--ink-soft); }

.prj-card-desc { font-size: 13.5px; line-height: 1.45; }

.prj-card-foot { font-size: 12px; color: var(--ink-soft); }

.prj-status {
  flex: none;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.prj-status--active { background: rgba(124, 139, 108, .18); color: var(--green-deep); }
.prj-status--draft { background: var(--gold-soft); color: var(--ink-soft); }

.prj-empty-actions { margin-top: 18px; }

/* ---------- правка/удаление карточки, полная ширина ---------- */

/* страница «Проекты» и карточка проекта — на всю ширину окна */
.page--full { max-width: none; }

.modal--project {
  max-width: 1500px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.prj-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.prj-btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.prj-btn-ghost:hover { background: var(--gold-soft); border-color: rgba(194, 160, 84, .55); }

.prj-btn-danger {
  background: transparent;
  color: #a33a2a;
  border: 1px solid rgba(163, 58, 42, .35);
}
.prj-btn-danger:hover { background: rgba(163, 58, 42, .08); border-color: rgba(163, 58, 42, .6); }

.prj-btn-danger[disabled], .prj-btn-ghost[disabled] { opacity: .55; cursor: default; }

.prj-edit-form { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.prj-edit-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-soft);
}
.prj-edit-form label.prj-edit-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--ink);
}
.prj-edit-form input[type="text"],
.prj-edit-form textarea {
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  resize: vertical;
}
.prj-edit-form input[type="text"]:focus,
.prj-edit-form textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(124, 139, 108, .18);
}

.cab-denied .btn-primary { margin-top: 10px; }

/* ============================================================
   3D-визуализация онтологии (ontology.html)
   ============================================================ */

.page--wide { max-width: 1400px; }

.onto3d-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.onto3d-label { font-size: 14px; color: var(--ink-soft); }

.onto3d-select {
  min-width: 260px;
  max-width: 420px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.onto3d-meta { font-size: 13px; color: var(--ink-soft); }

.onto3d-wrap {
  position: relative;
  margin-top: 14px;
  height: 560px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse at 30% 20%, rgba(124, 139, 108, .10), transparent 55%),
    radial-gradient(ellipse at 75% 80%, rgba(194, 160, 84, .10), transparent 55%),
    var(--card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.onto3d-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.onto3d-help {
  position: absolute;
  left: 14px;
  bottom: 12px;
  font-size: 12px;
  color: var(--ink-soft);
  background: rgba(250, 248, 243, .82);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  pointer-events: none;
}

.onto3d-legend {
  position: absolute;
  top: 12px;
  left: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 46%;
  pointer-events: none;
}

.onto3d-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink);
  background: rgba(250, 248, 243, .85);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}

.onto3d-legend-chip i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.onto3d-side {
  position: absolute;
  top: 12px;
  right: 12px;
  width: min(340px, calc(100% - 28px));
  max-height: calc(100% - 24px);
  overflow: auto;
  padding: 18px 20px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(250, 248, 243, .96);
  box-shadow: var(--shadow-card);
}

.onto3d-side-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: none;
  font-size: 20px;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
}

.onto3d-side-name { font-size: 18px; }

.onto3d-side-desc { margin-top: 6px; font-size: 13.5px; color: var(--ink-soft); }

.onto3d-side-block { margin-top: 14px; }
.onto3d-side-block h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.onto3d-side-block ul { margin: 6px 0 0 16px; font-size: 13.5px; }

.onto3d-side-link {
  border: none;
  background: none;
  padding: 2px 0;
  color: var(--green-deep);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}

.onto3d-side-link:hover { text-decoration: underline; }

.onto3d-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  font-size: 15px;
  color: var(--ink-soft);
  background: rgba(250, 248, 243, .9);
}

.onto3d-cq { margin-top: 26px; }
.onto3d-cq h2 { font-size: 18px; }
.onto3d-cq ul { margin: 12px 0 0 18px; }
.onto3d-cq li { margin-bottom: 10px; }
.onto3d-cq-q { font-size: 14.5px; }
.onto3d-cq-path {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--green-deep);
  background: var(--paper-soft);
  border-radius: 6px;
  padding: 2px 8px;
}

/* CTA «Сконструировать онтологию» в спойлере «Онтологии» (knowledge.html) */
.onto-cta { margin-bottom: 14px; text-align: right; }

@media (max-width: 720px) {
  .onto3d-wrap { height: 420px; }
  .onto3d-legend { max-width: 100%; }
}



/* ---------- Кабинет: сворачиваемые разделы ---------- */

.cab-sec-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 2px 0;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.cab-sec-title { flex: 1; min-width: 0; }

.cab-sec-chev {
  flex: none;
  width: 9px;
  height: 9px;
  margin-right: 2px;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  transform: rotate(45deg);
  transition: transform .2s ease;
}
.cab-sec-head .cab-sec-chev { transform: rotate(-135deg); }
.cab-sec-head--closed .cab-sec-chev { transform: rotate(45deg); }
.cab-sec-head:hover .cab-sec-title,
.cab-project-head:hover .cab-project-title { color: var(--green-deep); }

.cab-sec-body {
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.cab-empty { margin: 0; font-size: 13px; color: var(--ink-soft); }

.cab-sec-head:focus-visible,
.cab-session-open:focus-visible,
.cab-session-del:focus-visible,
.cab-project-head:focus-visible,
.cab-artifact:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Кабинет: история сессий ---------- */

.cab-sessions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 6px;
}
.cab-sessions::-webkit-scrollbar { width: 6px; }
.cab-sessions::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.cab-session {
  display: flex;
  align-items: stretch;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}
.cab-session-open {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 14px;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-md);
}
.cab-session-open:hover .cab-session-title { color: var(--green-deep); }
.cab-session-title {
  font-weight: 650;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cab-session-meta { font-size: 12px; color: var(--ink-soft); }
.cab-session-del {
  flex: none;
  width: 34px;
  border: none;
  background: none;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.cab-session-del:hover { background: #F7ECEA; color: #A5483D; }

/* ---------- Кабинет: результаты работы ---------- */

.cab-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cab-project {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}
.cab-project--draft { border-style: dashed; }

.cab-project-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.cab-project-title {
  flex: 1;
  min-width: 0;
  font-weight: 650;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cab-role {
  flex: none;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
}
.cab-role--owner { background: var(--green); color: var(--green-ink); }
.cab-role--participant { background: var(--paper-soft); color: var(--green-deep); border: 1px solid var(--line); }
.cab-project-head--open .cab-sec-chev { transform: rotate(-135deg); }

.cab-project-body {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--line);
}

.cab-project-row {
  display: flex;
  gap: 12px;
  padding: 3px 0;
  font-size: 13.5px;
  line-height: 1.45;
}
.cab-project-label { flex: none; width: 148px; color: var(--ink-soft); }
.cab-project-value { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cab-project-sub {
  margin: 14px 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-soft);
}

.cab-artifacts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
.cab-artifact {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 13px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.cab-artifact:hover {
  border-color: var(--green);
  box-shadow: var(--shadow-lift);
  transform: translateY(-1px);
}
.cab-artifact-kind {
  font-size: 10.5px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--green-deep);
}
.cab-artifact-name { font-size: 13.5px; font-weight: 650; }
.cab-artifact-meta { font-size: 12px; color: var(--ink-soft); }

/* ---------- Кабинет: адаптив ---------- */

@media (max-width: 560px) {
  .cab-project-row { flex-direction: column; gap: 1px; }
  .cab-project-label { width: auto; }
  .cab-artifacts { grid-template-columns: 1fr; }
  .cab-project-head { flex-wrap: wrap; }
}

/* ============================================================
   Кабинет — прогресс-бар этапов
   ============================================================ */

.cab-progress { padding: 16px 20px 14px; }
.cab-progress[hidden] { display: none; }

.cab-progress-bar {
  list-style: none;
  display: flex;
  align-items: flex-start;
}

.cab-progress-step {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 7px;
}

/* соединительная линия к следующему шагу */
.cab-progress-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 15px; /* центр кружка (32px / 2) */
  left: calc(50% + 22px);
  right: calc(-50% + 22px);
  height: 2px;
  background: var(--line);
}

.cab-progress-step--done:not(:last-child)::after { background: var(--green); }

.cab-progress-dot {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  background: var(--paper-soft);
  border: 1.5px solid var(--line);
  color: var(--ink-soft);
}

.cab-progress-step--done .cab-progress-dot {
  background: var(--green);
  border-color: var(--green);
  color: var(--green-ink);
}

.cab-progress-step--locked .cab-progress-dot {
  background: var(--paper);
  border-style: dashed;
  color: var(--ink-soft);
  opacity: .65;
}

.cab-progress-label {
  font-size: 12px;
  line-height: 1.3;
  color: var(--ink-soft);
  max-width: 110px;
}

.cab-progress-step--done .cab-progress-label {
  color: var(--green-deep);
  font-weight: 600;
}

.cab-progress-step--locked .cab-progress-label { opacity: .6; }

.cab-progress-check { width: 14px; height: 14px; display: block; }
.cab-progress-check path {
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cab-progress-hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--ink-soft);
}
.cab-progress-hint[hidden] { display: none; }

@media (max-width: 760px) {
  .cab-progress-bar { flex-wrap: wrap; row-gap: 14px; }
  .cab-progress-step { flex: 1 1 33%; }
  .cab-progress-step::after { display: none; }
}
