/* =============================================================
 * Vibe Panel — стиль идентичен Dev Portal (SMUI Nord, JetBrains Mono).
 * Использует HSL-токены из tokens.css.
 * ============================================================= */

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

html { height: 100%; }

body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  color: hsl(var(--foreground));
  background-color: hsl(var(--background));
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--font-mono); font-weight: 600; }

::selection { background: hsl(var(--primary) / 0.2); color: hsl(var(--primary)); }

/* Background — radial glow + grid (как на dev) */
body.app-bg {
  background:
    radial-gradient(ellipse 70% 50% at 50% -5%,
      hsl(var(--primary) / 0.07) 0%, transparent 100%),
    linear-gradient(to right,  hsl(var(--border) / 0.15) 1px, transparent 1px),
    linear-gradient(to bottom, hsl(var(--border) / 0.15) 1px, transparent 1px),
    hsl(var(--background));
  background-size: auto, 24px 24px, 24px 24px, auto;
}

.hidden { display: none !important; }

/* ── Navbar ───────────────────────────────────────────────── */
.navbar {
  height: 44px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 4px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-kg {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 800;
  letter-spacing: .14em;
  text-decoration: none;
  color: hsl(var(--background));
  background: hsl(var(--foreground) / 0.65);
  padding: 8px 11px;
  flex-shrink: 0;
  transition: opacity .15s;
}
.navbar-kg:hover { opacity: .8; }

.navbar-spacer { flex: 1; }

/* Theme toggle + nav-icon — единая высота 30px как остальные navbar-кнопки */
.theme-toggle, .nav-icon {
  width: 30px; height: 30px;
  border: 1px solid hsl(var(--border));
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-icon-sm {
  width: 30px; height: 30px;
  border: 1px solid hsl(var(--border));
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}
.theme-toggle:hover, .nav-icon:hover, .btn-icon-sm:hover {
  background: hsl(var(--accent));
  color: hsl(var(--foreground));
  border-color: hsl(var(--smui-border-hover));
}
.theme-toggle .ic-sun  { display: none; }
.theme-toggle .ic-moon { display: block; }
html:not(.dark) .theme-toggle .ic-sun  { display: block; }
html:not(.dark) .theme-toggle .ic-moon { display: none; }

/* Auth group (username + logout) — копия .auth-group из dev */
.auth-group {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--secondary));
  height: 30px; padding: 2px 10px;
  cursor: pointer;
  font-family: var(--font-mono);
  line-height: 1;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.auth-group:hover {
  background: hsl(var(--accent));
  border-color: hsl(var(--smui-border-hover));
}
.auth-username {
  font-size: 10px; font-weight: 600;
  color: hsl(var(--foreground));
  letter-spacing: .03em;
}
.auth-logout-label {
  font-size: 8px; font-weight: 500;
  color: hsl(var(--muted-foreground));
  letter-spacing: .08em;
  text-transform: uppercase;
}
.auth-group:hover .auth-logout-label { color: hsl(var(--foreground)); }

/* Виден только когда залогинен */
body:not(.is-auth) .hidden-when-no-auth { display: none !important; }
body:not(.is-admin) .admin-only { display: none !important; }

/* ── Welcome (как на dev) ─────────────────────────────────── */
.welcome {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: calc(100vh - 44px);
  text-align: center;
  gap: 16px;
  padding: 32px;
}
.welcome-domain {
  font-family: var(--font-mono);
  font-size: 11px;
  color: hsl(var(--muted-foreground));
  letter-spacing: .12em;
  text-transform: uppercase;
}
.welcome-heading {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  color: hsl(var(--foreground));
  letter-spacing: -.01em;
}
.btn-welcome {
  height: 36px; padding: 0 28px; margin-top: 8px;
  border: none;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-size: 12px; font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-welcome:hover { opacity: .85; }

/* ── Dashboard ────────────────────────────────────────────── */
.dashboard {
  padding: 24px 32px;
  flex: 1;
  width: 100%;
}

.section-block { margin-bottom: 36px; max-width: 972px; margin-left: auto; margin-right: auto; }
.section-block:last-child { margin-bottom: 0; }

.section-head {
  display: flex; align-items: center;
  justify-content: space-between;
  flex-wrap: wrap; gap: 8px 16px;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid hsl(var(--border));
}
.section-head-left { display: flex; align-items: baseline; gap: 14px; }
.section-label {
  font-family: var(--font-mono);
  font-size: 14px; font-weight: 600;
  letter-spacing: .02em;
  color: hsl(var(--foreground));
  text-transform: uppercase;
}
.section-path {
  font-family: var(--font-mono);
  font-size: 11px;
  color: hsl(var(--muted-foreground));
  letter-spacing: .03em;
}

.dashboard-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* При открытом боковом чате рабочая область сужается: убираем авто-центрирование
   колонок (левый отступ уходит) и тянем контент на всю доступную ширину. */
body.has-left-chat .section-block,
body.has-right-chat .section-block,
body.has-left-chat .vscode-hero,
body.has-right-chat .vscode-hero,
body.has-left-chat .vscode-recent,
body.has-right-chat .vscode-recent {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

/* Узкий экран: не центрируем рабочие блоки на 972px (иначе большой «отступ слева») —
   тянем на всю ширину рабочей области (остаются только паддинги .dashboard). */
@media (max-width: 1300px) {
  .section-block,
  .vscode-hero,
  .vscode-recent {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }
}

/* ── Container banner ─────────────────────────────────────── */
.container-banner {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: hsl(var(--muted-foreground));
  display: flex;
  align-items: center;
  gap: 12px;
}
.container-banner .dot {
  width: 8px; height: 8px;
  background: hsl(var(--muted-foreground));
  flex-shrink: 0;
  border-radius: 50%;
}
.container-banner.running {
  border-color: hsl(var(--smui-green) / 0.5);
  color: hsl(var(--smui-green));
}
.container-banner.running .dot { background: hsl(var(--smui-green)); }

/* ── Projects / templates grid ────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.template-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 140px;
  transition: border-color .15s;
}
.template-card:hover { border-color: hsl(var(--smui-border-hover)); }
.template-card .t-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 4px;
}
.template-card .t-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: hsl(var(--muted-foreground));
  letter-spacing: .04em;
}
.template-card .t-desc {
  font-family: var(--font-mono);
  font-size: 11px;
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
  flex: 1;
  margin-top: 4px;
}
.template-card .t-actions {
  display: flex; gap: 6px;
  margin-top: auto;
  padding-top: 10px;
}

.empty {
  font-family: var(--font-mono);
  font-size: 11px;
  color: hsl(var(--muted-foreground));
  padding: 20px;
  text-align: center;
  border: 1px dashed hsl(var(--border));
  grid-column: 1 / -1;
}

/* ── Buttons (как на dev) ─────────────────────────────────── */
.btn {
  height: 30px; padding: 0 12px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: .03em;
  cursor: pointer;
  border: 1px solid hsl(var(--border));
  background: transparent;
  color: hsl(var(--muted-foreground));
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:hover {
  color: hsl(var(--foreground));
  border-color: hsl(var(--smui-border-hover));
}
.btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}
.btn-primary:hover {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  opacity: .85;
  border-color: hsl(var(--primary));
}
.btn-ghost { background: transparent; }
.btn-danger {
  border-color: hsl(var(--destructive) / 0.5);
  color: hsl(var(--destructive));
}
.btn-danger:hover {
  background: hsl(var(--destructive) / 0.1);
  border-color: hsl(var(--destructive));
  color: hsl(var(--destructive));
}
.btn-sm { height: 26px; padding: 0 10px; font-size: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Modal (точно как на dev) ─────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: hsl(var(--background) / 0.75);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 400; padding: 16px;
}
.modal {
  background: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  padding: 0;
  width: 100%; max-width: 480px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
/* Инструкционные модалки могут быть высокими → ограничиваем высоту,
   тело (.modal-body) скроллится, шапка/футер на месте. */
#modal-ssh > .modal, #modal-proj-vscode > .modal { max-height: calc(100vh - 32px); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid hsl(var(--border));
}
.modal-title {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  color: hsl(var(--popover-foreground));
}
.modal-close {
  width: 24px; height: 24px; border: none;
  background: transparent; color: hsl(var(--muted-foreground));
  font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }

.modal > .form-group,
.modal > .form-row,
.modal > .form-error,
.modal > .modal-footer { padding: 0 18px; }
.modal > .form-group { padding-top: 14px; }
.modal > .form-row   { padding-top: 14px; }
.modal > .pub-row,
.modal > .pub-url-box,
.modal > .pub-status { padding-left: 18px; padding-right: 18px; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-row { display: flex; align-items: flex-end; gap: 8px; }
.form-row .form-group { flex: 1; }

.form-label {
  font-size: 11px; font-family: var(--font-mono);
  color: hsl(var(--muted-foreground));
  text-transform: uppercase; letter-spacing: 1.5px;
}
.form-input {
  height: 32px; padding: 0 10px;
  border: 1px solid hsl(var(--input));
  background: hsl(var(--secondary));
  color: hsl(var(--foreground));
  font-size: 13px; font-family: var(--font-mono);
  width: 100%; outline: none;
  transition: border-color .15s;
}
.form-input:focus { border-color: hsl(var(--primary)); }
.form-input::placeholder { color: hsl(var(--muted-foreground)); opacity: .6; }
.form-input[readonly] { opacity: .6; cursor: default; }

.form-hint {
  font-size: 11px;
  color: hsl(var(--muted-foreground));
  font-family: var(--font-mono);
}

/* Тело инструкционных модалок (SSH-доступ, открыть проект): боковые отступы
   как у form-group + вертикальный скролл, если контент высокий. */
.modal > .modal-body {
  padding: 14px 18px 4px;
  overflow-y: auto; min-height: 0;
}
.modal-body > p { margin: 0 0 10px; }
.modal-body .form-hint { line-height: 1.6; }
.modal-body .note-steps { margin: 4px 0 10px; }
.modal-body .note-steps li { font-size: 13px; line-height: 1.6; padding-top: 9px; padding-bottom: 9px; }
.modal-body .note-steps li b { color: hsl(var(--foreground)); font-weight: 600; }
/* Блок кода/команды и конфиг-textarea внутри шага */
.step-code, .modal-body textarea.step-code {
  display: block; width: 100%; box-sizing: border-box;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.5;
  background: hsl(var(--secondary)); border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  padding: 8px 10px; margin: 8px 0 0;
  white-space: pre-wrap; overflow-x: auto; resize: vertical; outline: none;
}
.step-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 2px; }
/* Список расширений-ссылок внутри шага (div, не ul — чтобы не цеплять .note-steps li) */
.modal-body .ext-list {
  display: flex; flex-direction: column; gap: 3px;
  margin: 7px 0 2px; padding-left: 2px;
  font-family: var(--font-mono); font-size: 12.5px;
}
.modal-body .ext-list a { color: hsl(var(--primary)); text-decoration: underline; text-underline-offset: 2px; }
.modal-body .ext-list a::before { content: "•\00a0"; color: hsl(var(--primary)); text-decoration: none; }
.modal-body .path-row {
  font-family: var(--font-mono); font-size: 13px;
  background: hsl(var(--secondary)); border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  padding: 9px 11px; margin: 6px 0 0; word-break: break-all; user-select: all;
}
.form-error {
  font-size: 11px;
  color: hsl(var(--destructive));
  min-height: 16px;
  font-family: var(--font-mono);
  padding-top: 6px;
}

.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 18px !important;
  border-top: 1px solid hsl(var(--border));
  margin-top: 14px;
}

/* ── Settings panel (slide-in справа, как на dev) ─────────── */
.settings-panel {
  position: fixed; right: 0; top: 44px; bottom: 0;
  width: 400px;
  background: hsl(var(--card));
  border-left: 1px solid hsl(var(--border));
  z-index: 300;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s ease;
}
.settings-panel.open { transform: translateX(0); }

.settings-header {
  height: 44px;
  border-bottom: 1px solid hsl(var(--border));
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 16px; flex-shrink: 0;
}
.settings-title {
  font-size: 11px; font-family: var(--font-mono);
  font-weight: 600;
  color: hsl(var(--foreground));
  text-transform: uppercase; letter-spacing: 1.5px;
}
.settings-body { flex: 1; overflow-y: auto; }
.settings-section {
  padding: 16px;
  border-bottom: 1px solid hsl(var(--border));
}
.settings-section-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.settings-section-title {
  font-size: 11px; font-family: var(--font-mono);
  color: hsl(var(--muted-foreground));
  text-transform: uppercase; letter-spacing: 1.5px;
}

/* Users list / user-row ─ копия dev ─────────────────────── */
.users-list {
  display: flex; flex-direction: column;
  border: 1px solid hsl(var(--border));
  overflow: hidden;
}
.user-row {
  display: flex; align-items: center;
  padding: 8px 12px;
  background: hsl(var(--card)); gap: 8px;
  border-bottom: 1px solid hsl(var(--border));
}
.user-row:last-child { border-bottom: none; }
.user-row-name {
  flex: 1; font-size: 12px; font-family: var(--font-mono);
  color: hsl(var(--foreground));
}
.user-row-meta {
  font-size: 10px; font-family: var(--font-mono);
  color: hsl(var(--muted-foreground));
  margin-top: 2px;
}
.user-row-actions { display: flex; gap: 6px; align-items: center; }

/* role-pill, кнопки «Пароль»/«Удалить» — одинаковая высота 22px, mono 10px. */
.user-role-pill, .user-row-del, .user-row-pwd {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 9px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  border: 1px solid hsl(var(--border));
  background: transparent;
  line-height: 1;
}
.user-role-pill { color: hsl(var(--muted-foreground)); }
.user-role-pill.role-admin {
  border-color: hsl(var(--primary));
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.08);
}
.user-row-del {
  color: hsl(var(--destructive));
  border-color: hsl(var(--destructive) / 0.55);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.user-row-del:hover {
  background: hsl(var(--destructive) / 0.12);
  border-color: hsl(var(--destructive));
}
.user-row-pwd {
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.user-row-pwd:hover {
  background: hsl(var(--accent));
  border-color: hsl(var(--primary));
  color: hsl(var(--foreground));
}
.user-row-empty {
  padding: 20px;
  text-align: center;
  font-size: 11px;
  font-family: var(--font-mono);
  color: hsl(var(--muted-foreground));
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 700px) {
  .auth-username { display: none; }
  .navbar { padding: 0 10px; gap: 4px; }
  .dashboard { padding: 16px 12px 32px; }
  .settings-panel { width: 100vw; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .section-head-left { flex-direction: column; align-items: flex-start; gap: 2px; }
}

/* ── Projects table ──────────────────────────────────────── */
.projects-table-wrap { overflow-x: auto; border: 1px solid hsl(var(--border)); background: hsl(var(--card)); }
.projects-table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 11px; }
.projects-table thead th {
  text-align: left;
  font-weight: 500; font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  padding: 10px 12px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background));
}
.projects-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  vertical-align: middle;
}
.projects-table tbody tr:last-child td { border-bottom: none; }
.projects-table tbody tr:hover { background: hsl(var(--background)); }
.projects-table .td-name { font-weight: 600; }
/* td остаётся table-cell (иначе ломается высота строки и border-bottom «едет»);
   flex — на внутренней обёртке .actions */
.projects-table .td-actions { text-align: right; white-space: nowrap; }
.projects-table .td-actions .actions { display: inline-flex; gap: 6px; justify-content: flex-end; align-items: center; }
.projects-table .th-actions { text-align: right; }
.pill {
  display: inline-block;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 8px;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
}
.pill-type { color: hsl(var(--muted-foreground)); }
.pill.status-new { color: hsl(var(--muted-foreground)); }
.pill.status-prod { color: #e89a3c; border-color: #e89a3c; }
.pill.status-other { color: hsl(var(--primary)); border-color: hsl(var(--primary)); }

/* ── Explorer (встаёт в центральную колонку, между чатами) ──── */
.explorer-overlay {
  grid-column: 2; grid-row: 1;
  background: hsl(var(--background));
  display: flex; flex-direction: column;
  height: 100%; min-height: 0;
  overflow: hidden;
}
.explorer-overlay.hidden { display: none; }
body.has-explorer .dashboard { display: none; }
.explorer-panel {
  background: hsl(var(--card));
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  font-family: var(--font-mono);
  min-height: 0;
}
.explorer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid hsl(var(--border));
}
.explorer-title { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.explorer-title .section-path { font-size: 12px; }
.explorer-header-actions { display: flex; gap: 10px; align-items: center; }
.explorer-body {
  flex: 1; display: grid; grid-template-columns: 280px 1fr;
  overflow: hidden;
}
.explorer-tree {
  border-right: 1px solid hsl(var(--border));
  overflow: auto; padding: 8px 0;
  font-size: 11px;
}
.explorer-tree-list { list-style: none; padding: 0; margin: 0; }
.explorer-tree-list .explorer-tree-list { padding-left: 14px; }
.explorer-tree-item.collapsed > .explorer-tree-list { display: none; }
.explorer-tree-item.collapsed > .explorer-node-dir .explorer-icon-caret { transform: rotate(0deg); }
.explorer-node-dir, .explorer-node-file {
  display: flex; gap: 4px; align-items: center;
  padding: 3px 12px;
  cursor: pointer;
  color: hsl(var(--foreground));
  user-select: none;
}
.explorer-node-dir:hover, .explorer-node-file:hover { background: hsl(var(--background)); }
.explorer-icon-caret {
  display: inline-block; width: 10px; font-size: 9px;
  transform: rotate(90deg); transition: transform .1s;
  color: hsl(var(--muted-foreground));
}
.explorer-tree-item.collapsed > .explorer-node-dir .explorer-icon-caret { transform: rotate(0deg); }
.explorer-node-file { padding-left: 26px; color: hsl(var(--muted-foreground)); }
.explorer-node-file.active { background: hsl(var(--primary) / 0.12); color: hsl(var(--primary)); }
.explorer-view { display: flex; flex-direction: column; overflow: hidden; }
.explorer-view-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid hsl(var(--border));
  font-size: 11px; color: hsl(var(--muted-foreground));
}
.explorer-view-path { font-family: var(--font-mono); color: hsl(var(--foreground)); }
.explorer-view-pre {
  flex: 1; overflow: auto;
  margin: 0; padding: 14px;
  font-family: var(--font-mono); font-size: 11px; line-height: 1.55;
  color: hsl(var(--foreground));
  white-space: pre;
  background: hsl(var(--background));
}
.explorer-loading {
  padding: 20px;
  font-size: 11px;
  color: hsl(var(--muted-foreground));
}
@media (max-width: 800px) {
  .explorer-body { grid-template-columns: 1fr; }
  .explorer-tree { max-height: 35vh; border-right: none; border-bottom: 1px solid hsl(var(--border)); }
}

/* ── 3-column main layout ────────────────────────────────── */
.main-layout {
  display: grid;
  grid-template-columns: 0 1fr 0;
  height: calc(100vh - 44px);
  overflow: hidden;
  transition: grid-template-columns .15s;
}
body.has-left-chat .main-layout {
  grid-template-columns: var(--left-chat-w, 420px) 1fr 0;
}
body.has-right-chat .main-layout {
  grid-template-columns: 0 1fr var(--right-chat-w, 380px);
}
body.has-left-chat.has-right-chat .main-layout {
  grid-template-columns: var(--left-chat-w, 420px) 1fr var(--right-chat-w, 380px);
}
body.pc-fullscreen.has-left-chat .main-layout {
  grid-template-columns: 1fr 0 0;
}
body.pc-fullscreen.has-left-chat .chat-pane-right,
body.pc-fullscreen.has-left-chat .dashboard { display: none; }
.main-layout.hidden { display: none; }
.chat-pane-left  { grid-column: 1; grid-row: 1; height: 100%; min-height: 0; }
.chat-pane-right { grid-column: 3; grid-row: 1; height: 100%; min-height: 0; }
.dashboard       { grid-column: 2; grid-row: 1; min-width: 0; overflow-y: auto; height: 100%; }
@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr !important; }
  .chat-pane-left, .chat-pane-right {
    position: fixed; inset: 44px 0 0 0; z-index: 150;
    grid-column: 1 !important; height: calc(100vh - 44px);
  }
}

/* ── Chat pane (общие стили) ─────────────────────────────── */
.chat-pane {
  background: hsl(var(--card));
  border-right: 1px solid hsl(var(--border));
  display: flex; flex-direction: column;
  font-family: var(--font-mono);
  min-height: 0;
  overflow: hidden;
}
.chat-pane-right { border-right: none; border-left: 1px solid hsl(var(--border)); }
.chat-pane.hidden { display: none; }

/* Видимость панелей чата — производная ТОЛЬКО от того же класса на body, который
   резервирует колонку грида (.main-layout). Единственный источник истины:
   панель видна ⟺ грид выделил под неё место. Раньше видимость держалась на
   отдельном классе .hidden, который мог рассинхронизироваться с грид-классом
   (has-left-chat оставался → пустая колонка слева, контент уезжал вправо —
   тот самый баг «непропорциональных отступов»). !important — чтобы перебить
   глобальную утилиту .hidden (display:none !important), если .hidden залип. */
body:not(.has-left-chat)  .chat-pane-left  { display: none !important; }
body:not(.has-right-chat) .chat-pane-right { display: none !important; }
body.has-left-chat  .chat-pane-left  { display: flex !important; }
body.has-right-chat .chat-pane-right { display: flex !important; }
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid hsl(var(--border));
  flex-shrink: 0;
}
.chat-title {
  display: flex; gap: 8px; align-items: center;
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: hsl(var(--foreground));
  min-width: 0;
}
.chat-title #pc-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: hsl(var(--primary)); flex-shrink: 0;
}
.btn-close-box {
  width: 24px; height: 24px;
  background: transparent;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  font-family: var(--font-mono); font-size: 11px;
}
.btn-close-box:hover { color: hsl(var(--foreground)); border-color: hsl(var(--primary)); }
.pc-header-actions { display: flex; gap: 4px; align-items: center; }
.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  min-height: 0;
}
.chat-input-row {
  display: flex; gap: 6px; align-items: flex-end;
  padding: 10px 12px;
  border-top: 1px solid hsl(var(--border));
  flex-shrink: 0;
}
.chat-textarea {
  flex: 1; min-height: 32px; max-height: 120px;
  padding: 7px 10px;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  font-family: var(--font-mono); font-size: 11px;
  resize: none; outline: none;
}
.chat-textarea:focus { border-color: hsl(var(--primary)); }
.chat-send {
  width: 32px; height: 32px;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chat-send:hover { opacity: .88; }
.chat-send:disabled { opacity: .4; cursor: not-allowed; }

/* ── Project chat (pc-*) — расширенный ────────────────────── */
.pc-tool-btn {
  width: 24px; height: 24px;
  background: transparent;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  font-family: var(--font-mono); font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
.pc-tool-btn:hover { border-color: hsl(var(--primary)); color: hsl(var(--primary)); }
.pc-tool-btn:disabled { opacity: .4; cursor: not-allowed; }
.pc-dd { position: relative; }
.pc-dd-sessions { flex: 1; min-width: 0; max-width: 200px; }
.pc-dd-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 8px; height: 24px;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  font-family: var(--font-mono); font-size: 10px;
  cursor: pointer;
  width: 100%;
}
.pc-dd-btn:hover { border-color: hsl(var(--primary)); }
.pc-dd-label {
  flex: 1; min-width: 0; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pc-dd.open .pc-dd-btn svg { transform: rotate(180deg); }
.pc-dd-btn svg { transition: transform .15s; flex-shrink: 0; }
.pc-dd-menu {
  position: absolute; top: 100%; left: 0; right: 0;
  margin-top: 2px;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  max-height: 300px; overflow-y: auto;
  z-index: 50;
  display: none;
  min-width: 240px;
}
.pc-dd.open .pc-dd-menu { display: block; }
.pc-dd-item {
  display: flex; flex-direction: column;
  padding: 6px 10px;
  width: 100%;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-mono); font-size: 10px;
  color: hsl(var(--foreground));
  border-bottom: 1px solid hsl(var(--border));
}
.pc-dd-item:last-child { border-bottom: none; }
.pc-dd-item:hover, .pc-dd-item.active { background: hsl(var(--primary) / 0.12); color: hsl(var(--primary)); }
.pc-dd-item.is-empty { color: hsl(var(--muted-foreground)); cursor: default; }
.pc-dd-item-title { font-weight: 500; }
.pc-dd-item-meta { font-size: 9px; color: hsl(var(--muted-foreground)); margin-top: 2px; }

.pc-empty {
  padding: 12px;
  font-size: 11px; color: hsl(var(--muted-foreground)); font-style: italic;
}
.pc-block {
  padding: 8px 10px;
  border: 1px solid transparent;
  font-size: 11px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
}
.pc-block-user {
  background: hsl(var(--primary) / 0.08);
  border-color: hsl(var(--primary) / 0.25);
  color: hsl(var(--foreground));
}
.pc-block-assistant {
  background: hsl(var(--background));
  border-color: hsl(var(--border));
  color: hsl(var(--foreground));
}
.pc-block.md { white-space: normal; font-family: system-ui, -apple-system, sans-serif; font-size: 12px; }
.pc-block.md > *:first-child { margin-top: 0; }
.pc-block.md > *:last-child { margin-bottom: 0; }
.pc-block.md p { margin: 0 0 6px; }
.pc-block.md strong { font-weight: 600; }
.pc-block.md em { font-style: italic; }
.pc-block.md a { color: hsl(var(--primary)); }
.pc-block.md .md-h { margin: 6px 0 3px; font-weight: 700; font-family: var(--font-mono); }
.pc-block.md .md-h1 { font-size: 13px; border-bottom: 1px solid hsl(var(--border)); padding-bottom: 2px; }
.pc-block.md .md-h2 { font-size: 12px; color: hsl(var(--primary)); }
.pc-block.md .md-h3 { font-size: 11px; text-transform: uppercase; }
.pc-block.md .md-list { margin: 3px 0 6px; padding-left: 18px; }
.pc-block.md .md-inline-code {
  font-family: var(--font-mono); font-size: 10.5px;
  padding: 1px 4px; background: hsl(var(--background)); border: 1px solid hsl(var(--border));
}
.pc-block.md .md-code {
  font-family: var(--font-mono); font-size: 10.5px;
  padding: 8px 10px; margin: 4px 0;
  background: hsl(var(--background)); border: 1px solid hsl(var(--border));
  overflow-x: auto; white-space: pre;
}
.pc-block-thinking {
  background: transparent;
  border-color: hsl(var(--border));
  color: hsl(var(--muted-foreground));
  font-style: italic; font-size: 10.5px;
}
.pc-block-error {
  background: hsl(0 70% 50% / 0.12);
  border-color: hsl(0 70% 50% / 0.4);
  color: hsl(0 70% 60%);
}
.pc-block-tool {
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  padding: 0;
  white-space: normal;
}
.pc-block-tool summary {
  padding: 6px 10px;
  cursor: pointer;
  font-family: var(--font-mono); font-size: 10.5px;
  display: flex; gap: 8px; align-items: baseline;
  list-style: none;
}
.pc-block-tool summary::-webkit-details-marker { display: none; }
.pc-block-tool .pc-tool-name { color: hsl(var(--primary)); font-weight: 600; }
.pc-block-tool .pc-tool-arg {
  color: hsl(var(--muted-foreground));
  flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.pc-block-tool[open] summary { border-bottom: 1px solid hsl(var(--border)); }
.pc-block-tool pre {
  margin: 0; padding: 8px 10px;
  font-family: var(--font-mono); font-size: 10px;
  color: hsl(var(--muted-foreground));
  overflow-x: auto; white-space: pre;
  max-height: 240px; overflow-y: auto;
}
.pc-block-tool.is-error { border-color: hsl(0 70% 50% / 0.4); }
.pc-block-summary {
  font-size: 10px; color: hsl(var(--muted-foreground));
  text-align: right; padding: 2px 4px;
}
.pc-typing {
  display: flex; gap: 6px; align-items: center;
  padding: 6px 10px;
  font-size: 11px; color: hsl(var(--muted-foreground));
}
.pc-typing-dot {
  color: hsl(var(--primary));
  animation: pcBlink 1s infinite;
}
.pc-typing-elapsed { margin-left: auto; font-size: 10px; }
@keyframes pcBlink { 50% { opacity: .3; } }

/* ── User chat (right pane) — chat-bubble ─────────────────── */
.chat-bubble {
  padding: 8px 10px;
  border: 1px solid hsl(var(--border));
  font-size: 11px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
  max-width: 90%;
}
.chat-bubble-user {
  align-self: flex-end;
  background: hsl(var(--primary) / 0.12);
  border-color: hsl(var(--primary) / 0.3);
  color: hsl(var(--foreground));
}
.chat-bubble-assistant {
  align-self: flex-start;
  background: hsl(var(--background));
}
.chat-bubble-thinking {
  align-self: flex-start;
  font-style: italic; color: hsl(var(--muted-foreground));
}
.chat-bubble-error {
  align-self: stretch;
  background: hsl(0 70% 50% / 0.12);
  border-color: hsl(0 70% 50% / 0.4);
  color: hsl(0 70% 60%);
}

/* ── pc mode-seg КРАТКО/ПОЛНО ─────────────────────────────── */
.pc-mode-seg {
  display: inline-flex;
  border: 1px solid hsl(var(--border));
}
.pc-mode-btn {
  padding: 4px 8px;
  height: 24px;
  font-family: var(--font-mono); font-size: 9px;
  background: transparent;
  border: none;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.pc-mode-btn + .pc-mode-btn { border-left: 1px solid hsl(var(--border)); }
.pc-mode-btn:hover { color: hsl(var(--foreground)); }
.pc-mode-btn.is-active {
  background: hsl(var(--primary) / 0.15);
  color: hsl(var(--primary));
}
body.pc-mode-compact .pc-block-thinking,
body.pc-mode-compact .pc-block-tool,
body.pc-mode-compact .pc-block-summary { display: none !important; }

/* ── pc toolbar (sessions + new + delete + model) ─────────── */
.pc-toolbar {
  display: flex; gap: 6px; align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid hsl(var(--border));
  flex-shrink: 0;
}

/* ── pc-fullscreen — спрятать всё кроме left ──────────────── */
.pc-icon-collapse { display: none; }
body.pc-fullscreen .pc-icon-expand { display: none; }
body.pc-fullscreen .pc-icon-collapse { display: block; }

/* ── Attachments chips ───────────────────────────────────── */
.pc-attachments {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 8px 12px;
  border-top: 1px solid hsl(var(--border));
}
.pc-attach-chip {
  display: inline-flex; gap: 6px; align-items: center;
  padding: 3px 8px;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  font-size: 10px;
  font-family: var(--font-mono);
}
.pc-attach-size { color: hsl(var(--muted-foreground)); font-size: 9px; }
.pc-attach-x, .pc-attach-up {
  background: transparent; border: none; color: hsl(var(--muted-foreground));
  cursor: pointer; font-family: var(--font-mono); font-size: 11px; line-height: 1;
  padding: 0 0 0 4px;
}
.pc-attach-x:hover { color: hsl(var(--primary)); }
.pc-attach-btn {
  width: 32px; height: 32px;
  background: transparent;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.pc-attach-btn:hover { color: hsl(var(--primary)); border-color: hsl(var(--primary)); }

/* ── Resizers ────────────────────────────────────────────── */
.resizer {
  width: 4px;
  background: transparent;
  cursor: col-resize;
  user-select: none;
  grid-row: 1;
  display: none;
  transition: background .15s;
}
.resizer:hover, .resizer.dragging {
  background: hsl(var(--primary) / 0.5);
}
body.has-left-chat .resizer-left { display: block; grid-column: 1 / span 2; justify-self: end; }
body.has-right-chat .resizer-right { display: block; grid-column: 3 / span 1; justify-self: start; }
body.pc-fullscreen .resizer { display: none; }

/* ── Container starting spinner + modal ───────────────────── */
.container-starting-spinner {
  width: 28px; height: 28px;
  margin: 0 auto 18px;
  border: 2px solid hsl(var(--border));
  border-top-color: hsl(var(--primary));
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Navbar Claude button ─────────────────────────────────── */
.nav-btn-claude {
  display: inline-flex; gap: 6px; align-items: center;
  height: 30px; padding: 0 10px;
  background: transparent;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-btn-claude:hover {
  background: hsl(var(--accent));
  color: hsl(var(--foreground));
  border-color: hsl(var(--smui-border-hover));
}
body.has-right-chat .nav-btn-claude {
  background: hsl(var(--primary) / 0.15);
  color: hsl(var(--primary));
  border-color: hsl(var(--primary) / 0.4);
}

/* ── Унифицированные кнопки в header'ах чатов и explorer'а (24px) ── */
.btn-hdr {
  height: 24px;
  display: inline-flex; align-items: center;
  padding: 0 10px;
  background: transparent;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.btn-hdr:hover {
  background: hsl(var(--accent));
  color: hsl(var(--foreground));
  border-color: hsl(var(--smui-border-hover));
}
.btn-hdr-primary {
  background: hsl(var(--primary) / 0.15);
  border-color: hsl(var(--primary) / 0.4);
  color: hsl(var(--primary));
}
.btn-hdr-primary:hover {
  background: hsl(var(--primary) / 0.25);
  border-color: hsl(var(--primary));
  color: hsl(var(--primary));
}

/* ── Template-cards (модалка «+ Шаблон») ──────────────────── */
.template-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.template-card-pick {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  text-align: left;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: border-color .15s, background .15s;
}
.template-card-pick:hover { border-color: hsl(var(--smui-border-hover)); }
.template-card-pick.active {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.08);
}
.template-card-pick .t-pick-title {
  font-size: 12px; font-weight: 700;
  color: hsl(var(--foreground));
  letter-spacing: .02em;
}
.template-card-pick .t-pick-desc {
  font-size: 10.5px; line-height: 1.45;
  color: hsl(var(--muted-foreground));
  margin-top: 2px;
}
.template-card-pick .t-pick-folder {
  font-size: 9.5px; color: hsl(var(--muted-foreground));
  opacity: .6;
  margin-top: 6px;
}
.template-card-pick.active .t-pick-folder { color: hsl(var(--primary)); opacity: 1; }
@media (max-width: 600px) {
  .template-cards { grid-template-columns: 1fr; }
}

/* ── Navbar: container toggle + open-vscode ───────────────── */
.nav-btn-container {
  display: inline-flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  height: 30px; padding: 2px 10px;
  background: transparent;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  font-family: var(--font-mono);
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-btn-container:hover { border-color: hsl(var(--smui-border-hover)); }
.nav-btn-container-top {
  display: inline-flex; gap: 5px; align-items: center;
  font-size: 10px; font-weight: 600;
  letter-spacing: .03em;
}
.nav-btn-container-sub {
  font-size: 8px; font-weight: 500;
  letter-spacing: .05em;
  opacity: .75;
  font-variant-numeric: tabular-nums;
  min-height: 9px;
}
.nav-btn-container-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: hsl(var(--muted-foreground));
  flex-shrink: 0;
}
/* Running = зелёный */
.nav-btn-container.running {
  background: hsl(var(--smui-green) / 0.18);
  border-color: hsl(var(--smui-green) / 0.55);
  color: hsl(var(--smui-green));
}
.nav-btn-container.running .nav-btn-container-dot { background: hsl(var(--smui-green)); }
.nav-btn-container.running:hover {
  background: hsl(var(--smui-green) / 0.28);
  border-color: hsl(var(--smui-green));
}
/* Stopped = красный */
.nav-btn-container:not(.running):not(.disabled) {
  background: hsl(var(--smui-red) / 0.15);
  border-color: hsl(var(--smui-red) / 0.5);
  color: hsl(var(--smui-red));
}
.nav-btn-container:not(.running):not(.disabled) .nav-btn-container-dot {
  background: hsl(var(--smui-red));
}
.nav-btn-container:not(.running):not(.disabled):hover {
  background: hsl(var(--smui-red) / 0.25);
  border-color: hsl(var(--smui-red));
}
/* Disabled = серый (контейнер не создан) */
.nav-btn-container.disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* Open VS Code — серый фон как у логотипа KG, две строки как у auth-group */
.nav-btn-vscode {
  display: inline-flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  height: 30px; padding: 2px 10px;
  background: hsl(var(--foreground) / 0.65);
  color: hsl(var(--background));
  border: none;
  font-family: var(--font-mono);
  line-height: 1;
  cursor: pointer;
  transition: opacity .15s;
  white-space: nowrap;
}
.nav-btn-vscode:hover { opacity: .85; }
.nav-btn-vscode-top { font-size: 10px; font-weight: 600; letter-spacing: .03em; }
.nav-btn-vscode-sub {
  font-size: 8px; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase;
  opacity: .85;
}

/* ── Navbar center (4 view-tab'а) ─────────────────────────── */
.navbar-center {
    position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; gap: 4px; align-items: center;
}
.btn-nav {
  display: inline-flex; gap: 6px; align-items: center;
  height: 30px; padding: 0 12px;
  background: transparent;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-nav:hover {
  background: hsl(var(--accent));
  color: hsl(var(--foreground));
  border-color: hsl(var(--smui-border-hover));
}
.btn-nav.active {
  background: hsl(var(--primary) / 0.12);
  border-color: hsl(var(--primary));
  color: hsl(var(--primary));
}
@media (max-width: 900px) {
  .btn-nav .btn-nav-text { display: none; }
  .btn-nav { width: 30px; padding: 0; justify-content: center; }
}

/* ── view-обёртки ─────────────────────────────────────────── */
.view { display: block; }
.view.hidden { display: none !important; }

/* ── VS CODE view: hero-bar в одну строку + недавние проекты ── */
.vscode-hero {
  display: grid; grid-template-columns: 1fr auto auto;
  gap: 16px; align-items: center;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  padding: 22px 24px;
  margin-bottom: 24px;
  max-width: 972px; margin-left: auto; margin-right: auto;
}
.vscode-hero-label {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .08em; text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}
.vscode-hero-path {
  font-family: var(--font-mono); font-size: 16px; font-weight: 600;
  color: hsl(var(--foreground));
  margin-top: 4px;
}
.vscode-hero-mid .nav-btn-container {
  height: 44px; padding: 4px 14px;
}
.vscode-hero-mid .nav-btn-container-top { font-size: 11px; }
.vscode-hero-mid .nav-btn-container-sub { font-size: 9px; }
.vscode-hero-right .nav-btn-vscode {
  height: 44px; padding: 4px 18px;
}
.vscode-hero-right .nav-btn-vscode-top { font-size: 13px; }
.vscode-hero-right .nav-btn-vscode-sub { font-size: 9px; }
.vscode-recent {
  max-width: 972px; margin-left: auto; margin-right: auto;
}

/* ── COURSE view ──────────────────────────────────────────── */
.course-head { max-width: 760px; margin: 0 auto 28px; }
.course-badge {
  display: inline-block;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  margin-bottom: 14px;
}
.course-h1 {
  font-family: var(--font-mono);
  font-size: 30px; font-weight: 700;
  letter-spacing: -.01em;
  color: hsl(var(--foreground));
  margin-bottom: 14px;
}
.course-h1 em {
  font-style: normal;
  color: hsl(var(--primary));
}
.course-lead {
  font-size: 14px; line-height: 1.6;
  color: hsl(var(--muted-foreground));
  max-width: 64ch;
}
.course-lead a { color: hsl(var(--primary)); text-decoration: underline; text-underline-offset: 2px; }
.course-modules {
  display: flex; flex-direction: column; gap: 10px;
  max-width: 760px; margin: 0 auto;
}
.course-module {
  display: grid; grid-template-columns: 60px 1fr auto;
  align-items: stretch;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  text-decoration: none;
  transition: border-color .15s;
}
.course-module:hover { border-color: hsl(var(--primary)); }
.course-module--recommended {
  border-color: hsl(var(--smui-green) / 0.5);
}
.course-module--recommended:hover { border-color: hsl(var(--smui-green)); }
.course-module--recommended .course-module-no {
  background: hsl(var(--smui-green) / 0.15);
  color: hsl(var(--smui-green));
  border-right-color: hsl(var(--smui-green) / 0.3);
}
.course-module--recommended .course-module-cta {
  color: hsl(var(--smui-green));
}
.course-module-no {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 13px; font-weight: 700;
  background: hsl(var(--primary) / 0.10);
  color: hsl(var(--primary));
  letter-spacing: .04em;
  border-right: 1px solid hsl(var(--border));
}
.course-module-body { padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; }
.course-module-title {
  font-family: var(--font-mono); font-size: 13px; font-weight: 700;
  color: hsl(var(--foreground));
}
.course-module-desc {
  font-size: 12px; line-height: 1.5;
  color: hsl(var(--muted-foreground));
}
.course-module-cta {
  display: flex; align-items: center;
  padding: 0 18px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: .04em;
  color: hsl(var(--primary));
  border-left: 1px solid hsl(var(--border));
}

/* ── Skills: диаграмма уровней установки ───────────────── */
.skills-scope-diagram {
  display: grid;
  grid-template-columns: 1fr 48px 1fr;
  gap: 0;
  align-items: center;
  max-width: 720px;
  margin: 12px 0 0;
}
.skills-scope-card {
  border: 1px solid hsl(var(--border));
  background: hsl(var(--smui-surface-1));
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.skills-scope-global { border-color: hsl(var(--primary) / 0.4); }
.skills-scope-project { border-color: hsl(var(--smui-green) / 0.5); }
.skills-scope-badge {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: .08em; color: hsl(var(--muted-foreground));
}
.skills-scope-path {
  font-family: var(--font-mono); font-size: 14px; font-weight: 700;
  color: hsl(var(--foreground));
}
.skills-scope-tree pre {
  margin: 0; font-size: 11px; line-height: 1.6;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--smui-surface-0)); padding: 10px 12px;
  border: 1px solid hsl(var(--border));
  overflow-x: auto;
}
.skills-scope-props {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 3px;
}
.skills-scope-props li {
  font-size: 11px; color: hsl(var(--muted-foreground)); line-height: 1.4;
}
.skills-scope-props li strong { color: hsl(var(--foreground)); }
.skills-scope-note {
  font-size: 11px; color: hsl(var(--muted-foreground));
  border-top: 1px solid hsl(var(--border)); padding-top: 8px;
  font-style: italic;
}
.skills-scope-note--highlight {
  color: hsl(var(--smui-green));
  border-top-color: hsl(var(--smui-green) / 0.3);
}
.skills-scope-arrow {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 0 4px;
}
.skills-scope-arrow-line {
  width: 100%; height: 1px; background: hsl(var(--border));
  position: relative;
}
.skills-scope-arrow-line::after {
  content: '→'; position: absolute; right: -6px; top: -9px;
  font-size: 14px; color: hsl(var(--muted-foreground));
}
.skills-scope-arrow-label {
  font-size: 9px; font-family: var(--font-mono);
  color: hsl(var(--muted-foreground)); text-align: center;
  line-height: 1.4; letter-spacing: .03em; text-transform: uppercase;
}
@media (max-width: 640px) {
  .skills-scope-diagram {
    grid-template-columns: 1fr;
  }
  .skills-scope-arrow { flex-direction: row; padding: 8px 0; }
  .skills-scope-arrow-line { width: 40px; }
  .skills-scope-arrow-line::after { content: '↓'; right: auto; left: 50%; top: -9px; }
}

/* ── Skills: команда vs скилл vs агент ─────────────────── */
/* Диаграмма потока */
.sca-flow {
  display: grid;
  grid-template-columns: 52px 1fr 52px 1fr;
  gap: 6px 0;
  align-items: center;
  max-width: 680px;
  margin: 0 0 20px;
  background: hsl(var(--smui-surface-0));
  border: 1px solid hsl(var(--border));
  padding: 14px 16px;
}
.sca-flow-actor {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.sca-flow-actor-icon { font-size: 20px; line-height: 1; }
.sca-flow-actor-label {
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  color: hsl(var(--muted-foreground)); letter-spacing: .06em; text-transform: uppercase;
}
.sca-flow-msg {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px;
  font-size: 11px; font-family: var(--font-mono);
  color: hsl(var(--muted-foreground));
}
.sca-flow-msg code { font-size: 11px; }
.sca-flow-msg-arrow { opacity: .4; white-space: nowrap; }
.sca-flow-msg--cmd   { border-left: 2px solid hsl(var(--primary) / .5); }
.sca-flow-msg--skill { border-left: 2px solid hsl(var(--smui-green) / .5); }
.sca-flow-msg--agent { border-left: 2px solid hsl(39 80% 55% / .5); }
.sca-flow-result {
  grid-column: 4;
  font-size: 11px; line-height: 1.5;
  color: hsl(var(--muted-foreground));
  padding: 4px 8px;
  border-left: 1px dashed hsl(var(--border));
}
.sca-flow-result em { font-style: normal; color: hsl(var(--foreground)); }
.sca-flow-tag {
  display: inline-block;
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  letter-spacing: .08em; padding: 1px 5px;
  margin-right: 6px; vertical-align: middle;
}
.sca-flow-result--cmd   .sca-flow-tag { background: hsl(var(--primary) / .15);   color: hsl(var(--primary)); }
.sca-flow-result--skill .sca-flow-tag { background: hsl(var(--smui-green) / .15); color: hsl(var(--smui-green)); }
.sca-flow-result--agent .sca-flow-tag { background: hsl(39 80% 55% / .15);        color: hsl(39 80% 60%); }

/* Три карточки */
.sca-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  max-width: 760px; margin: 0;
}
.sca-card {
  border: 1px solid hsl(var(--border));
  background: hsl(var(--smui-surface-1));
  padding: 14px; display: flex; flex-direction: column; gap: 8px;
}
.sca-card--cmd   { border-top: 2px solid hsl(var(--primary)); }
.sca-card--skill { border-top: 2px solid hsl(var(--smui-green)); }
.sca-card--agent { border-top: 2px solid hsl(39 80% 55%); }
.sca-card-header {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.sca-card-icon { font-size: 16px; }
.sca-card-name {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  letter-spacing: .08em; color: hsl(var(--foreground));
}
.sca-card-path {
  font-size: 10px; color: hsl(var(--muted-foreground));
  background: hsl(var(--smui-surface-0)); padding: 1px 5px;
  border: 1px solid hsl(var(--border));
}
.sca-card-who {
  font-size: 11px; color: hsl(var(--foreground));
  background: hsl(var(--smui-surface-0)); padding: 6px 8px;
  border-left: 2px solid hsl(var(--border));
}
.sca-card--cmd   .sca-card-who { border-color: hsl(var(--primary)); }
.sca-card--skill .sca-card-who { border-color: hsl(var(--smui-green)); }
.sca-card--agent .sca-card-who { border-color: hsl(39 80% 55%); }
.sca-card-who code { font-size: 10px; }
.sca-card-what {
  font-size: 11px; line-height: 1.6; color: hsl(var(--muted-foreground));
}
.sca-card-when {
  font-size: 10px; line-height: 1.5; color: hsl(var(--muted-foreground));
  border-top: 1px solid hsl(var(--border)); padding-top: 7px;
  font-style: italic;
}
@media (max-width: 640px) {
  .sca-cards { grid-template-columns: 1fr; }
  .sca-flow  { grid-template-columns: 44px 1fr 44px; }
  .sca-flow-result { grid-column: 1 / -1; border-left: none; border-top: 1px dashed hsl(var(--border)); }
}

/* ── MATERIALS view: sub-tabs + якорные чипы + page-* ──── */
.materials-subnav {
  display: flex; gap: 6px; flex-wrap: wrap;
  max-width: 972px; margin: 0 auto 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid hsl(var(--border));
}
.materials-tab {
  display: inline-flex; gap: 6px; align-items: center;
  height: 30px; padding: 0 12px;
  background: transparent;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
}
.materials-tab:hover { color: hsl(var(--foreground)); border-color: hsl(var(--smui-border-hover)); }
.materials-tab.active {
  background: hsl(var(--primary) / 0.12);
  border-color: hsl(var(--primary));
  color: hsl(var(--primary));
}
.materials-tab-icon { font-size: 11px; }

.materials-page {
  max-width: 760px; margin: 0 auto;
}
.materials-page.hidden { display: none; }
.page-meta {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  margin-bottom: 12px;
}
.page-h1 {
  font-family: var(--font-mono);
  font-size: 32px; font-weight: 700;
  letter-spacing: -.01em;
  color: hsl(var(--foreground));
  margin-bottom: 14px;
}
.page-h1 em { font-style: normal; color: hsl(var(--primary)); }
.page-lead {
  font-size: 14px; line-height: 1.6;
  color: hsl(var(--muted-foreground));
  margin-bottom: 24px;
  max-width: 64ch;
}

.anchor-chips {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 32px;
}
.anchor-chip {
  display: inline-flex; gap: 6px; align-items: center;
  padding: 4px 11px;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: .04em;
  text-decoration: none;
  transition: color .15s, border-color .15s;
}
.anchor-chip::before {
  content: '●'; font-size: 7px;
  color: hsl(var(--primary)); opacity: .7;
}
.anchor-chip:hover {
  color: hsl(var(--foreground));
  border-color: hsl(var(--primary) / 0.45);
}

.page-sect {
  background: hsl(var(--card));
  border-left: 3px solid hsl(var(--primary));
  border-top: 1px solid hsl(var(--border));
  border-right: 1px solid hsl(var(--border));
  border-bottom: 1px solid hsl(var(--border));
  padding: 18px 22px;
  margin-bottom: 14px;
  scroll-margin-top: 56px;
}
.page-sect-no {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: hsl(var(--foreground));
  margin-bottom: 8px;
}
.page-sect p, .page-list li {
  font-size: 13px; line-height: 1.6;
  color: hsl(var(--foreground));
}
.page-sect p { margin-bottom: 8px; }
.page-list { padding-left: 22px; }
.page-list li { margin: 4px 0; }
.page-list li::marker { color: hsl(var(--primary)); }
.page-table {
  width: 100%; border-collapse: collapse;
  font-family: var(--font-mono); font-size: 12px;
}
.page-table thead th {
  text-align: left;
  font-weight: 600; font-size: 10px;
  letter-spacing: .08em; text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  padding: 7px 12px;
  border-bottom: 1px solid hsl(var(--border));
}
.page-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  vertical-align: top;
}
.page-table tbody tr:last-child td { border-bottom: none; }
.page-table td:first-child { white-space: nowrap; width: 1%; }

.page-faq {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  margin-bottom: 8px;
}
.page-faq summary {
  padding: 11px 16px;
  cursor: pointer;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  color: hsl(var(--foreground));
  list-style: none;
}
.page-faq summary::-webkit-details-marker { display: none; }
.page-faq summary::before {
  content: '+'; margin-right: 10px; color: hsl(var(--primary)); font-weight: 700;
}
.page-faq[open] summary::before { content: '−'; }
.page-faq p {
  padding: 0 16px 14px;
  font-size: 12.5px; line-height: 1.6;
  color: hsl(var(--muted-foreground));
}

@media (max-width: 800px) {
  .vscode-hero { grid-template-columns: 1fr; gap: 12px; }
}

/* ── COURSE: двухколоночный layout ─────────────────────── */
.course-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
  height: calc(100vh - 44px - 48px);
  max-width: 1200px;
  margin: 0 auto;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  overflow: hidden;
}
.course-side {
  border-right: 1px solid hsl(var(--border));
  overflow-y: auto;
  background: hsl(var(--card));
}
.course-side-head {
  padding: 16px 18px;
  border-bottom: 1px solid hsl(var(--border));
  display: flex; flex-direction: column; gap: 2px;
}
.course-side-title {
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  letter-spacing: .04em; color: hsl(var(--foreground));
}
.course-side-sub {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .08em; text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}
.course-tree { display: flex; flex-direction: column; padding: 6px 0; }
.course-tree-intro {
  display: flex; gap: 10px; align-items: center;
  padding: 8px 18px;
  background: transparent;
  border: none; border-left: 2px solid transparent;
  cursor: pointer; text-align: left;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  color: hsl(var(--foreground));
}
.course-tree-intro:hover { background: hsl(var(--accent)); }
.course-tree-intro.active {
  background: hsl(var(--primary) / 0.10);
  color: hsl(var(--primary));
  border-left-color: hsl(var(--primary));
}
.course-tree-intro-no { color: hsl(var(--primary)); font-size: 12px; }

.course-tree-module {
  border-top: 1px solid hsl(var(--border));
}
.course-tree-mod-head {
  display: flex; gap: 8px; align-items: baseline;
  width: 100%; padding: 10px 18px;
  background: transparent; border: none;
  cursor: pointer; text-align: left;
  font-family: var(--font-mono);
  color: hsl(var(--foreground));
}
.course-tree-mod-head:hover { background: hsl(var(--accent)); }
.course-tree-caret {
  color: hsl(var(--muted-foreground));
  font-size: 9px; flex-shrink: 0;
  transition: transform .15s;
}
.course-tree-module.is-open .course-tree-caret { transform: rotate(90deg); }
.course-tree-mod-no {
  font-size: 10px; font-weight: 700;
  letter-spacing: .08em;
  color: hsl(var(--primary));
  flex-shrink: 0;
}
.course-tree-mod-title {
  font-size: 11px; font-weight: 600;
  line-height: 1.35;
}
.course-tree-mod-body { display: none; padding-bottom: 6px; }
.course-tree-module.is-open .course-tree-mod-body { display: block; }
.course-tree-lesson, .course-tree-card {
  display: flex; gap: 10px; align-items: baseline;
  width: 100%; padding: 6px 18px 6px 36px;
  background: transparent;
  border: none; border-left: 2px solid transparent;
  cursor: pointer; text-align: left;
  font-family: var(--font-mono); font-size: 10.5px;
  color: hsl(var(--muted-foreground));
  line-height: 1.4;
  transition: background .1s, color .1s, border-color .1s;
}
.course-tree-lesson:hover, .course-tree-card:hover {
  background: hsl(var(--accent));
  color: hsl(var(--foreground));
}
.course-tree-lesson.active, .course-tree-card.active {
  background: hsl(var(--primary) / 0.10);
  color: hsl(var(--primary));
  border-left-color: hsl(var(--primary));
}
.course-tree-lesson-no {
  width: 14px; flex-shrink: 0;
  text-align: right;
  font-weight: 700;
  color: hsl(var(--muted-foreground));
}
.course-tree-lesson.active .course-tree-lesson-no { color: hsl(var(--primary)); }
.course-tree-card { font-weight: 600; }
.course-tree-card-icon { font-size: 11px; }
.course-tree-card-materials .course-tree-card-icon { filter: hue-rotate(10deg); }

.course-content {
  overflow-y: auto;
  padding: 32px 40px;
}
.course-placeholder {
  margin-top: 24px;
  padding: 36px 24px;
  background: hsl(var(--background));
  border: 1px dashed hsl(var(--border));
  text-align: center;
}
.course-placeholder-icon { font-size: 32px; margin-bottom: 10px; }
.course-placeholder-title {
  font-family: var(--font-mono); font-size: 13px; font-weight: 700;
  letter-spacing: .04em; color: hsl(var(--foreground));
  margin-bottom: 6px;
}
.course-placeholder-desc {
  font-size: 12px; line-height: 1.55;
  color: hsl(var(--muted-foreground));
  max-width: 56ch; margin: 0 auto;
}
.course-nav {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid hsl(var(--border));
}
.course-nav-prev, .course-nav-next {
  padding: 8px 12px;
  background: transparent;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  font-family: var(--font-mono); font-size: 10.5px;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, color .15s;
}
.course-nav-next { text-align: right; }
.course-nav-prev:hover, .course-nav-next:hover {
  border-color: hsl(var(--primary));
  color: hsl(var(--primary));
}

.course-intro-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 24px;
}
.course-intro-card {
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  padding: 14px 16px;
}
.course-intro-card-no {
  font-family: var(--font-mono); font-size: 14px; font-weight: 700;
  letter-spacing: .06em; color: hsl(var(--primary));
}
.course-intro-card-title {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  line-height: 1.45;
  color: hsl(var(--foreground));
  margin-top: 6px;
}
.course-intro-card-meta {
  font-size: 10px; color: hsl(var(--muted-foreground));
  margin-top: 6px;
}

@media (max-width: 800px) {
  .course-layout { grid-template-columns: 1fr; height: auto; }
  .course-side { max-height: 40vh; }
}

/* ── LINKS: big tiles + readable link color ───────────── */
.link-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.link-tiles-primary { margin-bottom: 28px; }
.link-tile {
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 20px;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.link-tile:hover {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.06);
}
.link-tile-label {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase;
  color: hsl(var(--primary));
}
.link-tile-title {
  font-family: var(--font-mono); font-size: 16px; font-weight: 700;
  letter-spacing: -.01em;
  color: hsl(var(--foreground));
  margin-top: 4px;
}
.link-tile-desc {
  font-size: 12px; line-height: 1.5;
  color: hsl(var(--muted-foreground));
  margin-top: 6px;
}
.link-tile-alt .link-tile-label { color: hsl(var(--muted-foreground)); }

.page-h2 {
  font-family: var(--font-mono);
  font-size: 13px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: hsl(var(--foreground));
  margin: 28px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid hsl(var(--border));
}

/* ── Читаемый цвет ссылок в текстовых страницах ───────── */
.page-list a,
.page-lead a,
.course-placeholder-desc a {
  color: hsl(190 80% 60%);  /* мягкий cyan, на тёмном фоне читается лучше чем primary */
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.page-list a:hover,
.page-lead a:hover,
.course-placeholder-desc a:hover {
  color: hsl(190 90% 70%);
  text-decoration-thickness: 2px;
}
html:not(.dark) .page-list a,
html:not(.dark) .page-lead a,
html:not(.dark) .course-placeholder-desc a {
  color: hsl(210 80% 45%);
}
html:not(.dark) .page-list a:hover,
html:not(.dark) .page-lead a:hover,
html:not(.dark) .course-placeholder-desc a:hover {
  color: hsl(210 90% 35%);
}

/* ── Course intro card → кликабельная ──────────────────── */
.course-intro-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 18px;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, background .15s;
}
.course-intro-card:hover {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.06);
}
.course-intro-card-cta {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  letter-spacing: .04em;
  color: hsl(var(--primary));
}

/* ── Module overview: 2 big action buttons + lessons list ── */
.module-actions {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px; margin-bottom: 8px;
}
.module-action-btn {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  cursor: pointer; text-align: left;
  font-family: inherit;
  transition: border-color .15s, background .15s;
}
.module-action-btn:hover {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.06);
}
.module-action-icon {
  font-size: 18px; line-height: 1; flex-shrink: 0;
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: hsl(var(--primary) / 0.12);
  color: hsl(var(--primary));
}
.module-action-body {
  display: flex; flex-direction: column; gap: 4px;
  min-width: 0;
}
.module-action-label {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: hsl(var(--foreground));
}
.module-action-sub {
  font-size: 11.5px; line-height: 1.4;
  color: hsl(var(--muted-foreground));
}
.module-action-hw .module-action-icon { background: hsl(var(--smui-green) / 0.15); color: hsl(var(--smui-green)); }
.module-action-mk .module-action-icon { background: hsl(40 80% 55% / 0.15); color: hsl(40 80% 55%); }
.module-action-bonus .module-action-icon { background: hsl(280 60% 65% / 0.15); color: hsl(280 60% 65%); }

.module-lessons {
  display: flex; flex-direction: column; gap: 4px;
}
.module-lesson {
  display: grid; grid-template-columns: 28px 1fr auto;
  align-items: baseline; gap: 12px;
  padding: 10px 14px;
  background: transparent;
  border: 1px solid hsl(var(--border));
  cursor: pointer; text-align: left;
  font-family: var(--font-mono);
  transition: border-color .15s, background .15s, color .15s;
}
.module-lesson:hover {
  border-color: hsl(var(--primary) / 0.6);
  background: hsl(var(--primary) / 0.04);
}
.module-lesson-no {
  font-size: 10px; font-weight: 700;
  letter-spacing: .04em;
  color: hsl(var(--primary));
  text-align: center;
}
.module-lesson-title {
  font-size: 12px; line-height: 1.45;
  color: hsl(var(--foreground));
}
.module-lesson-cta {
  font-size: 14px;
  color: hsl(var(--muted-foreground));
}
.module-lesson:hover .module-lesson-cta { color: hsl(var(--primary)); }

@media (max-width: 700px) {
  .module-actions { grid-template-columns: 1fr; }
}

/* Подсветка для выбранного модуля в sidebar */
.course-tree-mod-head.active {
  background: hsl(var(--primary) / 0.10);
  border-left: 2px solid hsl(var(--primary));
  padding-left: 16px;
}
.course-tree-mod-head.active .course-tree-mod-no,
.course-tree-mod-head.active .course-tree-mod-title { color: hsl(var(--primary)); }

/* ── Шаблоны для скачивания (materials > Шаблоны) ─────────── */
.dl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.dl-card {
  border: 1px solid hsl(var(--border));
  border-radius: 12px;
  background: hsl(var(--card));
  padding: 18px;
  display: flex;
  flex-direction: column;
}
.dl-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.dl-card-icon { font-size: 26px; line-height: 1; }
.dl-card-title {
  font-size: 15px;
  font-weight: 700;
  color: hsl(var(--foreground));
}
.dl-card-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: hsl(var(--muted-foreground));
  margin-top: 2px;
}
.dl-card-desc {
  font-size: 13px;
  line-height: 1.55;
  color: hsl(var(--muted-foreground));
  margin-bottom: 16px;
  flex: 1;
}
.dl-btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.dl-btn { text-decoration: none; text-align: center; }
.dl-btn-sec {
  text-decoration: none;
  text-align: center;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
}
.dl-btn-sec:hover { color: hsl(var(--foreground)); border-color: hsl(var(--foreground) / .4); }

/* ── Публикация приложений ─────────────────────────────────── */
.pub-row { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0; font-size: 13px; cursor: pointer; }
.pub-row input { margin-top: 2px; }
.pub-url-box {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: hsl(var(--accent) / .4); border: 1px solid hsl(var(--border));
  border-radius: 6px; padding: 8px 10px; margin: 10px 0;
}
.pub-url { font-family: var(--font-mono); font-size: 12px; color: hsl(var(--foreground)); word-break: break-all; flex: 1; }
.pub-status { font-family: var(--font-mono); font-size: 11px; color: hsl(var(--muted-foreground)); margin: 6px 0; }


/* ── Кнопки в футере модалок — одного размера ──────────────── */
.modal-footer .btn { min-width: 96px; }

/* ── Кастомный select (вместо системного) ─────────────────── */
.kg-select-native { display: none !important; }
.kg-select { position: relative; width: 100%; font-family: var(--font-mono); }
.kg-select-btn {
  height: 32px; width: 100%; padding: 0 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1px solid hsl(var(--input)); background: hsl(var(--secondary));
  color: hsl(var(--foreground)); font-size: 13px; font-family: var(--font-mono);
  cursor: pointer; text-align: left; transition: border-color .15s;
}
.kg-select-btn:hover { border-color: hsl(var(--smui-border-hover)); }
.kg-select.open .kg-select-btn { border-color: hsl(var(--primary)); }
.kg-select-btn svg { flex-shrink: 0; transition: transform .15s; opacity: .7; }
.kg-select.open .kg-select-btn svg { transform: rotate(180deg); }
.kg-select-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kg-select-menu {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  z-index: 50; max-height: 240px; overflow-y: auto;
  background: hsl(var(--popover, var(--card))); border: 1px solid hsl(var(--border));
  border-radius: 6px; box-shadow: 0 8px 24px hsl(0 0% 0% / .35);
}
.kg-select.open .kg-select-menu { display: block; }
.kg-select-item {
  width: 100%; text-align: left; padding: 8px 10px; cursor: pointer;
  background: transparent; border: none; border-bottom: 1px solid hsl(var(--border));
  color: hsl(var(--foreground)); font-size: 13px; font-family: var(--font-mono);
}
.kg-select-item:last-child { border-bottom: none; }
.kg-select-item:hover { background: hsl(var(--primary) / .12); color: hsl(var(--primary)); }
.kg-select-item.active { background: hsl(var(--primary) / .15); color: hsl(var(--primary)); }

/* ═══════════════════════════════════════════════════════════
 * Конспекты уроков (Курс → урок). Тёмная/светлая темы через токены.
 * ═══════════════════════════════════════════════════════════ */
.lesson-note { max-width: 70ch; margin-top: 4px; }
.lesson-note > p { font-size: 13.5px; line-height: 1.66; color: hsl(var(--foreground)); margin: 0 0 14px; }
.lesson-note > p.muted { color: hsl(var(--muted-foreground)); }
.lesson-note strong { color: hsl(var(--foreground)); font-weight: 600; }
.lesson-note em { font-style: normal; color: hsl(var(--primary)); }

/* «В этом уроке» — чипы-якоря */
.note-toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 26px; }
.note-toc-chip {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 10px;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
}

/* Заголовок секции с номером */
.note-h2 {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 14px; font-weight: 700;
  letter-spacing: .02em; color: hsl(var(--foreground));
  margin: 34px 0 14px; padding-bottom: 9px;
  border-bottom: 1px solid hsl(var(--border));
}
.note-h2-no {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  font-size: 11px; font-weight: 700;
  background: hsl(var(--primary) / .14); color: hsl(var(--primary));
  border: 1px solid hsl(var(--primary) / .4);
}

.lesson-note ul { margin: 0 0 16px; padding: 0; list-style: none; }
.lesson-note ul li {
  position: relative; padding: 3px 0 3px 20px;
  font-size: 13px; line-height: 1.6; color: hsl(var(--foreground));
}
.lesson-note ul li::before {
  content: '▸'; position: absolute; left: 2px; top: 3px;
  color: hsl(var(--primary)); font-size: 11px;
}

/* Инлайн-«клавиша»/код */
.kbd {
  font-family: var(--font-mono); font-size: 11.5px;
  padding: 1px 6px; margin: 0 1px;
  background: hsl(var(--secondary)); color: hsl(var(--smui-frost-2));
  border: 1px solid hsl(var(--border));
  white-space: nowrap;
}

/* Колауты: ключевое / лайфхак / осторожно */
.note-callout {
  display: flex; gap: 12px; align-items: flex-start;
  margin: 18px 0; padding: 13px 15px;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-left-width: 3px;
}
.note-callout-ic { flex: none; font-size: 16px; line-height: 1.4; }
.note-callout-body { font-size: 12.5px; line-height: 1.6; color: hsl(var(--foreground)); }
.note-callout-label {
  display: block; font-family: var(--font-mono); font-size: 9.5px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; margin-bottom: 4px;
}
.note-callout.is-key  { border-left-color: hsl(var(--primary)); }
.note-callout.is-key  .note-callout-label { color: hsl(var(--primary)); }
.note-callout.is-tip  { border-left-color: hsl(var(--smui-green)); }
.note-callout.is-tip  .note-callout-label { color: hsl(var(--smui-green)); }
.note-callout.is-warn { border-left-color: hsl(var(--smui-orange)); }
.note-callout.is-warn .note-callout-label { color: hsl(var(--smui-orange)); }

/* Промт / цитата */
.note-quote {
  margin: 16px 0; padding: 12px 15px;
  background: hsl(var(--background)); border: 1px dashed hsl(var(--border));
  font-family: var(--font-mono); font-size: 12px; line-height: 1.6;
  color: hsl(var(--smui-frost-2));
}
.note-quote-label {
  display: block; font-size: 9.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: hsl(var(--muted-foreground)); margin-bottom: 6px;
}
.note-quote pre {
  margin: 0; font: inherit; color: inherit;
  white-space: pre; overflow-x: auto;
}

/* Шаги */
.note-steps { margin: 16px 0; padding: 0; list-style: none; counter-reset: st; }
.note-steps li {
  position: relative; counter-increment: st;
  padding: 7px 0 7px 38px; min-height: 26px;
  font-size: 13px; line-height: 1.55; color: hsl(var(--foreground));
  border-bottom: 1px solid hsl(var(--border));
}
.note-steps li:last-child { border-bottom: none; }
.note-steps li::before {
  content: counter(st); position: absolute; left: 0; top: 6px;
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  background: hsl(var(--primary) / .14); color: hsl(var(--primary));
  border: 1px solid hsl(var(--primary) / .4);
}

/* Таблица сравнения */
.note-cmp-wrap { overflow-x: auto; margin: 18px 0; border: 1px solid hsl(var(--border)); }
.note-cmp { width: 100%; border-collapse: collapse; font-size: 12px; }
.note-cmp th, .note-cmp td {
  padding: 9px 12px; text-align: left; vertical-align: top;
  border-bottom: 1px solid hsl(var(--border));
}
.note-cmp thead th {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: hsl(var(--muted-foreground)); background: hsl(var(--background));
}
.note-cmp tbody tr:last-child td { border-bottom: none; }
.note-cmp tbody td:first-child { font-weight: 600; color: hsl(var(--foreground)); white-space: nowrap; }
.note-cmp td { color: hsl(var(--muted-foreground)); }
.note-cmp .pick { color: hsl(var(--smui-green)); font-weight: 600; }
.note-cmp .nope { color: hsl(var(--smui-red)); }

/* Фигура-диаграмма */
.note-fig {
  margin: 22px 0; padding: 18px;
  background: hsl(var(--background)); border: 1px solid hsl(var(--border));
}
.note-fig svg { width: 100%; height: auto; display: block; }
.note-fig-cap {
  margin-top: 12px; font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: .03em; color: hsl(var(--muted-foreground)); text-align: center;
}
/* Общая палитра для всех SVG-диаграмм конспектов */
.note-fig svg text { font-family: var(--font-mono); fill: hsl(var(--foreground)); }
.note-fig svg .t-mut  { fill: hsl(var(--muted-foreground)); }
.note-fig svg .t-pri  { fill: hsl(var(--primary)); }
.note-fig svg .t-grn  { fill: hsl(var(--smui-green)); }
.note-fig svg .t-org  { fill: hsl(var(--smui-orange)); }
.note-fig svg .t-red  { fill: hsl(var(--smui-red)); }
.note-fig svg .box    { fill: hsl(var(--card)); stroke: hsl(var(--border)); stroke-width: 1.2; }
.note-fig svg .box-pri{ fill: hsl(var(--primary) / .12); stroke: hsl(var(--primary)); stroke-width: 1.4; }
.note-fig svg .box-grn{ fill: hsl(var(--smui-green) / .12); stroke: hsl(var(--smui-green)); stroke-width: 1.4; }
.note-fig svg .box-org{ fill: hsl(var(--smui-orange) / .12); stroke: hsl(var(--smui-orange)); stroke-width: 1.4; }
.note-fig svg .box-dash { fill: none; stroke: hsl(var(--border)); stroke-width: 1.2; stroke-dasharray: 4 4; }
.note-fig svg .ln    { stroke: hsl(var(--muted-foreground)); stroke-width: 1.4; fill: none; }
.note-fig svg .ln-pri{ stroke: hsl(var(--primary)); stroke-width: 1.6; fill: none; }
.note-fig svg .ln-dash { stroke: hsl(var(--smui-red)); stroke-width: 1.6; fill: none; stroke-dasharray: 5 4; }
.note-fig svg .fill-mut { fill: hsl(var(--muted-foreground)); }
.note-fig svg .fill-pri { fill: hsl(var(--primary)); }
.note-fig svg .fill-bg  { fill: hsl(var(--background)); }
.note-fig svg .fill-track { fill: hsl(var(--secondary)); }

.lesson-note .note-end {
  margin-top: 26px; padding-top: 14px; border-top: 1px solid hsl(var(--border));
  font-size: 12px; color: hsl(var(--muted-foreground));
}

/* ───────────────────────── База знаний (хаб) ───────────────────────── */
.kb-layout { display: grid; grid-template-columns: 234px 1fr; gap: 20px; align-items: start; }
.kb-side { border: 1px solid hsl(var(--border)); background: hsl(var(--smui-surface-1)); position: sticky; top: 70px; }
.kb-group-h { padding: 11px 13px 6px; font-size: 10px; letter-spacing: .13em; text-transform: uppercase; color: hsl(var(--muted-foreground)); opacity: .8; }
.kb-group-h:not(:first-child) { border-top: 1px solid hsl(var(--border)); margin-top: 4px; }
.kb-item { display: flex; align-items: center; gap: 9px; padding: 8px 13px; cursor: pointer; font-size: 13px; color: hsl(var(--muted-foreground)); border-left: 2px solid transparent; }
.kb-item:hover { background: hsl(var(--smui-surface-2)); }
.kb-item.active { color: hsl(var(--foreground)); border-left-color: hsl(var(--primary)); background: hsl(var(--accent)); }
.kb-item .n { margin-left: auto; font-size: 11px; opacity: .55; }
.kb-search { display: flex; align-items: center; gap: 10px; border: 1px solid hsl(var(--border)); background: hsl(var(--smui-surface-1)); padding: 9px 13px; margin-bottom: 16px; }
.kb-search input { flex: 1; background: transparent; border: none; outline: none; color: hsl(var(--foreground)); font-family: var(--font-mono); font-size: 13px; }
.kb-search .k { font-size: 11px; color: hsl(var(--muted-foreground)); border: 1px solid hsl(var(--border)); padding: 1px 6px; }
@media (max-width: 760px) { .kb-layout { grid-template-columns: 1fr; } .kb-side { position: static; } }
