/* ============================================================
   Методический Контур — единая дизайн-система (pd-*)
   Эталон: страница детальной РПД (project_detail.html)
   Используется на всех страницах, кроме landing.html.
   ============================================================ */

/* ── Базовый каркас детальной РПД ─────────────────────────────────────── */
.pd-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  min-height: calc(100vh - 80px);
  align-items: start;
}
.pd-program-fgos_he    { --pd-program-accent: #1e40af; }
.pd-program-dpp        { --pd-program-accent: #6d28d9; }
.pd-program-vocational { --pd-program-accent: #0f766e; }
.pd-program-fgos_he   .pd-title,
.pd-program-dpp       .pd-title,
.pd-program-vocational .pd-title {
  border-left: 4px solid var(--pd-program-accent);
  padding-left: 12px;
}

/* Одноколоночная разметка (без боковой навигации РПД) */
.pd-layout--single { grid-template-columns: 1fr !important; }
.pd-layout--single .pd-main { padding-left: 0; padding-right: 0; max-width: 100%; }
.pd-layout--single .pd-sidebar { display: none !important; }

.pd-sidebar {
  position: sticky;
  top: 64px;
  padding: 24px 16px 24px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}
.pd-main { padding: 24px 0 48px 24px; min-width: 0; }

/* Стек страницы кабинета */
.pd-page-stack { display: flex; flex-direction: column; gap: 16px; width: 100%; min-width: 0; }
.pd-page-inner { width: 100%; min-width: 0; }
.cabinet-content .pd-layout--single > .pd-main--cabinet { padding: 0 0 48px 0; min-width: 0; }

.pd-narrow    { max-width: 720px; }
.pd-narrow-md { max-width: 880px; }
.pd-narrow-sm { max-width: 540px; }

.pd-auth-layout { min-height: 50vh; align-items: start; }
.pd-auth-main { padding: 32px 20px 64px !important; max-width: 480px; margin: 0 auto; width: 100%; }
.pd-preview-main { max-width: 960px; margin: 0 auto; padding: 20px 16px 48px !important; width: 100%; box-sizing: border-box; }

/* ── Quality widget (sidebar) ─────────────────────────────────────────── */
.pd-quality-widget {
  display: flex; flex-direction: column; align-items: center;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border-med);
  border-radius: var(--r);
}
.pd-quality-score { position: relative; width: 72px; height: 72px; }
.pd-quality-ring  { width: 72px; height: 72px; transform: rotate(-90deg); }
.pd-quality-bg    { fill: none; stroke: var(--border-med); stroke-width: 3; }
.pd-quality-arc   { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.pd-quality-score > span {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: var(--text);
}
.pd-quality-label { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 6px; }

/* ── Status-бейджи РПД ────────────────────────────────────────────────── */
.pd-status-badge {
  padding: 6px 12px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; text-align: center;
  display: inline-block;
}
.pd-status-ready        { background: var(--green-light);  color: var(--green); }
.pd-status-generating   { background: var(--accent-light); color: var(--accent); animation: pd-pulse 1.5s infinite; }
.pd-status-step_waiting { background: var(--amber-light);  color: var(--amber); }
.pd-status-error        { background: var(--red-light);    color: var(--red); }
.pd-status-pending, .pd-status- { background: var(--card-subtle); color: var(--text-muted); }
@keyframes pd-pulse { 0%,100%{opacity:1} 50%{opacity:.6} }

/* ── Навигация по разделам ────────────────────────────────────────────── */
.pd-nav { display: flex; flex-direction: column; gap: 2px; }
.pd-nav-label {
  font-size: 11px; font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .07em;
  margin-bottom: 6px; display: block;
}
.pd-nav-item {
  display: block; padding: 6px 10px;
  border-radius: var(--r-xs);
  font-size: 13px; color: var(--text-2);
  text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pd-nav-item:hover { background: var(--card-subtle); color: var(--text); }
.pd-nav-item.is-active { background: var(--accent-light); color: var(--accent); font-weight: 600; }

/* ── Кнопки в сайдбаре ────────────────────────────────────────────────── */
.pd-sidebar-actions { display: flex; flex-direction: column; gap: 8px; }
.pd-sidebar-btn {
  display: block; padding: 8px 12px;
  border-radius: var(--r-sm); border: 1px solid var(--border-med);
  font-size: 13px; font-weight: 500;
  text-align: center; text-decoration: none;
  color: var(--text); background: var(--card);
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.pd-sidebar-btn:hover { background: var(--card-subtle); }
.pd-sidebar-btn.danger { color: var(--red); border-color: rgba(220,38,38,.25); }
.pd-sidebar-btn.danger:hover { background: var(--red-light); }

/* ── Шапка страницы / детали ──────────────────────────────────────────── */
.pd-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.pd-header-text { min-width: 0; flex: 1; }
.pd-header-actions { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
.pd-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.pd-title { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -0.02em; color: var(--text); line-height: 1.25; }
.pd-meta  { font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.55; }
.pd-meta + .pd-meta { margin-top: 4px; }

.pd-doctype-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  border-radius: var(--r-pill); flex-shrink: 0;
}
.pd-doctype-rpd        { background: #EFF6FF; color: #1D4ED8; }
.pd-doctype-fos        { background: #F5F3FF; color: #6D28D9; }
.pd-doctype-annotation { background: #F0FDF4; color: #166534; }
.pd-doctype-practice   { background: #FFF7ED; color: #C2410C; }
.pd-doctype-gia        { background: #FFF1F2; color: #BE123C; }

.pd-page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.pd-page-header > div:first-child { min-width: 0; flex: 1; }
.pd-page-header h1 { font-size: 22px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.02em; color: var(--text); }

/* ── Кнопки ───────────────────────────────────────────────────────────── */
.pd-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer; border: 1px solid transparent;
  text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s, transform .15s;
}
.pd-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pd-btn:disabled, .pd-btn[disabled] { opacity: .55; cursor: not-allowed; pointer-events: none; }

.pd-btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: var(--shadow-accent); }
.pd-btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; transform: translateY(-1px); }
.pd-btn-primary:active { transform: translateY(0); }

.pd-btn-ghost  { background: var(--card); color: var(--text); border-color: var(--border-med); }
.pd-btn-ghost:hover { background: var(--card-subtle); border-color: var(--border-str); color: var(--text); }

.pd-btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.pd-btn-danger:hover { background: #B91C1C; border-color: #B91C1C; color: #fff; }

.pd-btn-soft-danger { background: var(--red-light); color: var(--red); border-color: rgba(220,38,38,.2); }
.pd-btn-soft-danger:hover { background: #FEE2E2; color: var(--red); }

.pd-btn.full-w { width: 100%; }
.pd-btn.sm     { padding: 6px 11px; font-size: 12px; }
.pd-btn.lg     { padding: 12px 22px; font-size: 14px; }

/* ── Алерты ───────────────────────────────────────────────────────────── */
.pd-alert {
  padding: 12px 16px; border-radius: var(--r-sm);
  margin-bottom: 16px; font-size: 14px;
  border: 1px solid transparent; line-height: 1.55;
}
.pd-alert ul { margin: 8px 0 0; padding-left: 18px; }
.pd-alert-error   { background: var(--red-light);   border-color: rgba(220,38,38,.2); color: var(--red); }
.pd-alert-warn,
.pd-alert-warning { background: var(--amber-light); border-color: rgba(217,119,6,.2); color: var(--amber); }
.pd-alert-info    { background: var(--accent-light); border-color: var(--accent-border); color: var(--accent); }
.pd-alert-success { background: var(--green-light); border-color: rgba(22,163,74,.2); color: var(--green); }

/* ── Вкладки ──────────────────────────────────────────────────────────── */
.pd-tabs {
  display: flex; gap: 2px;
  border-bottom: 2px solid var(--border-med);
  margin-bottom: 24px;
  overflow-x: auto;
}
.pd-tab {
  padding: 10px 18px;
  font-size: 14px; font-weight: 500;
  color: var(--text-muted);
  background: none; border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer; white-space: nowrap;
  transition: color .15s, border-color .15s;
  font-family: var(--font-sans);
}
.pd-tab:hover { color: var(--text); }
.pd-tab.is-active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.pd-tab-panel { display: none; }
.pd-tab-panel.is-active { display: block; }

/* ── Секции документа (главный паттерн) ───────────────────────────────── */
.pd-section {
  background: var(--card);
  border: 1px solid var(--border-med);
  border-radius: var(--r);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.pd-section-check { background: var(--card-subtle); }
.pd-section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-med);
  gap: 12px;
}
.pd-section-head h2,
.pd-section-head h3 {
  margin: 0; font-size: 15px; font-weight: 700;
  color: var(--text); letter-spacing: -0.01em;
}
.pd-section-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.pd-section-body { padding: 20px; }
.pd-section-body--tight { padding: 14px 20px; }
.pd-section-foot {
  padding: 12px 20px; border-top: 1px solid var(--border-med);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

/* Карточка без хедера */
.pd-card {
  background: var(--card);
  border: 1px solid var(--border-med);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  color: var(--text);
}
.pd-card + .pd-card { margin-top: 16px; }
.pd-card h2 { font-size: 15px; font-weight: 700; margin: 0 0 14px; color: var(--text); letter-spacing: -0.01em; }
.pd-card h3 { font-size: 14px; font-weight: 700; margin: 0 0 12px; color: var(--text); }

.pd-card.pd-card-accent { background: var(--accent-light); border-color: var(--accent-border); }
.pd-card.pd-card-accent h3 { color: var(--accent); }
.pd-card.pd-card-info   { border-left: 3px solid var(--accent); }
.pd-card.pd-card-ok     { border-left: 3px solid var(--green); }
.pd-card.pd-card-warn   { border-left: 3px solid var(--amber); }
.pd-card.pd-card-danger { border-left: 3px solid var(--red); }

.pd-action-btn {
  padding: 5px 11px; border-radius: var(--r-xs);
  font-size: 12px; font-weight: 500;
  cursor: pointer; border: 1px solid var(--border-med);
  background: var(--card); color: var(--text-2);
  transition: background .15s, border-color .15s;
  font-family: var(--font-sans);
}
.pd-action-btn:hover { background: var(--card-subtle); color: var(--text); }
.pd-action-btn.ai    { background: var(--accent-light); border-color: var(--accent-border); color: var(--accent); }
.pd-action-btn.ai:hover { background: #DBEAFE; }
.pd-action-btn.regen { background: var(--green-light); border-color: rgba(22,163,74,.2); color: var(--green); }
.pd-action-btn.regen:hover { background: #DCFCE7; }

/* ── Поля документа ──────────────────────────────────────────────────── */
.pd-field-row {
  display: grid; grid-template-columns: 180px 1fr;
  gap: 8px 16px; padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.pd-field-row:last-child { border-bottom: none; }
.pd-field-label { font-size: 12px; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }
.pd-field-value { margin: 0; font-size: 14px; color: var(--text); }

.pd-list      { margin: 0; padding-left: 18px; font-size: 14px; }
.pd-list li   { margin-bottom: 4px; }
.pd-lit-list  { margin: 0; padding-left: 20px; font-size: 13px; }
.pd-lit-list li { margin-bottom: 6px; overflow-wrap: anywhere; word-break: break-word; }
.pd-comp-list { margin: 0; padding: 0; list-style: none; }
.pd-comp-list li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.pd-comp-list li:last-child { border-bottom: none; }
.pd-comp-code { font-weight: 700; color: var(--accent); min-width: 60px; flex-shrink: 0; font-size: 13px; }
.pd-subsection { font-size: 13px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 8px; }
.pd-empty { color: var(--text-faint); font-size: 14px; margin: 0; }

/* ── Часы ────────────────────────────────────────────────────────────── */
.pd-hours-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.pd-hours-pill {
  padding: 4px 12px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600;
  background: var(--accent); color: #fff;
}
.pd-hours-pill.outline { background: transparent; border: 1px solid var(--border-med); color: var(--text-2); font-weight: 500; }

/* ── Таблицы ─────────────────────────────────────────────────────────── */
.pd-table-wrap { overflow-x: auto; border-radius: var(--r-sm); border: 1px solid var(--border-med); }
.pd-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pd-table th {
  padding: 10px 14px;
  background: var(--card-subtle);
  border-bottom: 1px solid var(--border-med);
  font-weight: 700; text-align: left;
  color: var(--text-2);
  white-space: nowrap;
  font-size: 11px; letter-spacing: .05em; text-transform: uppercase;
}
.pd-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text);
}
.pd-table tr:last-child td { border-bottom: none; }
.pd-table tr:hover td { background: var(--bg); }
.pd-table a { color: var(--text); font-weight: 500; }
.pd-table a:hover { color: var(--accent); }
.pd-td-num  { text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pd-td-code { font-weight: 700; color: var(--accent); white-space: nowrap; }
.pd-td-tags { font-size: 12px; color: var(--text-muted); }
.pd-tr-content td { background: var(--card-subtle); }
.pd-td-content { font-size: 13px; color: var(--text-muted); }
.pd-tr-total { font-weight: 700; background: var(--card-subtle); }
.pd-table-sm td, .pd-table-sm th { padding: 6px 10px; }

/* ── Проверки ────────────────────────────────────────────────────────── */
.pd-check-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 16px; }
.pd-check-card { padding: 12px; border: 1px solid var(--border-med); border-radius: var(--r-sm); background: var(--card); }
.pd-check-card-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-faint); margin-bottom: 6px; letter-spacing: .05em; }
.pd-check-notes { margin: 8px 0 0; padding-left: 14px; font-size: 12px; color: var(--text-muted); }
.pd-check-row { display: flex; align-items: baseline; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.pd-check-row:last-child { border-bottom: none; }
.pd-check-label { font-weight: 700; min-width: 80px; flex-shrink: 0; }

.pd-pill { display: inline-block; padding: 2px 10px; border-radius: var(--r-pill); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.pd-pill-ok, .pd-pill-green, .pd-pill-good        { background: var(--green-light); color: var(--green); }
.pd-pill-weak, .pd-pill-yellow, .pd-pill-warn     { background: var(--amber-light); color: var(--amber); }
.pd-pill-error, .pd-pill-red, .pd-pill-bad        { background: var(--red-light);   color: var(--red); }
.pd-pill-info, .pd-pill-blue                      { background: var(--accent-light); color: var(--accent); }
.pd-pill-neutral, .pd-pill-muted                  { background: var(--card-subtle);  color: var(--text-muted); }
.pd-pill-web { background: #e0f2fe; color: #0369a1; }
[data-theme="dark"] .pd-pill-web { background: rgba(2,132,199,.15); color: #7dd3fc; }
.pd-meta-small { font-size: 11px; color: var(--text-faint); margin-top: 12px; }

/* ── Качество ────────────────────────────────────────────────────────── */
.pd-quality-detail { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.pd-quality-big { font-size: 40px; font-weight: 800; color: var(--accent); line-height: 1; }
.pd-quality-big.small { font-size: 28px; }
.pd-quality-big span  { font-size: 18px; font-weight: 400; color: var(--text-faint); }

.pd-agent-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 20px;
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-sm);
  margin-bottom: 20px; font-size: 14px;
  color: var(--text);
}
.pd-agent-score { font-size: 28px; font-weight: 800; color: var(--accent); flex-shrink: 0; }
.pd-agent-score span { font-size: 14px; font-weight: 400; color: var(--text-muted); }

.pd-revision-list { display: flex; flex-direction: column; gap: 8px; }
.pd-revision-item { padding: 12px; border: 1px solid var(--border-med); border-radius: var(--r-sm); background: var(--card); }
.pd-revision-head { display: flex; align-items: center; gap: 10px; font-size: 14px; flex-wrap: wrap; }

/* ── Генерация ───────────────────────────────────────────────────────── */
.pd-gen-layout { display: flex; flex-direction: column; gap: 16px; }
.pd-gen-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.pd-gen-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-faint); margin-bottom: 4px; letter-spacing: .05em; }
.pd-gen-percent { font-size: 24px; font-weight: 800; color: var(--accent); }
.pd-gen-progress { height: 6px; background: var(--border-med); border-radius: var(--r-pill); overflow: hidden; margin-bottom: 10px; }
.pd-gen-bar { height: 100%; background: var(--accent-gradient); border-radius: var(--r-pill); transition: width .4s ease; }
.pd-gen-stage { margin: 0 0 12px; }
.pd-gen-log { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.pd-gen-llm { margin-top: 12px; }
.pd-gen-llm-pre {
  margin: 0; max-height: 220px; overflow-y: auto;
  padding: 10px 12px;
  background: var(--card-subtle);
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  font-size: 12px; line-height: 1.45;
  white-space: pre-wrap; word-break: break-word;
}
.pd-gen-error { margin-top: 10px; padding: 10px 14px; background: var(--red-light); border: 1px solid rgba(220,38,38,.2); border-radius: var(--r-sm); font-size: 13px; color: var(--red); }
.pd-gen-stale { padding: 12px; background: var(--amber-light); border: 1px solid rgba(217,119,6,.2); border-radius: var(--r-sm); color: var(--amber); }

.pd-file-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.pd-file-list li { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.pd-action-row { display: flex; gap: 8px; flex-wrap: wrap; }

.generation-log-item {
  display: grid; grid-template-columns: 52px minmax(0,1fr); gap: 12px; align-items: start;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 14px;
}
.generation-log-item p { margin: 0; font-size: 13px; font-weight: 500; color: var(--text); }
.generation-log-item span { color: var(--text-faint); font-size: 11px; display: block; margin-top: 3px; }
.generation-log-badge {
  display: inline-flex; align-items: center; justify-content: center;
  height: 26px; border-radius: var(--r-pill);
  background: var(--card); border: 1px solid var(--border-med);
  color: var(--text-muted);
  font-size: 11px; font-weight: 700;
}
.generation-card.is-active .generation-log-badge { background: var(--accent-light); color: var(--accent); border-color: transparent; }
.generation-log-item-muted { opacity: .6; }

/* ── Params (key/value) ──────────────────────────────────────────────── */
.pd-kv { display: grid; grid-template-columns: 200px 1fr; gap: 8px 18px; font-size: 14px; }
.pd-kv dt { font-weight: 600; color: var(--text-muted); padding: 4px 0; }
.pd-kv dd { margin: 0; padding: 4px 0; }

/* ── Edit drawer ──────────────────────────────────────────────────────── */
.pd-edit-drawer {
  position: fixed; inset: 0 0 0 auto;
  width: min(800px, 100vw);
  background: var(--card);
  border-left: 1px solid var(--border-med);
  box-shadow: -4px 0 24px rgba(0,0,0,.1);
  z-index: 1000;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.pd-edit-drawer.is-open { transform: translateX(0); }
.pd-edit-drawer-inner { display: flex; flex-direction: column; height: 100%; }
.pd-edit-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border-med); }
.pd-edit-drawer-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.pd-edit-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); padding: 4px 8px; border-radius: var(--r-xs); }
.pd-edit-close:hover { background: var(--card-subtle); }
.pd-edit-drawer-body { flex: 1; padding: 16px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.pd-edit-ta {
  width: 100%; min-height: 200px;
  font-family: var(--font-mono);
  font-size: 13px;
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  padding: 10px; resize: vertical;
  background: var(--card-subtle);
}
.pd-edit-ta.sm { min-height: 100px; }
.pd-edit-hint { margin: 0; }
.pd-edit-drawer-footer { padding: 12px 20px; border-top: 1px solid var(--border-med); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pd-edit-status { flex: 1; text-align: right; }

/* ── AI Improve modal ─────────────────────────────────────────────────── */
.pd-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: none; align-items: center; justify-content: center;
  z-index: 1100; padding: 16px;
}
.pd-modal-overlay.is-open { display: flex; }
.pd-modal {
  background: var(--card); border-radius: var(--r);
  width: min(560px, 100%); max-height: 80vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}
.pd-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border-med); }
.pd-modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.pd-modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); padding: 4px 8px; border-radius: var(--r-xs); }
.pd-modal-close:hover { background: var(--card-subtle); }
.pd-modal-body { flex: 1; padding: 20px; overflow-y: auto; }
.pd-modal-footer { padding: 14px 20px; border-top: 1px solid var(--border-med); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pd-improve-pre {
  background: var(--card-subtle); border: 1px solid var(--border-med); border-radius: var(--r-sm);
  padding: 12px; font-size: 12px; max-height: 260px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-word;
}

/* ── Word-предпросмотр ────────────────────────────────────────────────── */
.pd-docx-hint { margin-bottom: 12px; }
.pd-docx-frame-wrap {
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--card-subtle);
  min-height: 70vh;
}
.pd-docx-frame { width: 100%; height: 70vh; border: none; display: block; }

/* ── Формы ────────────────────────────────────────────────────────────── */
.pd-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.pd-field:last-child { margin-bottom: 0; }
.pd-field-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .pd-field-grid { grid-template-columns: 1fr; } }
.pd-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.pd-help  { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin: 4px 0 0; }
.pd-error { font-size: 12px; color: var(--red); margin-top: 4px; }
.pd-required { color: var(--red); margin-left: 2px; }
.pd-label-checkbox {
  display: flex; align-items: flex-start; gap: 8px;
  font-weight: 500; cursor: pointer; font-size: 14px; color: var(--text-2); line-height: 1.5;
}
.pd-label-checkbox input { margin-top: 3px; width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; }

.pd-input,
input.pd-input, select.pd-input, textarea.pd-input,
.pd-section input[type="text"],
.pd-section input[type="search"],
.pd-section input[type="email"],
.pd-section input[type="password"],
.pd-section input[type="number"],
.pd-section input[type="url"],
.pd-section input[type="file"],
.pd-section select,
.pd-section textarea,
.pd-card input[type="text"],
.pd-card input[type="search"],
.pd-card input[type="email"],
.pd-card input[type="password"],
.pd-card input[type="number"],
.pd-card input[type="url"],
.pd-card input[type="file"],
.pd-card select,
.pd-card textarea {
  width: 100%; max-width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-family: var(--font-sans);
  background: var(--card);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.pd-input:focus,
.pd-section input:focus, .pd-section select:focus, .pd-section textarea:focus,
.pd-card input:focus, .pd-card select:focus, .pd-card textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.pd-input.sm { padding: 8px 10px; font-size: 13px; }
textarea.pd-input { min-height: 100px; resize: vertical; }

.pd-flash { padding: 12px 14px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 12px; border: 1px solid var(--border); }
.pd-flash.error    { background: var(--red-light);   border-color: rgba(220,38,38,.2); color: var(--red); }
.pd-flash.warn,
.pd-flash.warning  { background: var(--amber-light); border-color: rgba(217,119,6,.2); color: var(--amber); }
.pd-flash.success  { background: var(--green-light); border-color: rgba(22,163,74,.2); color: var(--green); }

/* Pre */
.pd-pre {
  font-family: var(--font-sans);
  font-size: 13px; line-height: 1.55;
  background: var(--card-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  white-space: pre-wrap; word-break: break-word;
  color: var(--text-2);
  margin: 0;
}

/* ── Стат-карты ───────────────────────────────────────────────────────── */
.pd-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.pd-stat-card {
  background: var(--card);
  border: 1px solid var(--border-med);
  border-radius: var(--r);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow .2s, transform .2s;
}
.pd-stat-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.pd-stat-label {
  display: block;
  font-size: 11px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.pd-stat-value {
  display: block;
  font-size: 28px; font-weight: 700;
  line-height: 1; color: var(--text);
  letter-spacing: -0.02em;
}
.pd-stat-value.muted-tone  { color: var(--text-muted); }
.pd-stat-value.green-tone  { color: var(--green); }
.pd-stat-value.amber-tone  { color: var(--amber); }
.pd-stat-value.red-tone    { color: var(--red); }
.pd-stat-value.accent-tone { color: var(--accent); }

/* ── Сетка карточек проектов ─────────────────────────────────────────── */
.pd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
  align-items: start;
}
.pd-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.pd-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
@media (max-width: 900px) { .pd-grid-2, .pd-grid-3 { grid-template-columns: 1fr; } }

.pd-project-card {
  background: var(--card);
  border: 1px solid var(--border-med);
  border-radius: var(--r);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  display: flex; flex-direction: column; gap: 12px;
  transition: box-shadow .2s, transform .2s, border-color .2s;
  position: relative;
}
.pd-project-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-str); }
.pd-project-card-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap;
}
.pd-project-card-body { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pd-project-title {
  font-size: 15px; font-weight: 600;
  color: var(--text); line-height: 1.35;
  transition: color .15s; text-decoration: none;
}
.pd-project-title:hover { color: var(--accent); }
.pd-project-meta  { font-size: 12px; color: var(--text-muted); margin: 0; line-height: 1.4; }
.pd-project-level { font-size: 12px; color: var(--text-faint); margin: 0; }
.pd-project-card-info { display: flex; flex-wrap: wrap; gap: 6px; }
.pd-project-card-info span {
  display: inline-block; font-size: 11px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 2px 9px;
  color: var(--text-muted); white-space: nowrap;
}
.pd-project-card-footer { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pd-project-card.is-ready        { border-left: 3px solid var(--green); }
.pd-project-card.is-generating   { border-left: 3px solid var(--accent); }
.pd-project-card.is-error        { border-left: 3px solid var(--red); }
.pd-project-card.is-step_waiting { border-left: 3px solid var(--amber); }
.pd-project-card.is-pending,
.pd-project-card.is-              { border-left: 3px solid var(--border-str); }

/* ── Боковые/нижние панели ────────────────────────────────────────────── */
.pd-panels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .pd-panels { grid-template-columns: 1fr; } }
.pd-panel {
  background: var(--card); border: 1px solid var(--border-med); border-radius: var(--r);
  padding: 18px 20px; box-shadow: var(--shadow-xs);
}
.pd-panel-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); margin-bottom: 6px; }
.pd-panel-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; color: var(--text); letter-spacing: -0.01em; }
.pd-mini-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.pd-mini-list li { font-size: 13px; }
.pd-mini-list a { color: var(--text); font-weight: 500; transition: color .15s; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-mini-list a:hover { color: var(--accent); }

.pd-section-head-row {
  display: flex; align-items: center; gap: 12px;
  margin: 8px 0 0;
}
.pd-section-head-row h2 { font-size: 17px; font-weight: 700; margin: 0; color: var(--text); letter-spacing: -0.01em; }
.pd-count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 22px; padding: 0 8px;
  background: var(--accent-light); color: var(--accent);
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 700;
}

/* ── Пустое состояние ─────────────────────────────────────────────────── */
.pd-empty-state {
  background: var(--card);
  border: 1.5px dashed var(--border-med);
  border-radius: var(--r);
  padding: 48px 24px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.pd-empty-icon { font-size: 40px; line-height: 1; }
.pd-empty-title { font-size: 17px; font-weight: 700; color: var(--text); margin: 0; }
.pd-empty-state p { margin: 0; color: var(--text-muted); font-size: 14px; }
.pd-empty-state .pd-btn { margin-top: 8px; }

.pd-free-badge {
  display: inline-flex; align-items: center;
  background: var(--green-light); color: var(--green);
  border-radius: var(--r-pill); padding: 4px 10px;
  font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  flex-shrink: 0;
}

.pd-checklist { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 10px; }
.pd-checklist li { position: relative; padding-left: 24px; font-size: 13px; color: var(--text-2); line-height: 1.55; }
.pd-checklist li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 700; }

/* ── Адаптив ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .pd-layout { grid-template-columns: 1fr; }
  .pd-sidebar { position: static; flex-direction: row; flex-wrap: wrap; padding: 16px 0 0; gap: 12px; max-height: none; }
  .pd-nav { display: none; }
  .pd-main { padding: 16px 0 48px; }
  .pd-header { flex-direction: column; gap: 10px; }
  .pd-header-actions { flex-wrap: wrap; gap: 8px; }
  .pd-check-grid { grid-template-columns: 1fr; }
  .pd-field-row { grid-template-columns: 1fr; }
  .pd-kv { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .pd-section-head { flex-direction: column; align-items: flex-start; }
  .pd-quality-detail { flex-direction: column; align-items: flex-start; }
}

/* ── Чат-ассистент ────────────────────────────────────────────────────── */
.chat-fab {
  position: fixed; bottom: 28px; right: 28px;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  font-size: 1.4rem; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  z-index: 900; transition: transform .15s;
}
.chat-fab:hover { transform: scale(1.08); }
.chat-panel {
  position: fixed; bottom: 90px; right: 28px;
  width: min(340px, calc(100vw - 32px));
  max-height: min(480px, calc(100vh - 110px));
  background: var(--card); border: 1px solid var(--border-med);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  z-index: 901;
  display: none; flex-direction: column; overflow: hidden;
}
.chat-panel.is-open { display: flex; }
.chat-panel-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border-med); font-weight: 600; font-size: .95rem; }
.chat-close { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: var(--text-muted); padding: 4px 8px; border-radius: var(--r-xs); line-height: 1; transition: background .15s; }
.chat-close:hover { background: var(--card-subtle); }
.chat-messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { max-width: 88%; padding: 8px 12px; border-radius: var(--r-sm); font-size: .88rem; line-height: 1.5; overflow-wrap: break-word; word-break: break-word; }
.chat-msg-user { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.chat-msg-bot  { background: var(--card-subtle); color: var(--text); align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-msg-bot p { margin: 0 0 6px; }
.chat-msg-bot p:last-child { margin: 0; }
.chat-msg-bot ul, .chat-msg-bot ol { margin: 4px 0; padding-left: 18px; }
.chat-msg-bot li { margin-bottom: 2px; }
.chat-msg-bot strong { font-weight: 700; }
.chat-msg-bot em { font-style: italic; }
.chat-msg-bot code { background: rgba(0,0,0,.07); padding: 1px 5px; border-radius: 4px; font-family: var(--font-mono); font-size: .83em; }
.chat-msg-bot pre { background: var(--card); border: 1px solid var(--border-med); border-radius: var(--r-sm); padding: 10px 12px; overflow-x: auto; margin: 6px 0; }
.chat-msg-bot pre code { background: none; padding: 0; font-size: .82em; }
.chat-msg-bot h1, .chat-msg-bot h2, .chat-msg-bot h3 { font-size: 1em; font-weight: 700; margin: 8px 0 4px; }
.chat-msg-bot blockquote { border-left: 3px solid var(--border-med); padding-left: 10px; margin: 6px 0; color: var(--text-muted); }
.chat-msg-bot table { border-collapse: collapse; font-size: .85em; width: 100%; margin: 6px 0; }
.chat-msg-bot th, .chat-msg-bot td { border: 1px solid var(--border-med); padding: 4px 8px; text-align: left; }
.chat-msg-bot th { background: rgba(0,0,0,.04); font-weight: 600; }
.chat-typing { opacity: .6; font-style: italic; white-space: pre-wrap; }
.chat-input-row { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--border-med); }
.chat-input { flex: 1; border: 1px solid var(--border-med); border-radius: var(--r-sm); padding: 6px 8px; font-size: .88rem; resize: vertical; min-height: 36px; max-height: 120px; font-family: inherit; background: var(--card); color: var(--text); }

/* ── ФГОС-чеклист / freshness ─────────────────────────────────────────── */
.fgos-checklist { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.fgos-check-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; border-radius: var(--r-sm); font-size: .88rem; }
.fgos-check-pass { background: var(--green-light); color: var(--green); }
.fgos-check-warn { background: var(--amber-light); color: var(--amber); }
.fgos-check-fail { background: var(--red-light);   color: var(--red); }
.fgos-check-icon { font-weight: 700; flex-shrink: 0; margin-top: 1px; }
.freshness-results { padding: 8px 0; font-size: .9rem; }
.freshness-section { margin-bottom: 8px; }
.freshness-outdated ul { margin: 4px 0; padding-left: 20px; }

/* ── Тематический план ────────────────────────────────────────────────── */
.pd-plan-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.plan-drag-col { width: 28px; text-align: center; color: var(--text-faint); cursor: grab; }
.plan-drag-handle { cursor: grab !important; }
.plan-editable[contenteditable="true"] {
  outline: 2px solid var(--accent);
  border-radius: 4px;
  padding: 2px 4px;
  min-width: 30px;
  white-space: nowrap;
}
.plan-hours-mismatch { color: var(--red); }
.plan-hours-ok       { color: var(--green); }

/* ── Учебные материалы — секции ───────────────────────────────────────── */
.lc-section, .lc-content-card, .lc-card { border-color: var(--border-med) !important; background: var(--card) !important; }

/* ── Публичная форма отзыва студента ──────────────────────────────────── */
.sf-stars { display: flex; gap: 8px; margin: 8px 0; font-size: 2rem; }
.sf-star { cursor: pointer; color: var(--border-med); transition: color 0.12s; }
.sf-star.active, .sf-star:hover { color: var(--amber); }
.sf-star-hint { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--text-faint); margin-top: 2px; }

/* ── Форма проекта (pf-*) ─────────────────────────────────────────────── */
.pf-page-head   { margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.pf-kicker      {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  padding: 3px 10px; border-radius: var(--r-pill);
}
.pf-heading     { font-family: var(--font-sans); font-size: clamp(22px, 3vw, 28px); font-weight: 700; margin: 10px 0 6px; letter-spacing: -0.02em; }
.pf-lead        { color: var(--text-muted); font-size: 14px; max-width: 720px; line-height: 1.6; margin: 0; }

.pf-section {
  display: grid; grid-template-columns: 200px minmax(0, 1fr);
  gap: 0 40px;
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
@media (max-width: 760px) { .pf-section { grid-template-columns: 1fr; gap: 12px 0; } }

.pf-section-label { display: flex; align-items: flex-start; gap: 12px; padding-top: 4px; position: sticky; top: 24px; }
.pf-section-num   { font-family: var(--font-sans); font-size: 18px; font-weight: 700; color: var(--text-faint); line-height: 1; flex-shrink: 0; min-width: 32px; }
.pf-section-title { font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.3; margin-bottom: 3px; }
.pf-section-desc  { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

.pf-section-body { display: grid; gap: 20px; }
.pf-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 580px) { .pf-grid-2 { grid-template-columns: 1fr; } }
.pf-field-narrow { max-width: 280px; }

.pf-field { display: grid; gap: 6px; }
.pf-field-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; flex-wrap: wrap; }
.pf-label { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.3; }
.pf-field-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; flex-wrap: wrap; }
.pf-hint { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.pf-hint-indented { padding-left: 24px; }
.pf-error { font-size: 12px; color: var(--red); background: var(--red-light); border: 1px solid rgba(220,38,38,.2); border-radius: var(--r-sm); padding: 8px 12px; }
.pf-gen-status { font-size: 12px; color: var(--text-muted); padding: 4px 0; }
.pf-gen-status.error { color: var(--red); }

.pf-checkbox-label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; color: var(--text); line-height: 1.5; }
.pf-checkbox-label input[type="checkbox"] { width: 16px; height: 16px; min-width: 16px; margin-top: 3px; border-radius: 4px; cursor: pointer; }

.pf-btn-ghost {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; font-size: 12px; font-weight: 500;
  font-family: var(--font-sans);
  color: var(--text-muted);
  background: none; border: 1px solid var(--border-med);
  border-radius: var(--r-pill); cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.pf-btn-ghost:hover { color: var(--text); background: var(--bg); border-color: var(--border-str); }
.pf-btn-ghost:disabled { opacity: .5; cursor: not-allowed; }

.pf-btn-pick {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; font-size: 12px; font-weight: 600;
  font-family: var(--font-sans);
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid transparent;
  border-radius: var(--r-pill); cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.pf-btn-pick:hover { background: #DBEAFE; border-color: #93C5FD; }
.pf-btn-pick-green { color: #166534; background: #F0FDF4; }
.pf-btn-pick-green:hover { background: #DCFCE7; border-color: #86EFAC; }

.pf-submit { display: flex; gap: 12px; align-items: center; padding: 28px 0 0; }

/* ── Пикеры (ФГОС / профстандарты) ─────────────────────────────────────── */
.sp-overlay { position: fixed; inset: 0; z-index: 3000; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(15,23,42,.5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.sp-overlay.is-open { display: flex; }
.sp-dialog { background: var(--card); border-radius: var(--r-lg); width: min(740px,100%); max-height: min(84vh,680px); display: flex; flex-direction: column; box-shadow: var(--shadow-xl); animation: sp-appear .2s cubic-bezier(.16,1,.3,1); overflow: hidden; }
@keyframes sp-appear { from {opacity: 0; transform: scale(.96) translateY(8px);} to {opacity: 1; transform: scale(1) translateY(0);} }
.sp-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sp-title { font-family: var(--font-sans); font-size: 17px; font-weight: 700; color: var(--text); line-height: 1.3; margin-bottom: 3px; letter-spacing: -0.01em; }
.sp-subtitle { font-size: 12px; color: var(--text-muted); }
.sp-close { width: 32px; height: 32px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--bg); color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .15s; }
.sp-close:hover { background: var(--card); color: var(--text); border-color: var(--border-str); box-shadow: var(--shadow-sm); }
.sp-filters { display: flex; flex-direction: column; gap: 10px; padding: 14px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0; background: var(--bg); }
.sp-search-wrap { position: relative; display: flex; align-items: center; }
.sp-search-icon { position: absolute; left: 12px; color: var(--text-muted); pointer-events: none; }
.sp-search { width: 100%; padding: 9px 12px 9px 34px; border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 13px; font-family: var(--font-sans); background: var(--card); color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s; }
.sp-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.sp-level-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.sp-lvl { display: inline-flex; align-items: center; padding: 5px 13px; font-size: 12px; font-weight: 500; font-family: var(--font-sans); color: var(--text-muted); background: var(--card); border: 1px solid var(--border); border-radius: var(--r-pill); cursor: pointer; transition: all .15s; white-space: nowrap; }
.sp-lvl:hover { color: var(--accent); border-color: #93C5FD; background: var(--accent-light); }
.sp-lvl.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 2px 8px rgba(59,130,246,.3); }
.sp-count-bar { padding: 7px 24px; background: var(--bg); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sp-count-text { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.sp-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.sp-list::-webkit-scrollbar { width: 5px; }
.sp-list::-webkit-scrollbar-track { background: transparent; }
.sp-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.sp-loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 24px; color: var(--text-muted); font-size: 13px; }
.sp-spinner { width: 24px; height: 24px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: sp-spin .7s linear infinite; }
@keyframes sp-spin { to { transform: rotate(360deg); } }
.sp-empty { padding: 48px 24px; text-align: center; color: var(--text-muted); font-size: 13px; }
.sp-empty strong { display: block; font-size: 15px; color: var(--text); font-weight: 700; margin-bottom: 6px; }
.sp-group-header { position: sticky; top: 0; z-index: 1; padding: 6px 24px; background: #F1F5F9; border-bottom: 1px solid var(--border); font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }
.sp-item { display: flex; align-items: center; gap: 10px; padding: 9px 24px; cursor: pointer; transition: background .1s; border-bottom: 1px solid var(--border); outline: none; }
.sp-item:hover { background: var(--accent-light); }
.sp-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sp-item:active { background: #DBEAFE; }
.sp-item-code { font-family: var(--font-sans); font-size: 12px; font-weight: 600; color: var(--accent); min-width: 64px; flex-shrink: 0; letter-spacing: .02em; }
.sp-item-name { font-size: 13px; color: var(--text); flex: 1; line-height: 1.4; }
.sp-item-badge { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-pill); flex-shrink: 0; }
.sp-badge-bachelor   { background: #EFF6FF; color: #1D4ED8; }
.sp-badge-master     { background: #F5F3FF; color: #6D28D9; }
.sp-badge-specialist { background: #F0FDF4; color: #166534; }
.sp-item-prof-code { font-family: var(--font-sans); font-size: 11px; font-weight: 700; color: #059669; min-width: 52px; flex-shrink: 0; letter-spacing: .03em; background: #F0FDF4; padding: 2px 6px; border-radius: var(--r-xs); text-align: center; }
.sp-item-prof-name { font-size: 13px; color: var(--text); flex: 1; line-height: 1.4; }
.sp-footer-note { padding: 10px 24px; font-size: 11px; color: var(--text-faint); border-top: 1px solid var(--border); text-align: center; flex-shrink: 0; }
mark { background: #FEF08A; border-radius: 2px; padding: 0 1px; }

[data-theme="dark"] .sp-group-header { background: var(--card-subtle); color: var(--text-faint); }
[data-theme="dark"] .sp-item-prof-code { background: var(--green-light); color: var(--green); }
[data-theme="dark"] .pd-doctype-rpd        { background: rgba(37,99,235,.15); color: #93C5FD; }
[data-theme="dark"] .pd-doctype-fos        { background: rgba(109,40,217,.15); color: #C4B5FD; }
[data-theme="dark"] .pd-doctype-annotation { background: rgba(22,163,74,.15);  color: #86EFAC; }
[data-theme="dark"] .pd-doctype-practice   { background: rgba(194,65,12,.15);  color: #FED7AA; }
[data-theme="dark"] .pd-doctype-gia        { background: rgba(190,18,60,.15);   color: #FCA5A5; }
[data-theme="dark"] .sp-badge-bachelor   { background: rgba(37,99,235,.15); color: #93C5FD; }
[data-theme="dark"] .sp-badge-master     { background: rgba(109,40,217,.15); color: #C4B5FD; }
[data-theme="dark"] .sp-badge-specialist { background: rgba(22,163,74,.15); color: #86EFAC; }

/* ── Матрица компетенций ──────────────────────────────────────────────── */
.cm-gaps-card { background: var(--amber-light); border: 1px solid rgba(217,119,6,.25); color: var(--amber); border-radius: var(--r-sm); padding: 12px 14px; }
.cm-table-wrap { overflow-x: auto; border-radius: var(--r-sm); }
.cm-table { border-collapse: collapse; font-size: 0.82rem; min-width: 600px; width: 100%; }
.cm-table th, .cm-table td { border: 1px solid var(--border); padding: 5px 7px; text-align: center; white-space: nowrap; }
.cm-th-code { text-align: left; background: var(--card-subtle); min-width: 80px; position: sticky; left: 0; z-index: 2; }
.cm-th-topic { background: var(--card-subtle); max-width: 120px; overflow: hidden; text-overflow: ellipsis; writing-mode: vertical-rl; transform: rotate(180deg); height: 100px; padding: 4px 6px; font-weight: 600; font-size: 0.75rem; }
.cm-td-code { text-align: left; background: var(--card-subtle); font-size: 0.85rem; position: sticky; left: 0; z-index: 1; }
.cm-td-cell { min-width: 36px; }
.cm-covered { background: var(--green-light); }
.cm-mat-link { text-decoration: none; font-size: 1rem; }

/* ── Конструктор тестов ───────────────────────────────────────────────── */
.tb-question { border: 1px solid var(--border-med); border-radius: var(--r-sm); padding: 12px 14px; margin-bottom: 10px; background: var(--card); }
.tb-q-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.tb-q-num { background: var(--accent); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 700; flex-shrink: 0; }
.tb-q-preview { margin: 0; font-size: 0.9rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-q-editor { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.tb-q-del { margin-left: auto; }
.tb-accuracy-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tb-acc-track { flex: 1; min-width: 120px; height: 8px; background: var(--border-med); border-radius: 4px; overflow: hidden; }
.tb-acc-fill { height: 100%; background: var(--accent-gradient); border-radius: 4px; }

/* ============================================================
   LEGACY ALIASES — для обратной совместимости.
   Старые классы вешаются на новые pd-* стили.
   После полной миграции шаблонов можно удалить.
   ============================================================ */

/* content-card → pd-card */
.content-card {
  background: var(--card);
  border: 1px solid var(--border-med);
  border-radius: var(--r);
  padding: 20px 24px;
  box-shadow: var(--shadow-xs);
  color: var(--text);
}
.content-card + .content-card { margin-top: 16px; }
.content-card h2 { font-size: 15px; font-weight: 700; margin: 0 0 16px; color: var(--text); letter-spacing: -0.01em; }
.content-card h3 { font-size: 14px; font-weight: 700; margin: 0 0 14px; color: var(--text); }

/* page-hero → pd-header */
.page-hero {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-hero-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.page-kicker {
  font-size: 11px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px; display: block;
}
.page-title {
  font-size: 22px; font-weight: 700; margin: 0;
  letter-spacing: -0.02em; color: var(--text); line-height: 1.25;
}
.page-lead {
  font-size: 13px; color: var(--text-muted);
  margin: 6px 0 0; line-height: 1.55; max-width: 720px;
}
@media (max-width: 640px) { .page-hero { flex-direction: column; } }

/* db-stats / db-stat-card */
.db-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.db-stat-card {
  background: var(--card);
  border: 1px solid var(--border-med);
  border-radius: var(--r);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow .2s, transform .2s;
}
.db-stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.db-stat-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 8px; }
.db-stat-value { display: block; font-size: 30px; font-weight: 700; line-height: 1; color: var(--text); letter-spacing: -0.02em; }

/* stat-strip / stat-chip */
.stat-strip { display: flex; gap: 12px; flex-wrap: wrap; }
.stat-chip {
  background: var(--card);
  border: 1px solid var(--border-med);
  border-radius: var(--r);
  padding: 16px 18px;
  min-width: 110px; text-align: center; flex: 1;
  box-shadow: var(--shadow-xs);
}
.stat-chip-value, .stat-chip-num { display: block; font-size: 26px; font-weight: 700; line-height: 1.1; color: var(--text); }
.stat-chip-label { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; font-weight: 600; letter-spacing: .04em; }
.stat-chip-green { border-color: rgba(22,163,74,.3); }
.stat-chip-green .stat-chip-value, .stat-chip-green .stat-chip-num { color: var(--green); }
.stat-chip-blue  { border-color: var(--accent-border); }
.stat-chip-blue .stat-chip-value, .stat-chip-blue .stat-chip-num  { color: var(--accent); }
.stat-chip-amber { border-color: rgba(217,119,6,.3); }
.stat-chip-amber .stat-chip-value, .stat-chip-amber .stat-chip-num { color: var(--amber); }
.stat-chip-red   { border-color: rgba(220,38,38,.3); }
.stat-chip-red .stat-chip-value, .stat-chip-red .stat-chip-num   { color: var(--red); }

/* db-section-head + db-count-badge */
.db-section-head { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.db-section-title { font-size: 17px; font-weight: 700; margin: 0; color: var(--text); letter-spacing: -0.01em; }
.db-count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 22px; padding: 0 8px;
  background: var(--accent-light); color: var(--accent);
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 700;
}

/* db-project-grid / db-project-card */
.db-project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
  align-items: start;
}
.db-project-card {
  background: var(--card);
  border: 1px solid var(--border-med);
  border-radius: var(--r);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  display: flex; flex-direction: column; gap: 12px;
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.db-project-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-str); }
.db-status-border-ready        { border-left: 3px solid var(--green); }
.db-status-border-generating   { border-left: 3px solid var(--accent); }
.db-status-border-error        { border-left: 3px solid var(--red); }
.db-status-border-step_waiting { border-left: 3px solid var(--amber); }
.db-status-border-pending      { border-left: 3px solid var(--border-str); }
.db-project-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.db-doctype {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  white-space: nowrap; max-width: 170px;
  overflow: hidden; text-overflow: ellipsis;
  background: var(--card-subtle); color: var(--text-muted);
}
.db-doctype-rpd        { background: #EFF6FF; color: #1D4ED8; }
.db-doctype-fos        { background: #F5F3FF; color: #6D28D9; }
.db-doctype-annotation { background: #F0FDF4; color: #166534; }
.db-doctype-practice   { background: #FFF7ED; color: #C2410C; }
.db-doctype-gia        { background: #FFF1F2; color: #BE123C; }
[data-theme="dark"] .db-doctype-rpd        { background: rgba(37,99,235,.15); color: #93C5FD; }
[data-theme="dark"] .db-doctype-fos        { background: rgba(109,40,217,.15); color: #C4B5FD; }
[data-theme="dark"] .db-doctype-annotation { background: rgba(22,163,74,.15);  color: #86EFAC; }
[data-theme="dark"] .db-doctype-practice   { background: rgba(194,65,12,.15);  color: #FED7AA; }
[data-theme="dark"] .db-doctype-gia        { background: rgba(190,18,60,.15);   color: #FCA5A5; }

.db-status-pill { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: var(--r-pill); white-space: nowrap; flex-shrink: 0; }
.db-status-pill-ready        { background: var(--green-light);   color: var(--green); }
.db-status-pill-generating   { background: var(--accent-light);  color: var(--accent); }
.db-status-pill-error        { background: var(--red-light);     color: var(--red); }
.db-status-pill-step_waiting { background: var(--amber-light);   color: var(--amber); }
.db-status-pill-pending, .db-status-pill- { background: var(--card-subtle); color: var(--text-muted); }

.db-project-card-body { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.db-project-title { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.35; transition: color .15s; }
.db-project-title:hover { color: var(--accent); }
.db-project-meta  { font-size: 12px; color: var(--text-muted); margin: 0; line-height: 1.4; }
.db-project-level { font-size: 12px; color: var(--text-faint); margin: 0; }
.db-project-card-info { display: flex; flex-wrap: wrap; gap: 6px; }
.db-project-card-info span {
  display: inline-block; font-size: 11px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 2px 9px;
  color: var(--text-muted); white-space: nowrap;
}
.db-project-card-footer { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* db-empty */
.db-empty {
  background: var(--card);
  border: 1.5px dashed var(--border-med);
  border-radius: var(--r);
  padding: 48px 24px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.db-empty-icon { font-size: 40px; line-height: 1; }
.db-empty-title { font-size: 18px; font-weight: 700; color: var(--text); margin: 0; }
.db-empty p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* db-panels / db-panel */
.db-panels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .db-panels { grid-template-columns: 1fr; } }
.db-panel {
  background: var(--card);
  border: 1px solid var(--border-med);
  border-radius: var(--r);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
}
.db-panel-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); margin-bottom: 6px; }
.db-panel-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; color: var(--text); letter-spacing: -0.01em; }
.db-mini-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.db-mini-list li { font-size: 13px; }
.db-mini-list a { color: var(--text); font-weight: 500; transition: color .15s; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-mini-list a:hover { color: var(--accent); }

/* db-info-row / db-info-card */
.db-info-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .db-info-row { grid-template-columns: 1fr; } }
.db-info-card {
  background: var(--card);
  border: 1px solid var(--border-med);
  border-radius: var(--r);
  padding: 22px;
  box-shadow: var(--shadow-xs);
}
.db-info-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.db-free-badge {
  display: inline-flex; align-items: center;
  background: var(--green-light); color: var(--green);
  border-radius: var(--r-pill); padding: 4px 10px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; flex-shrink: 0;
}
.db-plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
@media (max-width: 480px) { .db-plan-grid { grid-template-columns: 1fr; } }
.db-plan-item { border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px; background: var(--bg); text-align: center; }
.db-plan-item strong { display: block; font-size: 13px; font-weight: 600; color: var(--text); }
.db-plan-item span   { display: block; font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.db-plan-featured { background: var(--accent-light); border-color: var(--accent-border); }
.db-plan-featured strong { color: var(--accent); }
.db-plan-featured span   { color: var(--accent); opacity: .8; }
.db-checklist { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 10px; }
.db-checklist li { position: relative; padding-left: 24px; font-size: 13px; color: var(--text-2); line-height: 1.55; }
.db-checklist li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 700; }

/* status-pill (универсальный, ок ↔ pd-pill-*) */
.status-pill { display: inline-block; padding: 3px 9px; border-radius: var(--r-pill); font-size: 11px; font-weight: 600; white-space: nowrap; }
.status-ready        { background: var(--green-light);   color: var(--green); }
.status-generating   { background: var(--accent-light);  color: var(--accent); }
.status-error        { background: var(--red-light);     color: var(--red); }
.status-step_waiting { background: var(--amber-light);   color: var(--amber); }
.status-pending, .status- { background: var(--card-subtle); color: var(--text-muted); }

/* review-pill (по аналогии) */
.review-pill { display: inline-block; padding: 3px 9px; border-radius: var(--r-pill); font-size: 11px; font-weight: 600; white-space: nowrap; }
.review-in_review     { background: var(--accent-light); color: var(--accent); }
.review-approved      { background: var(--green-light);  color: var(--green); }
.review-needs_changes { background: var(--amber-light);  color: var(--amber); }
.review-draft         { background: var(--card-subtle);  color: var(--text-muted); }

/* data-table */
.data-table-wrap {
  overflow-x: auto;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-med);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  padding: 10px 14px;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-faint);
  background: var(--card-subtle);
  border-bottom: 1px solid var(--border-med);
  text-align: left;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }
.data-table a { color: var(--text); font-weight: 500; }
.data-table a:hover { color: var(--accent); }

/* table-wrap (старая обёртка) */
.table-wrap { width: 100%; overflow-x: auto; border-radius: var(--r-sm); border: 1px solid var(--border-med); background: var(--card); margin-bottom: 20px; }

/* badge */
.badge {
  display: inline-flex; align-items: center;
  background: var(--card-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 3px 10px;
  font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted);
}
.badge.status-ready          { background: var(--green-light); border-color: rgba(22,163,74,.2); color: var(--green); }
.badge.status-generating,
.badge.status-step_waiting   { background: var(--accent-light); border-color: var(--accent-border); color: var(--accent); }
.badge.status-error          { background: var(--red-light); border-color: rgba(220,38,38,.2); color: var(--red); }
.badge.doctype-rpd        { background: #EFF6FF; color: #1D4ED8; }
.badge.doctype-fos        { background: #F5F3FF; color: #6D28D9; }
.badge.doctype-annotation { background: #F0FDF4; color: #166534; }
.badge.doctype-practice   { background: #FFF7ED; color: #C2410C; }
.badge.doctype-gia        { background: #FFF1F2; color: #BE123C; }

/* old card */
.card {
  background: var(--card);
  border-radius: var(--r);
  padding: 22px;
  border: 1px solid var(--border-med);
  box-shadow: var(--shadow-xs);
  transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card.narrow { max-width: 520px; margin: 0 auto; padding: 32px; }
.card.flat   { box-shadow: none; }
.card.flat:hover { transform: none; box-shadow: none; }

/* empty (старый) */
.empty {
  background: var(--card);
  border: 1.5px dashed var(--border-med);
  border-radius: var(--r);
  padding: 48px 24px;
  text-align: center;
}
.empty-title { font-size: 20px; font-weight: 700; margin-bottom: 10px; }

/* hours badge / agent grid / agent score / revision list — legacy */
.hours-badge { display: inline-block; background: var(--accent-light); color: var(--accent); padding: 5px 12px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.field-line  { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.error-list { list-style: none; margin: 10px 0 0; padding: 0; }
.error-list li { color: var(--red); font-size: 14px; position: relative; padding-left: 18px; margin-bottom: 6px; }
.error-list li::before { content: "!"; position: absolute; left: 0; font-weight: bold; }

.agent-report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.agent-score { background: var(--card-dark); color: #fff; padding: 14px 22px; border-radius: var(--r-sm); text-align: center; }
.agent-score strong { display: block; font-size: 32px; line-height: 1; margin-bottom: 3px; font-weight: 700; }
.agent-score span   { font-size: 11px; opacity: .65; text-transform: uppercase; letter-spacing: .05em; }
.agent-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; margin-bottom: 28px; }
@media (max-width: 768px) { .agent-grid { grid-template-columns: 1fr; } }
.agent-grid > div { background: var(--bg); padding: 18px; border-radius: var(--r-sm); border: 1px solid var(--border-med); }

.revision-list { display: grid; gap: 12px; margin-top: 14px; }
.revision-item { background: var(--bg); padding: 14px 18px; border-radius: var(--r-sm); border: 1px solid var(--border-med); }
.revision-item p { margin-bottom: 6px; }

/* check-grid (legacy) */
.check-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; margin-bottom: 20px; }
@media (max-width: 768px) { .check-grid { grid-template-columns: 1fr; } }
.check-grid > div { background: var(--bg); padding: 18px; border-radius: var(--r-sm); border: 1px solid var(--border-med); }

/* quality-big (legacy) */
.quality-big { font-family: var(--font-display); font-size: 60px; font-weight: 600; line-height: 1; margin-bottom: 10px; }
.quality-big span { font-size: 22px; font-weight: 500; font-family: var(--font-sans); color: var(--text-muted); }

/* admin-* */
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; margin-bottom: 28px; }
.admin-stat-card { background: var(--card); border: 1px solid var(--border-med); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow-xs); }
.admin-stat-value { display: block; font-size: 32px; font-weight: 700; margin-top: 6px; line-height: 1; color: var(--text); letter-spacing: -0.02em; }
.admin-stat-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); }
.admin-links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 10px; margin-top: 16px; }
.admin-link-item { background: var(--bg); border: 1px solid var(--border-med); border-radius: var(--r-sm); padding: 14px; transition: background .15s, border-color .15s; display: block; text-decoration: none; }
.admin-link-item:hover { background: var(--accent-light); border-color: var(--accent-border); }
.admin-link-app  { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin-bottom: 3px; display: block; }
.admin-link-name { font-weight: 600; color: var(--text); font-size: 14px; }
.audit-filters-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px,1fr)); gap: 14px; align-items: flex-end; }
.audit-filters-grow { grid-column: span 2; }
@media (max-width: 768px) { .audit-filters-grow { grid-column: span 1; } .audit-filters-row { grid-template-columns: 1fr; } }
.audit-filters-actions { display: flex; align-items: center; justify-content: flex-end; }
.audit-pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--border); }
.audit-page-status { color: var(--text-muted); font-size: 14px; font-weight: 500; }

/* badge-{green,blue,gray,red} */
.badge-green { background: var(--green-light); color: var(--green); }
.badge-blue  { background: var(--accent-light); color: var(--accent); }
.badge-gray  { background: var(--card-subtle); color: var(--text-muted); }
.badge-red   { background: var(--red-light); color: var(--red); }
.row-unresolved { background: rgba(251, 191, 36, .05); }

/* slot-badge */
.slot-badge { display: inline-block; padding: 2px 8px; border-radius: var(--r-xs); font-size: 12px; background: var(--accent-light); color: var(--accent); font-weight: 600; }

/* rpd-subnav */
.rpd-subnav {
  position: sticky; top: 16px; z-index: 30;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-med);
  border-radius: var(--r-pill);
  padding: 7px 10px;
  display: flex; gap: 3px; flex-wrap: wrap;
  margin: 28px 0 20px;
  box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .rpd-subnav { background: rgba(20, 28, 47, .9); }
.rpd-subnav a { display: inline-flex; align-items: center; padding: 5px 11px; border-radius: var(--r-pill); color: var(--text-muted); font-size: 13px; font-weight: 600; transition: all .15s; }
.rpd-subnav a:hover { background: var(--bg); color: var(--text); }

/* head_dashboard прогресс-бары */
.hd-progress-bar { width: 100%; height: 6px; background: var(--border-med); border-radius: var(--r-pill); overflow: hidden; margin-bottom: 4px; }
.hd-progress-fill { height: 100%; border-radius: var(--r-pill); transition: width .3s; }
.hd-prog-green  { background: var(--green); }
.hd-prog-yellow { background: var(--amber); }
.hd-prog-red    { background: var(--red); }

/* generation-card extras (использованы в детальной РПД и других страницах) */
.generation-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.generation-percent { font-weight: 700; font-size: 22px; color: var(--accent); }
.generation-progress { height: 6px; background: var(--bg); border-radius: var(--r-pill); overflow: hidden; margin-bottom: 14px; }
.generation-progress-bar { height: 100%; background: var(--accent-gradient); border-radius: var(--r-pill); transition: width .4s ease; }
.generation-log { margin-top: 20px; display: grid; gap: 8px; }

/* Утилитарные тон-классы для значений stat-card */
.green-tone  { color: var(--green); }
.red-tone    { color: var(--red); }
.amber-tone  { color: var(--amber); }
.accent-tone { color: var(--accent); }
.muted-tone  { color: var(--text-muted); }

/* Утилита для full-width элементов */
.full-w { width: 100%; }

/* Дополнительные стилевые карточки */
.pd-card-danger { border-left: 3px solid var(--red); }
.pd-card-warn   { border-left: 3px solid var(--amber); }
.pd-card-ok     { border-left: 3px solid var(--green); }

/* Автозаполнение из профиля кафедры на форме проекта */
.pf-autofill-box {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
}
.pf-autofill-title { font-size: 13px; font-weight: 700; margin-bottom: 8px; color: var(--accent); }
.pf-autofill-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pf-autofill-select { flex: 1; min-width: 200px; font-size: 13px; }
.pf-autofill-link { font-size: 12px; opacity: .65; color: var(--accent); }
.pf-autofill-link:hover { opacity: 1; text-decoration: underline; }
.pf-autofill-status { font-size: 12px; margin-top: 6px; color: var(--green); }
.pf-autofill-status.error { color: var(--red); }
.pf-autofill-empty { margin-top: 12px; font-size: 12px; opacity: .6; }
.pf-autofill-empty a { color: var(--accent); }

/* Дополнительные form-утилиты */
.pd-field-bordered-b { padding-bottom: 20px; border-bottom: 1px solid var(--border-med); margin-bottom: 20px; }
.pd-user-line { font-size: 15px; font-weight: 600; color: var(--text); margin: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.pd-user-line .muted { font-weight: 400; font-size: 13px; }
.pd-form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.pd-checkbox-label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--text); }
.pd-checkbox-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

/* Дополнительные утилитарные модификаторы и хелперы */
.pd-narrow-md { max-width: 800px; margin-left: auto; margin-right: auto; }
.pd-section-accent { background: var(--accent-light); border-color: var(--accent-border); }
.pd-section-accent .pd-section-head h2 { color: var(--accent); }
.pd-inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.pd-inline-form-field { flex: 1; min-width: 200px; }
.pd-inline-form input[type="text"],
.pd-inline-form input[type="email"],
.pd-inline-form input[type="url"],
.pd-inline-form select,
.pd-inline-form textarea { width: 100%; }
.pd-row-between { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.pd-row-gap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pd-code-box {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border-med);
  padding: 8px 12px;
  border-radius: var(--r-xs);
  word-break: break-all;
  margin-bottom: 8px;
  color: var(--text);
}
.is-muted { opacity: .55; }

/* Доп. layout-утилиты */
.pd-stack-form { display: flex; flex-direction: column; gap: 16px; }
.pd-grid-2-flex { display: flex; gap: 16px; flex-wrap: wrap; }
.pd-grid-2-flex > .pd-field { flex: 1; min-width: 240px; }
.pd-inline { display: inline; }
.pd-td-ellipsis { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-td-actions { white-space: nowrap; text-align: right; }
.pd-td-actions > form + form { margin-left: 6px; }
.pd-row-gap-tight { gap: 4px; }
.pd-pill-xs { font-size: 10px; padding: 1px 6px; }

/* Привязка Telegram / OAuth */
.pd-bind-status { display: flex; align-items: center; gap: 10px; }
.pd-bind-icon   { font-size: 24px; }
.pd-bind-title  { font-weight: 700; font-size: 15px; margin: 0; color: var(--green); }
.pd-empty-padded { padding: 40px 24px; }
.pd-numbered-list { padding-left: 20px; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--text); }
.pd-checkbox-top { align-items: flex-start; }
.pd-checkbox-top input[type="checkbox"] { margin-top: 2px; flex-shrink: 0; }

/* Дополнительные модификаторы кнопок и навигации */
.pd-btn-lg { padding: 14px 20px; font-size: 15px; }
.pd-back-link { text-decoration: none; color: inherit; }
.pd-back-link:hover { color: var(--accent); }

/* Доп. размеры стеков */
.pd-narrow-lg { max-width: 920px; margin-left: auto; margin-right: auto; }
.pd-required { color: var(--red); }
.pd-text-strong-sm { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.pd-bullet-list { padding-left: 20px; font-size: 13px; color: var(--text); display: flex; flex-direction: column; gap: 4px; margin: 0; }

/* Поиск по РПД */
.pd-search-form { display: flex; gap: 8px; }
.pd-search-form .pd-input { flex: 1; }
.pd-search-title { font-size: 15px; font-weight: 600; color: var(--text); }
.pd-search-title:hover { color: var(--accent); }
.pd-search-snippet {
  font-size: 13px; color: var(--text-muted); margin: 0;
  padding-left: 10px; border-left: 3px solid var(--accent-border);
}
.pd-mar-auto { margin-left: auto; }

/* Inline-код */
.pd-inline-code {
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border-med);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

/* Форма с верхней границей (отделитель) */
.pd-form-bordered-t { border-top: 1px solid var(--border-med); padding-top: 20px; margin-top: 20px; }

/* Замечания (rv-) */
.rv-comments { display: flex; flex-direction: column; gap: 12px; }
.rv-comment {
  background: var(--bg);
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  padding: 14px 16px;
}
.rv-comment-resolved { opacity: .55; border-style: dashed; }
.rv-comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }

/* Confirm-delete страницы */
.pd-confirm-title { color: var(--red); margin-bottom: 8px; font-size: 22px; font-weight: 700; }
.pd-confirm-subtitle { font-weight: 600; font-size: 16px; margin-bottom: 8px; color: var(--text); }

/* Админ-навигация */
.pd-admin-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.pd-admin-link {
  display: block;
  padding: 12px 16px;
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  transition: border-color .15s, background .15s;
}
.pd-admin-link:hover { border-color: var(--accent); background: var(--accent-light); }
.pd-admin-link-app {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: 3px;
}

/* Фильтр-формы */
.pd-filter-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.pd-field-grow   { flex: 1; min-width: 150px; }
.pd-field-grow-2 { flex: 2; min-width: 200px; }
.pd-nowrap { white-space: nowrap; }

/* Пагинация */
.pd-pagination { padding: 12px 20px; border-top: 1px solid var(--border-med); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* DLQ/таблицы ошибок */
.pd-row-warn { background: rgba(239, 68, 68, .05); }
.pd-td-error { max-width: 280px; }
.pd-err-summary { cursor: pointer; color: var(--red); font-size: 12px; }
.pd-traceback {
  font-size: 11px; white-space: pre-wrap;
  background: #0F172A; color: #E2E8F0;
  padding: 10px; border-radius: 6px;
  margin-top: 8px; max-height: 260px; overflow-y: auto;
}

.pd-divider { height: 1px; background: var(--border-med); margin: 16px 0; }

/* Print: скрывать управляющие элементы при печати */
.pd-no-print {}
@media print {
  .pd-no-print, .pd-sidebar, .pd-btn { display: none !important; }
  .pd-header, .pd-section { box-shadow: none !important; }
}

/* Подробности проверок в отчётах */
.pd-row-detail { background: var(--bg); padding: 16px 20px; }
.pd-checks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.pd-check-item { display: flex; align-items: flex-start; gap: 8px; }
.pd-check-label { font-size: 12px; font-weight: 600; color: var(--text); }
.bold { font-weight: 700; }

/* Список-строки */
.pd-list-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-med);
}
.pd-list-row:last-child { border-bottom: none; }
.pd-list-row-col { flex-direction: column; }
.pd-list-icon { font-size: 20px; flex-shrink: 0; line-height: 1.4; }
.pd-source-list { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }

/* Прогресс-бары для сравнения */
.pd-progress-inline { display: flex; align-items: center; gap: 8px; }
.pd-progress-pct { min-width: 35px; }

.pd-chart-row { margin-bottom: 12px; }
.pd-chart-label-row { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.pd-chart-label { font-weight: 500; }
.pd-bar-outer { height: 22px; border-radius: 4px; background: var(--border-med); overflow: hidden; }
.pd-bar-fill  { height: 100%; border-radius: 4px; display: flex; align-items: center; color: #fff; font-weight: 600; }
.pd-bar-text  { font-size: 11px; padding: 0 6px; }

/* Версии документа */
.pd-version-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; border-bottom: 1px solid var(--border-med);
  flex-wrap: wrap;
}
.pd-version-row:last-child { border-bottom: none; }
.pd-version-num { font-weight: 700; font-size: 13px; min-width: 36px; }
.pd-version-date { min-width: 110px; }
.pd-version-comment { font-size: 12px; opacity: .7; font-style: italic; flex: 1; }
.pd-faint { opacity: .4; }
.pd-version-comment-form { display: flex; gap: 4px; align-items: center; }
.pd-version-comment-input { font-size: 12px; padding: 4px 10px; width: 180px; }

/* Diff-sections */
.pd-diff-summary { margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--text); }
.pd-diff-tag { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--border-med); color: var(--text-muted); }
.pd-diff-tag.is-changed { background: var(--amber-light); color: var(--amber); }

.diff-section { border: 1px solid var(--border-med); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.diff-section.is-faint { opacity: .45; }
.diff-section-head { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; font-weight: 700; font-size: 13px; cursor: pointer;
  background: var(--bg); user-select: none; }
.diff-body { overflow: auto; max-height: 480px; }
.diff-body pre { margin: 0; padding: 12px 16px; font-size: 12px; line-height: 1.55; font-family: var(--font-mono); white-space: pre-wrap; }
ins.diff-add { background: var(--green-light); color: var(--green); display: block; }
del.diff-del { background: var(--red-light); color: var(--red); display: block; }
.diff-hunk   { color: var(--text-muted); display: block; font-style: italic; }
.diff-ctx    { display: block; }
