/* Оболочка приложения «ГосАссистент» — экран Чата (макет Figma, нода 36:867).
   Тёмный сайдбар + белый топбар + холст чата. Токен-слой — в :root ниже
   (позже консолидируется при рестайле остальных экранов). */
:root {
  --primary: #4032fe;
  --primary-hover: #3526d6;
  --accent: #4f3bfc;
  --sidebar-label: #3f30fd;
  --search-border: #4e3dfd;

  --canvas: #f8f9ff;
  --ink: #0b0b16;
  --muted: rgba(0, 0, 0, .4);

  --sidebar-grad: linear-gradient(180deg, #050506 0%, #100b30 100%);
  --white-muted: rgba(255, 255, 255, .29);
  --white-line: rgba(255, 255, 255, .12);

  --sk-group1: #e8eaf8;
  --sk-group2: #f7f8ff;

  --radius: 14px;
  --sidebar-w: 320px;
  --topbar-h: 96px;

  /* Совместимость со старым styles.css (страница услуги) — под новую палитру */
  --blue: #4032fe;
  --blue-dark: #3526d6;
  --blue-soft: #edf0ff;
  --text: #0b0b16;
  --white: #fff;
  --page-max: 1180px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }

body {
  min-width: 320px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img { display: block; }

.app-shell { position: relative; display: flex; height: 100vh; }

/* Стрелка свёртки — по центру правой границы сайдбара (половина заходит на контент, как в макете) */
.sidebar__collapse {
  position: absolute;
  top: 26px;
  left: calc(var(--sidebar-w) - 20px);
  z-index: 20;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  transition: left .18s ease;
}
.sidebar__collapse img { width: 40px; height: 40px; transition: transform .18s ease; }
.sidebar__collapse:hover { opacity: .88; }
.app-shell.sidebar-collapsed .sidebar__collapse { left: 56px; }        /* 76px рельс − 20 */
.app-shell.sidebar-collapsed .sidebar__collapse img { transform: rotate(180deg); }
/* Иконка кнопки: в развёрнутом — сплошной индиго (как раньше), в свёрнутом — тёмная с обводкой (макет) */
.sidebar__collapse .ic-collapsed { display: none; }
.sidebar-collapsed .sidebar__collapse .ic-expanded { display: none; }
.sidebar-collapsed .sidebar__collapse .ic-collapsed { display: block; }

/* ---------- Сайдбар ---------- */
.sidebar {
  position: relative;
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px 20px 24px;
  background: var(--sidebar-grad);
  border-radius: 0 20px 20px 0;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: flex-basis .18s ease, width .18s ease;
}

.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 8px; }

.sidebar__top {
  display: flex;
  align-items: center;
  min-height: 40px;
  margin-bottom: 20px;
}

/* Явные размеры резервируют место до загрузки PNG — иначе логотип «прыгает» при загрузке.
   Одинаково для портала и админки (общий chat.css) — оболочки идентичны. */
.sidebar__logo { width: 208px; height: 63px; }
.sidebar__mark { display: none; width: 30px; height: auto; aspect-ratio: 221 / 247; }

.sidebar__search-wrap { position: relative; margin-bottom: 18px; }
.sidebar__search {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 40px;
  padding: 0 18px;
  background: transparent;
  border: 1px solid var(--search-border);
  border-radius: 10px;
}
.sidebar__search img { width: 20px; height: 20px; flex: 0 0 20px; }
.sidebar__search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: #fff;
  font-size: 16px;
}
.sidebar__search input::placeholder { color: var(--search-border); opacity: 1; }
.sidebar__search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.sidebar__search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 25;
  max-height: 340px;
  overflow-y: auto;
  padding: 6px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 16px 38px rgba(0, 0, 0, .35);
}
.sidebar__search-results[hidden] { display: none; }
.s-result { display: block; padding: 10px 12px; color: var(--ink); text-decoration: none; border-radius: 8px; }
.s-result:hover { background: #f2f3fb; }
.s-result strong { display: block; font-size: 13px; font-weight: 700; }
.s-result span {
  display: -webkit-box;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.s-result--empty { cursor: default; }

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
  padding: 10px 12px;
  color: #fff;
  text-align: left;
  text-decoration: none;
  background: none;
  border: 0;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  transition: background .14s ease;
}
.nav-item img { width: 24px; height: 24px; flex: 0 0 24px; }
.nav-item svg { width: 24px; height: 24px; flex: 0 0 24px; }
.nav-item:hover { background: rgba(255, 255, 255, .07); }
.nav-item.is-active { background: rgba(79, 59, 252, .28); }

.sidebar__section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--white-line); }

.sidebar__label {
  margin: 0 0 10px;
  padding: 0 12px;
  color: var(--sidebar-label);
  font-size: 16px;
}

.sidebar__empty {
  margin: 6px 0;
  padding: 0 12px;
  color: var(--white-muted);
  font-size: 14px;
}
.sidebar__empty[hidden] { display: none; }

.sidebar__recent { display: flex; flex-direction: column; gap: 2px; }
.recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: rgba(255, 255, 255, .82);
  text-decoration: none;
  border-radius: 10px;
  font-size: 15px;
}
.recent-item svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .85; }
.recent-item--run svg { color: #ffba00; opacity: 1; }
.recent-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar-collapsed .sidebar__recent { display: none; }

.sidebar__more {
  display: block;
  width: 100%;
  padding: 8px 12px;
  color: var(--white-muted);
  text-align: left;
  text-decoration: none;
  background: none;
  border: 0;
  font-size: 16px;
  cursor: pointer;
}
.sidebar__more:hover { color: rgba(255, 255, 255, .55); }

.sidebar__bottom {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--white-line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ---------- Основная область ---------- */
.app-main {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: var(--topbar-h);
  padding: 0 40px;
  background: #fff;
  flex: 0 0 var(--topbar-h);
}

.topbar__skills { display: flex; align-items: center; gap: 16px; }
.skill-group { display: flex; align-items: center; gap: 12px; }
.skill[hidden], .skill-group[hidden], .topbar__divider[hidden] { display: none; }

/* Пункт меню «в разработке» (избранный, но ещё не рабочий навык) */
.skill-menu__item--soon { color: #8b8ea6; cursor: pointer; }
.skill-menu__item--soon:hover { border-color: rgba(100, 102, 147, .5); color: #8b8ea6; font-weight: 400; }
.skill-menu__tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff6df;
  color: #9b6500;
  font-size: 11px;
  white-space: nowrap;
}

.skill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  background: var(--sk-group2);
  border: 0;
  border-radius: 12px;
  box-shadow: 0 3.45px 1.7px rgba(100, 102, 147, .14);
  cursor: pointer;
  transition: transform .14s ease;
}
.skill:hover { transform: translateY(-1px); }
.skill img { width: 24px; height: 24px; flex: 0 0 24px; }
.skill-group--accent .skill { background: var(--sk-group1); }

/* Развёрнутый навык: пилюля с названием (макет 222:5057) */
.skill__name, .skill__chev { display: none; }
.skill.is-open { box-shadow: 0 0 0 2px rgba(63, 48, 253, .35); }
.skill--named.is-open {
  width: auto;
  gap: 10px;
  padding: 0 14px;
  box-shadow: -4px 0 0 0 #ffba00, 0 3.45px 3.45px rgba(100, 102, 147, .31);
}
.skill--named.is-open .skill__name { display: inline; font-size: 14px; font-weight: 700; color: #000; white-space: nowrap; }
.skill--named.is-open .skill__chev {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  background: rgba(216, 218, 241, .68);
  border-radius: 4px;
  color: #333;
}
.skill--named.is-open .skill__chev svg { width: 16px; height: 16px; }

/* Выпадающий список навыка (макет 229:414) */
.skill-menu {
  position: fixed;
  z-index: 60;
  width: 264px;
  padding: 10px 8px 8px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(100, 102, 147, .24);
}
.skill-menu[hidden] { display: none; }
.skill-menu__head {
  margin: 0 0 6px;
  padding: 4px 8px 8px;
  color: #111;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 1px solid #eceef6;
}
.skill-menu__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0;
  padding: 9px 10px;
  color: #646693;
  text-decoration: none;
  background: #fff;
  border: 1px solid rgba(100, 102, 147, .22);
  border-radius: 8px;
  font-size: 13px;
}
.skill-menu__item svg { width: 14px; height: 14px; flex: 0 0 14px; }
.skill-menu__item:hover { border-color: rgba(63, 48, 253, .7); color: var(--sidebar-label); font-weight: 700; }
.skill-menu__note { padding: 8px 10px 6px; color: var(--muted); font-size: 13px; line-height: 1.5; }

.topbar__divider { width: 1px; height: 47px; background: #dfe1f0; }

.topbar__user { display: flex; align-items: center; gap: 16px; }
.topbar__ident { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.topbar__ident strong { font-size: 16px; font-weight: 700; }
.topbar__ident span { font-size: 12px; color: #000; }
.topbar__avatar { width: 60px; height: 60px; border-radius: 50%; }

/* ---------- Холст ---------- */
.canvas {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 40px 64px;
}
/* На этих разделах показывается робот-подсказка (absolute, правый нижний угол).
   Увеличенный нижний отступ даёт прокрутить контент выше робота, чтобы он не перекрывал текст. */
.canvas--top { align-items: flex-start; padding-bottom: 190px; }   /* маркетплейс/услуга — сверху, чат — по центру */

.canvas__mincifry {
  position: absolute;
  right: 40px;
  bottom: 26px;
  width: 138px;
  height: auto;
  opacity: .9;
  pointer-events: none;
}

/* Виджет помощи (робот-Альт) — правый нижний угол. По умолчанию виден только робот;
   подсказка выезжает облачком при наведении/фокусе. */
.help-widget {
  position: absolute;
  right: 34px;
  bottom: 58px;
  z-index: 6;
  width: 76px;
}
.help-widget[hidden] { display: none; }
.help-widget__robot {
  position: relative;
  z-index: 1;
  display: block;
  width: 104px;
  padding: 0;
  background: radial-gradient(circle at 50% 46%, rgba(120, 92, 250, .22), transparent 60%);
  border: 0;
  cursor: pointer;
  transition: transform .16s ease;
}
.help-widget__robot img { width: 76px; height: auto; display: block; }
.help-widget:hover .help-widget__robot,
.help-widget:focus-within .help-widget__robot { transform: translateY(-2px) scale(1.03); }

.help-widget__text {
  position: absolute;
  right: calc(100% - 6px);
  bottom: 16px;
  width: 292px;
  padding: 12px 16px;
  text-align: right;
  background: rgba(255, 255, 255, .96);
  border-radius: 14px 14px 2px 14px;
  box-shadow: 0 10px 30px rgba(26, 39, 77, .12);
  opacity: 0;
  transform: translateX(10px) scale(.98);
  transform-origin: bottom right;
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}
.help-widget:hover .help-widget__text,
.help-widget:focus-within .help-widget__text { opacity: 1; transform: none; pointer-events: auto; }
.help-widget__title { margin: 0 0 6px; color: var(--accent); font-size: 13px; font-weight: 700; line-height: 1.35; }
.help-widget__link { padding: 0; background: none; border: 0; color: #666; font-size: 13px; cursor: pointer; }
.help-widget__link i { font-style: italic; text-decoration: underline; }

@media (max-width: 900px) { .help-widget { display: none; } }

/* ---------- Приветствие + поле ввода ---------- */
.chat { width: min(100%, 860px); display: flex; flex-direction: column; }

/* Активный диалог (макет 36:889): лента вопрос→ответ сверху, композер снизу */
.chat--active { height: 100%; }
.chat--active .chat__greeting { display: none; }

.chat__feed { display: none; }
.chat--active .chat__feed {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 2px 20px;
}

.msg { max-width: 86%; font-size: 15px; line-height: 1.55; color: var(--ink); }
.msg--user {
  align-self: flex-end;
  padding: 12px 20px;
  background: rgba(0, 0, 0, .04);
  border-radius: 18px;
  white-space: pre-wrap;
}
.msg--bot { align-self: flex-start; display: flex; flex-direction: column; align-items: flex-start; }
.msg--bot .msg__text { white-space: pre-wrap; }
.msg__text code {
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .05);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}
.msg__text strong { font-weight: 700; }
.msg__badge {
  margin-bottom: 8px;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
}
.msg--error .msg__text { color: #c62828; }
.msg__note { margin-top: 6px; color: var(--muted); font-size: 12px; }

/* Наводящие вопросы (макет 36:889): чипы под ответом, клик — задаёт вопрос */
.msg__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.msg__chip {
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, .04);
  color: #666;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.msg__chip:hover { background: var(--blue-soft); color: var(--blue); }

.msg--pending { align-self: flex-start; }
.msg__dots { display: inline-flex; gap: 5px; padding: 4px 0; }
.msg__dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: chatDots 1s infinite ease-in-out; }
.msg__dots i:nth-child(2) { animation-delay: .15s; }
.msg__dots i:nth-child(3) { animation-delay: .3s; }
@keyframes chatDots { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

.chat__greeting {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}
.chat__robot {
  width: 210px;
  height: auto;
  flex: 0 0 auto;
  /* мягкое свечение вместо запечённого бокса — плавно уходит в прозрачность */
  background: radial-gradient(circle at 48% 46%, rgba(120, 92, 250, .20), transparent 60%);
}
.chat__hello-title {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
}
.chat__hello-sub { margin: 0; color: #000; font-size: 16px; }

.composer {
  border: 1px solid #e6e6ee;
  border-radius: 18px;
  background: #fff;
  padding: 18px 20px 12px;
  box-shadow: 0 8px 24px rgba(26, 39, 77, .05);
}

.composer__input {
  width: 100%;
  border: 0;
  outline: none;
  color: var(--ink);
  font-size: 16px;
}
.composer__input::placeholder { color: var(--muted); }

.composer__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}
.composer__left, .composer__right { display: flex; align-items: center; gap: 10px; }

.composer__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: #6a6a80;
  background: none;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}
.composer__icon:hover { background: #f2f2f7; color: var(--primary); }
.composer__icon svg { width: 22px; height: 22px; }

.composer__send {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: #fff;
  background: #0b0b16;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.composer__send svg { width: 20px; height: 20px; }
.composer__send:hover { background: var(--primary); }

/* Вложения в композере (кнопка «+») */
.composer__files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.composer__files[hidden] { display: none; }
.composer__file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 240px;
  padding: 5px 6px 5px 12px;
  background: #f2f2f7;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink);
}
.composer__file > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer__file button {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .08);
  color: #444;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.composer__file button:hover { background: rgba(0, 0, 0, .16); }

/* Приложенные файлы в пузыре пользователя */
.msg__att { margin-top: 6px; font-size: 13px; color: var(--muted); }
.msg--user .msg__att { color: rgba(0, 0, 0, .5); }

/* ---------- Страница «История запросов» ---------- */
.history { width: min(100%, 760px); }
.history__title { margin: 4px 0 18px; font-size: 24px; font-weight: 700; }
.history__list { display: flex; flex-direction: column; gap: 8px; }
.history__empty { color: var(--muted); font-size: 15px; }

.history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 3.5px 3.5px rgba(100, 102, 147, .10);
  text-decoration: none;
  color: var(--ink);
  transition: box-shadow .14s ease, transform .14s ease;
}
.history-item:hover { box-shadow: 0 8px 20px rgba(100, 102, 147, .18); transform: translateY(-1px); }
.history-item__ic {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 10px;
  background: var(--blue-soft);
  color: var(--blue);
}
.history-item__ic svg { width: 20px; height: 20px; }
.history-item--run .history-item__ic { background: #fff6df; color: #9b6500; }
.history-item__body { display: flex; flex-direction: column; min-width: 0; }
.history-item__body strong { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item__meta { margin-top: 2px; color: var(--muted); font-size: 13px; }

/* ---------- Маркетплейс навыков (макет 222:3567) ---------- */
.marketplace { width: min(100%, 1120px); }
.mk-title { margin: 4px 0 10px; font-size: 24px; font-weight: 700; }
.mk-subtitle { margin: 0; max-width: 760px; color: var(--muted); font-size: 15px; line-height: 1.5; }

.mk-section-head { display: flex; align-items: center; gap: 14px; margin: 30px 0 16px; }
.mk-section-head h2 { margin: 0; font-size: 18px; font-weight: 700; white-space: nowrap; }
.mk-section-head::after { content: ""; flex: 1; height: 1px; background: #e4e4ee; }

.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }

.mk-card {
  display: flex;
  flex-direction: column;
  min-height: 184px;
  padding: 20px;
  text-align: left;
  color: var(--ink);
  text-decoration: none;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 3.5px 3.5px rgba(100, 102, 147, .14);
  font: inherit;
}
.mk-card--available { cursor: pointer; transition: box-shadow .14s ease, transform .14s ease; }
.mk-card--available:hover { box-shadow: 0 12px 28px rgba(64, 50, 254, .16); transform: translateY(-2px); }
.mk-card--locked { background: var(--canvas); box-shadow: none; border: 1px dashed #c9cbe0; }

.mk-card__head { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid #eceef6; }
.mk-card__icon { display: grid; place-items: center; width: 26px; height: 26px; flex: 0 0 26px; }
.mk-card__icon img { width: 24px; height: 24px; }
.mk-card__title { font-size: 16px; font-weight: 700; line-height: 1.25; }
.mk-card__desc {
  margin: 14px 0 12px;
  flex: 1;
  color: #666;
  font-size: 13px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mk-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }

.mk-status { display: inline-flex; align-items: center; padding: 3px 10px; color: #fff; font-size: 11px; background: var(--sidebar-label); border-radius: 6px; }

.mk-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.mk-tag { padding: 2px 8px; font-size: 11px; color: #3f30fd; border: 1px solid rgba(63, 48, 253, .3); border-radius: 6px; }
.mk-rating { display: inline-flex; align-items: center; gap: 4px; color: #666; font-size: 14px; font-weight: 600; white-space: nowrap; }
.mk-star { width: 16px; height: 16px; fill: #ffb300; }

.mk-connect { padding: 0; background: none; border: 0; color: var(--primary); font-size: 14px; cursor: pointer; text-decoration: underline; }

.mk-back { display: inline-block; margin-bottom: 14px; color: var(--primary); text-decoration: none; font-size: 14px; }
.mk-back:hover { text-decoration: underline; }

/* ---------- Страница навыка (макет «Карточка навыка» 36:1082) ---------- */
.skillpage { width: min(100%, 1264px); }

.hero-skill { display: flex; align-items: center; gap: 24px; padding: 14px 0 20px; }
.hero-skill__text { flex: 1 1 auto; min-width: 0; }
.hero-skill h1 { margin: 0 0 12px; color: var(--sidebar-label); font-size: 36px; font-weight: 800; }
.hero-skill__rule { width: min(70%, 640px); height: 2px; margin-bottom: 18px; background: #d9dcf2; }
.hero-skill p { margin: 0; max-width: 800px; color: #000; font-size: 17px; line-height: 1.55; }
.hero-skill__img { flex: 0 0 auto; width: 230px; height: auto; }
.hero-skill__art { flex: 0 0 210px; height: 180px; border-radius: 26px; background: radial-gradient(circle at 58% 42%, rgba(120, 100, 255, .5), transparent 68%); }

.skillpage__h2 { margin: 34px 0 18px; font-size: 26px; font-weight: 700; }

/* Возможности навыка — кликабельные карточки одинакового размера */
.cap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.cap-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 184px;
  padding: 20px;
  background: #fff;
  border: 0;
  border-radius: 12px;
  box-shadow: 0 3.5px 3.5px rgba(100, 102, 147, .14);
  font: inherit;
}
.cap-card--skill { color: var(--ink); text-decoration: none; cursor: pointer; transition: box-shadow .14s ease, transform .14s ease; }
.cap-card--skill:hover { box-shadow: 0 12px 28px rgba(64, 50, 254, .16); transform: translateY(-2px); }

/* Звезда «в избранное» на карточке навыка */
.cap-fav {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c9ccdd;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: color .14s ease, background .14s ease, transform .14s ease;
}
.cap-fav:hover { background: rgba(0, 0, 0, .04); color: #ffba00; transform: scale(1.1); }
.cap-fav.is-active { color: #ffba00; }

/* Кнопка «В избранное» на странице услуги */
.service-fav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 9px 16px;
  border: 1px solid #e0e2ee;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease;
}
.service-fav svg { width: 18px; height: 18px; color: #c9ccdd; transition: color .14s ease; }
.service-fav:hover { border-color: #ffba00; }
.service-fav:hover svg { color: #ffba00; }
.service-fav.is-active { border-color: #ffba00; background: #fff8e6; }
.service-fav.is-active svg { color: #ffba00; }
.service-fav__on { display: none; }
.service-fav.is-active .service-fav__off { display: none; }
.service-fav.is-active .service-fav__on { display: inline; }
.cap-card__head { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid #eceef6; }
.cap-card__ic { display: grid; place-items: center; width: 24px; height: 24px; flex: 0 0 24px; }
.cap-card__ic img { width: 22px; height: 22px; }
.cap-card__head strong { font-size: 16px; font-weight: 700; line-height: 1.25; }
.cap-card__desc {
  flex: 1;
  margin: 14px 0 12px;
  color: #666;
  font-size: 13px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cap-card__go { display: inline-flex; align-items: center; gap: 8px; margin-top: auto; color: var(--primary); font-size: 13px; font-weight: 600; }
.cap-card__go svg { width: 18px; height: 18px; }
.cap-card { text-align: left; }
.cap-card--soon { opacity: .82; }   /* чуть бледнее — «в разработке» */
.cap-card--soon:hover { box-shadow: 0 6px 16px rgba(100, 102, 147, .16); transform: none; }
.cap-card__go--soon { color: var(--muted); }

/* Источники данных + примеры запросов */
.src-panels { display: flex; flex-direction: column; gap: 20px; }
.src-panel { padding: 20px; background: #fff; border-radius: 12px; box-shadow: 0 3.5px 1.7px rgba(100, 102, 147, .14); }
.src-panel--conn { background: var(--canvas); border: 1px solid var(--sidebar-label); box-shadow: none; }
.src-panel__labels,
.src-panel__row { display: grid; grid-template-columns: 420px 1fr; gap: 24px; }
.src-panel__labels { margin-bottom: 12px; color: var(--sidebar-label); font-size: 16px; font-weight: 700; }
.src-panel__row { align-items: center; }
.src-panel__row--top { align-items: start; }

.src-conn { display: flex; align-items: center; gap: 12px; padding: 12px; background: #fff; border: 1px solid var(--sidebar-label); border-radius: 8px; }
.src-conn__logo { width: 66px; height: auto; flex: 0 0 66px; }
.src-conn__body { min-width: 0; }
.src-conn__body strong { display: block; margin-bottom: 6px; padding-bottom: 6px; color: var(--sidebar-label); font-size: 15px; font-weight: 700; border-bottom: 1px solid #e4e4ee; }
.src-conn__desc { color: #000; font-size: 12px; line-height: 1.4; }

.ex-query { padding: 14px 16px; background: rgba(0, 0, 0, .04); border: 1px solid #fff; border-radius: 14px; }
.ex-query__text { display: block; margin-bottom: 12px; color: #000; font-size: 13px; line-height: 1.5; }
.ex-query__tools { display: flex; align-items: center; gap: 12px; color: #8a8a9c; }
.ex-query__tools svg { width: 18px; height: 18px; }
.ex-query__sp { flex: 1; }
.ex-query__send { display: grid; place-items: center; width: 28px; height: 28px; background: #0b0b16; border-radius: 50%; color: #fff; }
.ex-query__send svg { width: 15px; height: 15px; }
.ex-stack { display: flex; flex-direction: column; gap: 12px; }

@media (max-width: 900px) {
  .hero-skill { flex-wrap: wrap; }
  .hero-skill__img, .hero-skill__art { display: none; }
  .src-panel__labels, .src-panel__row { grid-template-columns: 1fr; }
}

/* ---------- Страница «Об ассистенте» ---------- */
.about__robot { width: 340px; background: radial-gradient(circle at 50% 46%, rgba(120, 92, 250, .2), transparent 62%); }
.cap-card--about { min-height: 148px; }
.about-principles { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.about-principle { padding: 22px; background: #fff; border-radius: 12px; box-shadow: 0 3.5px 3.5px rgba(100, 102, 147, .14); }
.about-principle strong { display: block; margin-bottom: 8px; color: var(--sidebar-label); font-size: 16px; font-weight: 700; }
.about-principle span { color: #666; font-size: 13px; line-height: 1.5; }

/* ---------- Страница услуги (старый service-template, под новый дизайн) ---------- */
.service-shell { width: min(100%, 1180px); margin: 0 auto; padding: 6px 0 40px; }
.service-aside,
.service-workspace,
.run-panel { border: 0; border-radius: 12px; box-shadow: 0 3.5px 3.5px rgba(100, 102, 147, .14); }
.back-link { font-weight: 600; text-decoration: none; }
.service-aside__label { font-weight: 700; letter-spacing: .02em; }
.service-aside h1 { font-weight: 800; letter-spacing: -.4px; }
.form-grid input,
.form-grid textarea { border-color: #dfe1ef; border-radius: 10px; }
.form-grid input:focus,
.form-grid textarea:focus { box-shadow: 0 0 0 3px rgba(64, 50, 254, .14); }
.primary-button { border-radius: 10px; font-weight: 700; }
.primary-button--wide { min-height: 56px; }
/* Инфо-плашка «демо-база» — в палитре проекта вместо резкого красного */
.npa-demo-warning {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  color: #5a5a72;
  background: #f2f3fb;
  border: 1px solid #e6e6f2;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}
.npa-demo-warning::before {
  content: "";
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  background: var(--sidebar-label);
  border-radius: 50%;
  -webkit-mask: no-repeat center/16px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Ccircle cx='12' cy='12' r='9' stroke='white' stroke-width='2'/%3E%3Cpath d='M12 11v5M12 8h.01' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  mask: no-repeat center/16px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Ccircle cx='12' cy='12' r='9' stroke='white' stroke-width='2'/%3E%3Cpath d='M12 11v5M12 8h.01' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* ---------- Тост «скоро» ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  max-width: 90vw;
  padding: 12px 20px;
  color: #fff;
  background: #0b0b16;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
  opacity: 0;
  transition: opacity .2s ease;
  z-index: 50;
  pointer-events: none;
}
.toast.is-visible { opacity: 1; }

/* Всплывающая подсказка для свёрнутого сайдбара (плавающий элемент в body) */
.nav-tip {
  position: fixed;
  z-index: 60;
  transform: translateY(-50%);
  padding: 7px 12px;
  background: #17122e;
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(10, 8, 30, .4);
  pointer-events: none;
}
.nav-tip[hidden] { display: none; }

/* ---------- Свёрнутый сайдбар (узкий рельс из иконок, макет 48:535) ---------- */
.app-shell.sidebar-collapsed .sidebar { flex-basis: 76px; width: 76px; padding: 22px 12px 24px; }
.sidebar-collapsed .sidebar__top { margin-bottom: 18px; justify-content: center; }
.sidebar-collapsed .sidebar__logo { display: none; }
.sidebar-collapsed .sidebar__mark { display: block; width: 24px; }
.sidebar-collapsed .sidebar__search-wrap { margin-bottom: 14px; }
.sidebar-collapsed .sidebar__search { justify-content: center; padding: 0; gap: 0; border: 0; cursor: pointer; }
.sidebar-collapsed .sidebar__search input { display: none; }
.sidebar-collapsed .sidebar__search-results { display: none; }
.sidebar-collapsed .nav-item { justify-content: center; padding: 10px 0; gap: 0; }
.sidebar-collapsed .nav-item span { display: none; }
.sidebar-collapsed .sidebar__label,
.sidebar-collapsed .sidebar__empty,
.sidebar-collapsed .sidebar__more { display: none; }
/* Пустые группы без иконок (напр. «Недавнее») в свёрнутом рельсе не показываем */
.sidebar-collapsed .sidebar__section:not(:has(.nav-item)) { display: none; }
/* Разделители групп — короткие центрированные линии, как в макете */
.sidebar-collapsed .sidebar__section,
.sidebar-collapsed .sidebar__bottom { text-align: center; border-top-color: transparent; position: relative; }
.sidebar-collapsed .sidebar__section::before,
.sidebar-collapsed .sidebar__bottom::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  border-radius: 2px;
  background: var(--white-line);
}

/* ---------- Адаптив ---------- */

@media (max-width: 1100px) {
  :root { --sidebar-w: 280px; }
  .topbar { padding: 0 24px; }
  .canvas { padding: 24px; }
}

@media (max-width: 820px) {
  .app-shell { flex-direction: column; height: auto; }
  .sidebar { flex-basis: auto; width: 100%; height: auto; border-radius: 0; }
  .app-main { height: auto; min-height: 100vh; }
  .topbar { flex-wrap: wrap; height: auto; padding: 16px 20px; gap: 16px; }
  .topbar__skills { order: 2; flex-wrap: wrap; }
  .canvas { min-height: 60vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
