/* ============================================
   Nordant — modern knowledge base UI
   ============================================ */

:root {
  --bg: #F4F5F7;
  --bg-subtle: #EBEDF2;
  --surface: #FFFFFF;
  --surface-hover: #F8F9FB;
  --paper: #F4F5F7;
  --paper-2: #EBEDF2;
  --paper-3: #E0E3EA;
  --surface-warm: #FFFFFF;
  --ink: #111318;
  --ink-2: #1C1F26;
  --ink-3: #282C36;
  --text: #111318;
  --text-2: #5B6270;
  --text-3: #8B92A0;
  --text-4: #B0B6C2;
  --text-inverse: #FFFFFF;
  --text-inverse-2: rgba(255, 255, 255, 0.72);
  --border: #E2E5EC;
  --border-strong: #CDD2DC;
  --border-soft: #ECEEF3;
  --border-dark: #111318;
  --border-dark-soft: rgba(255, 255, 255, 0.12);
  --accent: #5B5EF4;
  --accent-2: #4A4DDC;
  --accent-soft: #EEEEFF;
  --accent-text: #4346C9;
  --accent-ink: #6B6EF7;
  --coral: #F04452;
  --coral-soft: #FFF0F1;
  --tag-bg: #F0F2F6;
  --tag-text: var(--text-2);
  --tag-blue-bg: #EEF4FF;
  --tag-blue-text: #3B5BDB;
  --tag-amber-bg: #FFF8E6;
  --tag-amber-text: #B7791F;
  --tag-rose-bg: #FFF0F3;
  --tag-rose-text: #C2255C;
  --tag-violet-bg: #F3EEFF;
  --tag-violet-text: #6D28D9;
  --tag-green-bg: #ECFDF3;
  --tag-green-text: #15803D;
  --status-published: #16A34A;
  --status-draft: #D97706;
  --status-review: #5B5EF4;
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-full: 999px;
  --shadow-sm: 0 1px 2px rgba(17, 19, 24, 0.04);
  --shadow-md: 0 4px 16px rgba(17, 19, 24, 0.06);
  --shadow-lg: 0 16px 48px rgba(17, 19, 24, 0.10);
  --font-display: 'Inter', 'Geist', system-ui, sans-serif;
  --font-ui: 'Inter', 'Geist', system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;
  --sidebar-width: 252px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-ui);
  font-feature-settings: 'cv11', 'ss01';
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  padding: 0;
}

input, textarea, select {
  font-family: inherit;
  color: inherit;
}

input:focus, textarea:focus, select:focus { outline: none; }

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

::selection {
  background: var(--accent);
  color: #fff;
}

/* ============================================
   Layout
   ============================================ */

#root {
  min-height: 100vh;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  width: 100%;
  gap: 0;
  background: var(--bg);
}

.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
  border-radius: 0;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.main-area:has(.content--kb-full) {
  overflow: hidden;
  height: 100vh;
  max-height: 100vh;
}

.content {
  flex: 1;
  min-width: 0;
  width: 100%;
  overflow-x: hidden;
}

.content > .page,
.content > .kb-home,
.content > .kb-layout-page {
  width: 100%;
  box-sizing: border-box;
}

.content--kb-full {
  padding: 0 !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.content--kb-full > .kb-layout-page {
  flex: 1;
  min-height: 0;
}

.content--article,
.article-page {
  padding: 0 32px 48px;
  max-width: none;
}

.content--article > .article-detail,
.article-page > .article-detail {
  padding-left: 0;
  padding-right: 0;
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
  background: var(--surface);
  color: var(--text);
  display: flex;
  flex-direction: column;
  padding: 16px 12px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  font-size: 13px;
  border-right: 1px solid var(--border-soft);
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 16px;
  margin-bottom: 4px;
}

.sb-logo {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6B6EF7 0%, #4A4DDC 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-style: normal;
  box-shadow: 0 4px 12px rgba(91, 94, 244, 0.35);
}

.sb-brand-text { display: flex; flex-direction: column; }

.sb-brand-name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.02em;
  color: var(--text);
}

.sb-brand-sub {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-ui);
  letter-spacing: 0;
}

.sb-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 12px 10px 6px;
  font-weight: 600;
  font-family: var(--font-ui);
}

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

.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  font-weight: 500;
  text-align: left;
  width: 100%;
  position: relative;
}

.sb-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.sb-item.active {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}

.sb-item.active::before { display: none; }

.sb-item-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.75;
}

.sb-item.active .sb-item-icon { opacity: 1; }

.sb-item-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  background: var(--paper-2);
  padding: 2px 6px;
  border-radius: var(--r-full);
}

.sb-item.active .sb-item-count {
  background: rgba(91, 94, 244, 0.12);
  color: var(--accent-text);
}

.sb-spacer { flex: 1; }

.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 0.12s ease;
  margin-top: 8px;
  border-top: 1px solid var(--border-soft);
  padding-top: 14px;
  width: 100%;
  text-align: left;
}

.sb-user:hover { background: var(--surface-hover); }

.sb-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, #818CF8, #6366F1);
  color: white;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
}

.sb-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.sb-user-role {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-ui);
}

/* ============================================
   Topbar
   ============================================ */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.82);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-soft);
  overflow: visible;
}

.topbar-crumb {
  font-size: 13px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
}

.topbar-crumb-sep { opacity: 0.5; }

.topbar-crumb-last {
  color: var(--text);
  font-weight: 500;
}

.topbar-crumb-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-3);
  cursor: pointer;
}
.topbar-crumb-btn:hover {
  color: var(--accent-text);
}

.topbar-search {
  margin-left: auto;
  position: relative;
  width: 300px;
}

.topbar-search input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 12px 8px 34px;
  font-size: 13px;
  transition: all 0.12s ease;
  box-shadow: var(--shadow-sm);
}

.topbar-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.topbar-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
}

.topbar-kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  background: var(--paper-2);
  padding: 2px 6px;
  border-radius: 4px;
}

.topbar-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--text-inverse);
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.12s ease;
  box-shadow: 0 2px 8px rgba(91, 94, 244, 0.28);
}

.topbar-action:hover { background: var(--accent-2); transform: translateY(-1px); }

.topbar-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  color: var(--text-2);
  transition: all 0.12s ease;
}

.topbar-icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* ============================================
   Page
   ============================================ */

.page {
  padding: 20px 28px 64px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 8px 0 24px;
  flex-wrap: wrap;
}

.page-title {
  font-family: var(--font-ui);
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 8px;
  color: var(--text);
  padding-bottom: 0;
}

.page-title-italic {
  font-style: normal;
  color: var(--accent-text);
}

.page-sub {
  font-size: 14px;
  color: var(--text-2);
  margin: 0;
  max-width: 540px;
  line-height: 1.55;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.12s ease;
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary { background: var(--accent); color: var(--text-inverse); box-shadow: 0 2px 8px rgba(91, 94, 244, 0.22); }
.btn-primary:hover { background: var(--accent-2); transform: translateY(-1px); }

.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-2); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-subtle {
  background: var(--surface);
  border-color: var(--border-soft);
  color: var(--text);
}
.btn-subtle:hover { background: var(--paper-2); }

.btn-icon { padding: 7px; width: 32px; height: 32px; justify-content: center; }

/* ============================================
   Tags / chips
   ============================================ */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0;
  background: var(--tag-bg);
  color: var(--tag-text);
  white-space: nowrap;
}

.tag-blue   { background: var(--tag-blue-bg);   color: var(--tag-blue-text); }
.tag-amber  { background: var(--tag-amber-bg);  color: var(--tag-amber-text); }
.tag-rose   { background: var(--tag-rose-bg);   color: var(--tag-rose-text); }
.tag-violet { background: var(--tag-violet-bg); color: var(--tag-violet-text); }
.tag-green  { background: var(--tag-green-bg);  color: var(--tag-green-text); }
.tag-accent { background: var(--accent-soft);   color: var(--accent-text); }
.tag-ink    { background: var(--ink);           color: var(--text-inverse); }

.tag-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

/* ============================================
   Avatars
   ============================================ */

.avatar {
  width: 26px;
  height: 26px;
  border-radius: var(--r-full);
  display: inline-grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  color: white;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  border: 2px solid var(--paper);
}

.avatar-lg { width: 36px; height: 36px; font-size: 12px; }
.avatar-xl { width: 64px; height: 64px; font-size: 20px; border-width: 0; }

.avatar-stack { display: inline-flex; }
.avatar-stack .avatar:not(:first-child) { margin-left: -8px; }

.av-1 { background: linear-gradient(135deg, oklch(0.62 0.16 25), oklch(0.55 0.14 40)); }
.av-2 { background: linear-gradient(135deg, oklch(0.55 0.13 165), oklch(0.48 0.12 195)); }
.av-3 { background: linear-gradient(135deg, oklch(0.55 0.18 265), oklch(0.48 0.15 285)); }
.av-4 { background: linear-gradient(135deg, oklch(0.62 0.13 75), oklch(0.55 0.12 50)); }
.av-5 { background: linear-gradient(135deg, oklch(0.55 0.16 320), oklch(0.48 0.14 300)); }
.av-6 { background: linear-gradient(135deg, oklch(0.55 0.13 145), oklch(0.48 0.12 125)); }
.av-7 { background: linear-gradient(135deg, oklch(0.55 0.16 230), oklch(0.48 0.14 210)); }
.av-8 { background: linear-gradient(135deg, oklch(0.55 0.16 355), oklch(0.48 0.14 15)); }

/* ============================================
   Filter pills
   ============================================ */

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  background: transparent;
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.12s ease;
  font-family: inherit;
  white-space: nowrap;
}

.filter-pill:hover {
  border-color: var(--ink);
  color: var(--text);
}

.filter-pill.active {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: transparent;
  font-weight: 600;
}

.filter-pill-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
  margin-left: 2px;
}

.filter-pill.active .filter-pill-count {
  color: var(--accent-text);
  opacity: 0.7;
}

.view-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 3px;
  box-shadow: var(--shadow-sm);
}

.view-toggle button {
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.12s ease;
}

.view-toggle button.active {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}

/* ============================================
   Toolbar
   ============================================ */

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 18px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

/* ============================================
   Status
   ============================================ */

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-mono);
}

.status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-published::before { background: var(--status-published); }
.status-draft::before     { background: var(--status-draft); }
.status-review::before    { background: var(--status-review); }
.status-archived::before  { background: var(--text-3); }

/* ============================================
   Article cards — BENTO style
   ============================================ */

.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 200px;
  gap: 12px;
}

.article-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  grid-column: span 1;
  grid-row: span 1;
  min-height: 0;
  box-shadow: var(--shadow-sm);
}

.article-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}

.article-card:hover .article-card-arrow {
  transform: translate(2px, -2px);
  opacity: 1;
}

/* Size variants — bento */
.article-card.size-wide { grid-column: span 2; }
.article-card.size-tall { grid-row: span 2; }
.article-card.size-feature { grid-column: span 2; grid-row: span 2; }
.article-card.size-square { grid-column: span 1; }

.article-card-section {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-3);
  text-transform: none;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.article-card-section-dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--text-3);
}

.article-card-title {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0;
  color: var(--text);
}

.article-card.size-wide .article-card-title,
.article-card.size-tall .article-card-title {
  font-size: 18px;
}

.article-card.size-feature .article-card-title {
  font-size: 22px;
  line-height: 1.2;
  max-width: none;
}

.article-card-desc {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.45;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-wrap: pretty;
}

.article-card.size-feature .article-card-desc {
  font-size: 15.5px;
  -webkit-line-clamp: 3;
  max-width: 60ch;
}

.article-card.size-tall .article-card-desc {
  -webkit-line-clamp: 4;
}

.article-card-bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
}

.article-card-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.article-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
}

.article-card-arrow {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--paper-2);
  display: grid;
  place-items: center;
  color: var(--text-2);
  opacity: 0.6;
  transition: all 0.18s ease;
}

/* Colored card variants — заливка цветом */
.article-card.fill-cobalt {
  background: linear-gradient(135deg, #6B6EF7, #4A4DDC);
  border-color: transparent;
  color: white;
}
.article-card.fill-cobalt .article-card-title,
.article-card.fill-cobalt .article-card-desc { color: white; }
.article-card.fill-cobalt .article-card-section { color: rgba(255,255,255,0.7); }
.article-card.fill-cobalt .article-card-section-dot { background: rgba(255,255,255,0.7); }
.article-card.fill-cobalt .article-card-meta { color: rgba(255,255,255,0.7); }
.article-card.fill-cobalt .article-card-arrow { background: rgba(255,255,255,0.18); color: white; }

.article-card.fill-ink {
  background: var(--ink);
  color: var(--text-inverse);
}
.article-card.fill-ink .article-card-title,
.article-card.fill-ink .article-card-desc { color: var(--text-inverse); }
.article-card.fill-ink .article-card-section { color: var(--text-inverse-2); }
.article-card.fill-ink .article-card-section-dot { background: var(--text-inverse-2); }
.article-card.fill-ink .article-card-meta { color: var(--text-inverse-2); }
.article-card.fill-ink .article-card-arrow { background: rgba(255,255,255,0.10); color: var(--text-inverse); }

.article-card.fill-coral {
  background: var(--coral);
  color: white;
}
.article-card.fill-coral .article-card-title,
.article-card.fill-coral .article-card-desc { color: white; }
.article-card.fill-coral .article-card-section { color: rgba(255,255,255,0.75); }
.article-card.fill-coral .article-card-section-dot { background: rgba(255,255,255,0.75); }
.article-card.fill-coral .article-card-meta { color: rgba(255,255,255,0.75); }
.article-card.fill-coral .article-card-arrow { background: rgba(255,255,255,0.18); color: white; }

.article-card.fill-cream {
  background: var(--paper-2);
}

.article-card-watermark { display: none; }

.article-card.has-cover {
  padding: 22px;
  background: var(--ink);
  overflow: hidden;
  justify-content: flex-end;
}

.article-card-cover-fill {
  position: absolute;
  inset: 0;
  background-color: var(--ink);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
}
.article-card-cover-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.82) 0%,
    rgba(0, 0, 0, 0.35) 45%,
    rgba(0, 0, 0, 0.12) 100%
  );
}

.article-card.has-cover .article-card-section,
.article-card.has-cover .article-card-title,
.article-card.has-cover .article-card-desc,
.article-card.has-cover .article-card-meta,
.article-card.has-cover .article-card-bottom,
.article-card.has-cover .article-card-arrow {
  position: relative;
  z-index: 1;
}
.article-card.has-cover .article-card-title,
.article-card.has-cover .article-card-desc {
  color: #fff;
}
.article-card.has-cover .article-card-section { color: rgba(255,255,255,0.75); }
.article-card.has-cover .article-card-meta { color: rgba(255,255,255,0.75); }
.article-card.has-cover .article-card-arrow { color: rgba(255,255,255,0.9); }
.article-card.has-cover .article-card-section-dot { background: rgba(255,255,255,0.5); }

/* ============================================
   List view (table)
   ============================================ */

.article-table {
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}

.article-row {
  display: grid;
  grid-template-columns: minmax(0, 2.4fr) 160px 130px 110px 100px 36px;
  gap: 16px;
  padding: 12px 16px;
  align-items: center;
  border-top: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background 0.12s ease;
}

.article-row:first-child { border-top: none; }

.article-row:hover {
  background: var(--surface-hover);
}

.article-row.header {
  background: var(--bg-subtle);
  cursor: default;
  font-family: var(--font-ui);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  font-weight: 600;
  border-top: none;
}

.article-row.header:hover { background: var(--paper-2); }

.article-row-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.article-row-title-text {
  font-weight: 500;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.005em;
}

.article-row-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--paper-2);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
}

/* ============================================
   Article Detail — editorial
   ============================================ */

.article-detail {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 0 80px;
  position: relative;
}

.article-protected,
.article-protected .article-body,
.article-protected .article-detail-title,
.article-protected .article-detail-desc {
  user-select: none;
  -webkit-user-select: none;
}

.article-watermark {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 80px 40px;
  padding: 40px;
  overflow: hidden;
}

.article-watermark span {
  transform: rotate(-24deg);
  font-size: 14px;
  font-family: var(--font-mono);
  color: var(--text);
  white-space: nowrap;
  text-align: center;
}

.search-results-list mark,
.search-result-title mark,
.search-result-snippet mark {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-radius: 2px;
  padding: 0 2px;
}

.article-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-3);
}

.article-crumb {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--text-3);
  cursor: pointer;
}

.article-crumb:hover { color: var(--accent-text); }

.article-crumb-sep {
  color: var(--text-3);
  opacity: 0.6;
  user-select: none;
}

.article-detail-cover {
  margin-bottom: 28px;
  border-radius: var(--r-md);
  overflow: hidden;
}

.article-detail-cover img {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  display: block;
}

.article-detail-cover-label {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-3);
}

.article-detail-header {
  padding-bottom: 28px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.article-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.article-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.article-icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: none;
  background: none;
  border-radius: var(--r-sm);
  color: var(--text-3);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.article-icon-btn:hover {
  background: var(--paper-2);
  color: var(--text);
}

.article-icon-btn.is-active {
  color: #eab308;
}

.article-detail-title {
  font-family: var(--font-ui);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0;
  flex: 1;
  min-width: 0;
  color: var(--text);
}

.article-detail-title em {
  font-style: normal;
  color: var(--accent-text);
}

.article-byline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 16px;
}

.article-byline-author {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text);
}

.article-byline-dot {
  color: var(--text-3);
  user-select: none;
}

.article-byline-views {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-3);
}

.article-detail-desc {
  font-size: 16px;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0 0 16px;
  max-width: 72ch;
}

.article-tags-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.article-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.article-back-btn:hover {
  background: var(--paper-2);
  border-color: var(--text-3);
}

.article-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-3);
  margin-bottom: 32px;
  cursor: pointer;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.article-back:hover { color: var(--text); }

/* article body */

.article-body {
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  min-width: 0;
}

.article-body h2 {
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 36px 0 12px;
  line-height: 1.25;
}

.article-body h2:first-child { margin-top: 0; }

.article-body h3 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 32px 0 10px;
}

.article-body p {
  margin: 0 0 16px;
  text-wrap: pretty;
}

.article-body p strong { font-weight: 600; }

.article-richtext p { margin: 0 0 16px; }
.article-richtext p:last-child { margin-bottom: 0; }
.article-richtext ul, .article-richtext ol {
  margin: 12px 0 18px;
  padding-left: 22px;
}
.article-richtext li { margin: 6px 0; }
.article-richtext a { color: var(--accent); text-decoration: underline; }
.article-richtext u { text-decoration: underline; }
.article-richtext s, .article-richtext strike, .article-richtext del { text-decoration: line-through; }
.article-body h1.article-richtext,
.article-body h2.article-richtext,
.article-body h3.article-richtext { margin-bottom: 16px; }
.article-richtext-p { margin-bottom: 16px; }

.article-body ul, .article-body ol {
  margin: 12px 0 18px;
  padding-left: 22px;
}
.article-body li { margin: 6px 0; }

.article-body blockquote {
  margin: 24px 0;
  padding: 16px 20px;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-2);
  font-style: normal;
  letter-spacing: 0;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  font-weight: 400;
}

.article-body blockquote cite {
  display: block;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 14px;
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--paper-2);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--accent-text);
}

.article-body pre {
  background: var(--ink);
  color: var(--text-inverse);
  padding: 20px 24px;
  border-radius: var(--r-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  margin: 24px 0;
}

.article-body pre code { background: none; padding: 0; color: inherit; }

.article-body .callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 8px;
  margin: 20px 0;
  font-size: 15px;
  line-height: 1.55;
  border: none;
}

.article-body .callout-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.article-body .callout-text {
  flex: 1;
  min-width: 0;
}

.article-body .callout-label {
  font-weight: 600;
}

.article-body .callout-html {
  display: inline;
}

.article-body .callout-html p {
  display: inline;
  margin: 0;
}

.article-body .callout--important {
  background: #fef2f2;
}

.article-body .callout--important .callout-badge {
  background: #fecaca;
  color: #dc2626;
}

.article-body .callout--attention {
  background: #fffbeb;
}

.article-body .callout--attention .callout-badge {
  background: #fde68a;
  color: #d97706;
  border-radius: 4px;
}

.article-body .callout--tip {
  background: #f0fdf4;
}

.article-body .callout--tip .callout-badge {
  background: #bbf7d0;
  color: #16a34a;
}

.article-body .callout--info {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
}

.article-body .callout--info .callout-badge {
  background: var(--accent-soft);
  color: var(--accent);
}

.article-body img,
.article-body .img-placeholder {
  width: 100%;
  border-radius: var(--r-md);
  margin: 24px 0;
}

.article-body .img-placeholder {
  height: 320px;
  background: var(--paper-2);
  background-image:
    repeating-linear-gradient(135deg, rgba(20,19,17,0.04) 0 1px, transparent 1px 14px);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
}

.article-body .img-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 24px 0;
}

.article-body .img-grid .img-placeholder { margin: 0; height: 200px; }

.article-body .task {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 6px 0;
  font-size: 15.5px;
}

.article-body .task-check {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  flex-shrink: 0;
  margin-top: 3px;
  display: grid;
  place-items: center;
}

.article-body .task.done .task-check {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.article-body .task.done .task-text { color: var(--text-3); text-decoration: line-through; }

/* TOC & sidebar */

.article-heading-anchor {
  scroll-margin-top: 96px;
}

.article-layout-with-toc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 48px;
  align-items: start;
}

.article-sidebar {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.article-sidebar-card {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}

.article-sidebar-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text);
}

.article-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.article-toc-list-item.is-sub {
  padding-left: 18px;
}

.article-toc-link {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 6px 4px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  color: var(--accent-text);
  border-radius: var(--r-sm);
  transition: background 0.12s ease;
}

.article-toc-link:hover {
  background: var(--accent-soft);
}

.article-toc-list-item.is-active .article-toc-link {
  font-weight: 500;
  background: var(--accent-soft);
}

.article-toc-link-icon {
  flex-shrink: 0;
  margin-top: 2px;
  opacity: 0.85;
}

.article-toc-link-text {
  flex: 1;
  min-width: 0;
}

.article-recommended-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.article-recommended-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 4px;
  cursor: pointer;
  font: inherit;
  border-radius: var(--r-sm);
  transition: background 0.12s ease;
}

.article-recommended-item:hover {
  background: var(--paper-2);
}

.article-recommended-icon {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--accent);
}

.article-recommended-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.article-recommended-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
}

.article-recommended-meta {
  font-size: 11px;
  color: var(--text-3);
}

@media (max-width: 960px) {
  .article-layout-with-toc {
    grid-template-columns: 1fr;
  }

  .article-sidebar {
    position: static;
    order: -1;
  }
}

/* comments */
.comment-list {
  margin-top: 60px;
  border-top: 1px solid var(--border);
  padding-top: 32px;
}

.comment-list-title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
}

.comment {
  display: flex;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border-soft);
}

.comment:last-of-type { border-bottom: none; }

.comment-body { flex: 1; min-width: 0; }

.comment-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.comment-name { font-weight: 600; font-size: 13.5px; }

.comment-time {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.comment-text {
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.55;
  text-wrap: pretty;
}

.comment-actions {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.comment-actions span { cursor: pointer; }
.comment-actions span:hover { color: var(--text); }

.comment-input {
  display: flex;
  gap: 14px;
  padding-top: 18px;
}

.comment-input textarea {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  resize: vertical;
  min-height: 72px;
  line-height: 1.5;
}

.comment-input textarea:focus { border-color: var(--ink); }

/* ============================================
   Editor — современный
   ============================================ */

.editor-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 36px 80px;
}

.editor-title {
  width: 100%;
  border: none;
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 400;
  letter-spacing: -0.03em;
  background: transparent;
  margin: 24px 0 18px;
  color: var(--text);
  line-height: 1.05;
  padding-bottom: 4px;
}

.editor-title::placeholder { color: var(--text-4); }

.editor-desc {
  width: 100%;
  border: none;
  font-family: inherit;
  font-size: 18px;
  color: var(--text-2);
  background: transparent;
  resize: none;
  margin-bottom: 32px;
  line-height: 1.45;
  font-weight: 300;
}

.editor-desc::placeholder { color: var(--text-4); }

.editor-meta-grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px 22px;
  padding: 22px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
  align-items: start;
  overflow: visible;
  position: relative;
  z-index: 20;
}

.editor-meta-value {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 32px;
  overflow: visible;
  position: relative;
}

.editor-meta-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-meta-input {
  background: transparent;
  border: 1px dashed transparent;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 13px;
  transition: all 0.12s ease;
  cursor: pointer;
  color: var(--text-2);
  font-family: inherit;
}

.editor-meta-input:hover {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.editor-toolbar {
  position: sticky;
  top: 65px;
  background: rgba(244, 241, 234, 0.92);
  backdrop-filter: blur(6px);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.editor-tool {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.12s ease;
  font-family: inherit;
}

.editor-tool:hover { background: var(--paper-2); color: var(--text); }

.editor-tool.active { background: var(--ink); color: var(--text-inverse); }

.editor-tool-sep {
  width: 1px; height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.editor-block { position: relative; padding: 4px 0; }

.editor-block-handle {
  position: absolute;
  left: -30px;
  top: 10px;
  opacity: 0;
  transition: opacity 0.12s ease;
  color: var(--text-4);
  cursor: grab;
}

.editor-block:hover .editor-block-handle { opacity: 1; }

.editor-add-block {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 20px 0;
  font-size: 13.5px;
  color: var(--text-3);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 0.12s ease;
  width: 100%;
  font-family: inherit;
}

.editor-add-block:hover {
  border-color: var(--accent);
  color: var(--accent);
  border-style: solid;
}

.editor-block-picker {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(2, 220px);
  gap: 4px;
  z-index: 20;
}

.editor-block-picker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s ease;
  font-size: 13px;
  text-align: left;
  width: 100%;
}

.editor-block-picker-item:hover { background: var(--paper-2); }

.editor-block-picker-icon {
  width: 30px;
  height: 30px;
  background: var(--paper-2);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-2);
  flex-shrink: 0;
}

.editor-block-picker-name { font-weight: 500; }

.editor-block-picker-desc {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

/* ============================================
   Tests
   ============================================ */

.test-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}

.test-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 24px;
  transition: box-shadow 0.18s ease;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  border: 1px solid var(--border-soft);
  height: 100%;
}

.test-card:hover {
  box-shadow: var(--shadow-md);
}

.test-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.test-card-id {
  background: var(--ink);
  color: var(--text-inverse);
  padding: 3px 9px;
  border-radius: var(--r-full);
  letter-spacing: 0.04em;
}

.test-card-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.018em;
  margin: 0;
  line-height: 1.05;
  color: var(--text);
  text-wrap: balance;
}

.test-card-desc {
  font-size: 13.5px;
  color: var(--text-2);
  margin: 0;
  text-wrap: pretty;
  line-height: 1.45;
}

.test-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 16px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.test-card-stat { display: flex; flex-direction: column; gap: 4px; }

.test-card-stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}

.test-card-stat-label {
  font-size: 10px;
  color: var(--text-3);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.test-card-bottom {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  flex-wrap: wrap;
}

/* progress bar */
.progress {
  height: 5px;
  background: var(--paper-2);
  border-radius: var(--r-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-full);
  transition: width 0.4s ease;
}

/* ============================================
   Org Structure
   ============================================ */

.org-page {
  max-width: 100%;
}

.org-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

/* --- Org chart tree --- */

.org-chart-wrap {
  overflow-x: auto;
  overflow-y: visible;
  padding: 8px 12px 40px;
  -webkit-overflow-scrolling: touch;
}

.org-chart {
  display: inline-flex;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.org-chart--root {
  width: 100%;
  display: flex;
  justify-content: center;
}

.org-chart--multi {
  gap: 24px;
  flex-wrap: nowrap;
  justify-content: center;
}

.org-chart--multi > .org-chart-item {
  flex-shrink: 0;
}

.org-edit-hint {
  margin: 0;
  flex: 1;
  max-width: 520px;
  line-height: 1.5;
}

.org-root-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto 20px;
  max-width: 560px;
  padding: 14px 18px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  color: var(--text-3);
  font-size: 13px;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.org-root-drop--active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.org-root-drop--invalid {
  border-color: oklch(0.6 0.16 25);
  background: oklch(0.96 0.04 25);
  color: oklch(0.45 0.14 25);
}

.org-chart-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  list-style: none;
  padding: 0 8px;
}

/* vertical stem from parent card to children row */
.org-chart-item > .org-chart {
  display: inline-flex;
  justify-content: center;
  padding-top: 28px;
  position: relative;
}

.org-chart-item > .org-chart::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 28px;
  background: var(--border-strong);
  transform: translateX(-50%);
  border-radius: 1px;
}

/* connector lines between siblings */
.org-chart-item > .org-chart > .org-chart-item {
  padding-top: 28px;
}

.org-chart-item > .org-chart > .org-chart-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 28px;
  background: var(--border-strong);
  transform: translateX(-50%);
}

.org-chart-item > .org-chart > .org-chart-item::after {
  content: '';
  position: absolute;
  top: 0;
  height: 2px;
  background: var(--border-strong);
}

.org-chart-item > .org-chart > .org-chart-item:first-child::after {
  left: 50%;
  right: 0;
}

.org-chart-item > .org-chart > .org-chart-item:last-child::after {
  right: 50%;
  left: 0;
}

.org-chart-item > .org-chart > .org-chart-item:not(:first-child):not(:last-child)::after {
  left: 0;
  right: 0;
}

.org-chart-item > .org-chart > .org-chart-item:only-child::before,
.org-chart-item > .org-chart > .org-chart-item:only-child::after {
  display: none;
}

.org-chart--root > .org-chart-item {
  padding-top: 0;
}

/* --- Employee card in tree --- */

.org-card {
  position: relative;
  width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.03);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  cursor: default;
}

.org-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06), 0 12px 32px rgba(0, 0, 0, 0.06);
  border-color: color-mix(in oklch, var(--accent) 25%, var(--border));
}

.org-card--editable {
  cursor: grab;
  user-select: none;
}

.org-card--editable:active {
  cursor: grabbing;
}

.org-card--dragging {
  opacity: 0.45;
  transform: scale(0.97);
  box-shadow: none;
}

.org-card--drop-target {
  border-color: var(--accent) !important;
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 20%, transparent);
  transform: translateY(-3px);
}

.org-card--drop-invalid {
  border-color: oklch(0.6 0.16 25) !important;
  background: oklch(0.96 0.04 25);
  box-shadow: 0 0 0 3px oklch(0.92 0.04 25);
}

.org-card-grip {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-3);
  z-index: 1;
}

.org-card-dept {
  display: block;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 11px 11px 0 0;
  color: white;
}

.org-card-dept.dept-blue { background: oklch(0.52 0.14 250); }
.org-card-dept.dept-violet { background: oklch(0.52 0.14 320); }
.org-card-dept.dept-amber { background: oklch(0.58 0.14 75); }
.org-card-dept.dept-green { background: oklch(0.52 0.14 155); }
.org-card-dept.dept-rose { background: oklch(0.52 0.14 25); }
.org-card-dept.dept-slate { background: oklch(0.42 0.05 260); }

.org-card-body {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 16px;
  position: relative;
}

.org-card-avatar {
  flex-shrink: 0;
  border-width: 0;
}

.org-card-info {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.org-card-name {
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.01em;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.org-card-role {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.org-card-status {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  opacity: 0.5;
}

.org-card-status.is-online {
  background: var(--status-published);
  opacity: 1;
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--status-published) 25%, transparent);
}

/* --- Department grid view --- */

.org-dept-view {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.org-dept-section:first-child .org-section-header {
  margin-top: 0;
}

.org-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin-top: 12px;
  margin-bottom: 8px;
}

.org-person-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: default;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  position: relative;
}

.org-person-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  border-color: color-mix(in oklch, var(--accent) 20%, var(--border));
}

.org-person-info { flex: 1; min-width: 0; }

.org-person-name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.org-person-role {
  font-size: 11.5px;
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.org-person-dept {
  display: inline-block;
  margin-top: 6px;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 99px;
  color: white;
}

.org-person-dept.dept-blue { background: oklch(0.52 0.14 250); }
.org-person-dept.dept-violet { background: oklch(0.52 0.14 320); }
.org-person-dept.dept-amber { background: oklch(0.58 0.14 75); }
.org-person-dept.dept-green { background: oklch(0.52 0.14 155); }
.org-person-dept.dept-rose { background: oklch(0.52 0.14 25); }
.org-person-dept.dept-slate { background: oklch(0.42 0.05 260); }

.org-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 32px;
  padding-bottom: 8px;
}

.org-section-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.02em;
}

.org-section-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  background: var(--paper-2);
  padding: 3px 10px;
  border-radius: var(--r-full);
}

/* ============================================
   Dashboard
   ============================================ */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.metric-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
}

.metric-card.fill-ink { background: var(--ink); color: var(--text-inverse); }
.metric-card.fill-ink .metric-label { color: var(--text-inverse-2); }
.metric-card.fill-ink .metric-foot { color: var(--text-inverse-2); }

.metric-card.fill-cobalt { background: var(--accent); color: white; }
.metric-card.fill-cobalt .metric-label { color: rgba(255,255,255,0.75); }
.metric-card.fill-cobalt .metric-foot { color: rgba(255,255,255,0.75); }

.metric-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

.metric-value {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.0;
}

.metric-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  margin-left: 8px;
  font-family: var(--font-mono);
  font-weight: 500;
  vertical-align: middle;
  white-space: nowrap;
}

.metric-delta.up { color: var(--status-published); }
.metric-delta.down { color: oklch(0.6 0.18 25); }

.metric-spark { margin-top: 18px; height: 36px; width: 100%; }
.metric-foot { margin-top: 12px; font-size: 11.5px; color: var(--text-3); font-family: var(--font-mono); }

.dashboard-row { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }

.panel {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 24px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}

.panel-sub {
  font-size: 12px;
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-top: 4px;
}

.activity-list { display: flex; flex-direction: column; }

.activity-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13.5px;
  align-items: flex-start;
}

.activity-item:last-child { border-bottom: none; }

.activity-text { flex: 1; text-wrap: pretty; line-height: 1.45; }
.activity-text strong { font-weight: 600; }

.activity-time {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--paper-2);
  color: var(--text-2);
}

/* Chart */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 200px;
  padding: 14px 0;
}

.bar-chart-bar {
  flex: 1;
  background: var(--paper-2);
  border-radius: 6px 6px 2px 2px;
  position: relative;
  min-height: 4px;
  transition: all 0.18s ease;
  cursor: pointer;
}

.bar-chart-bar:hover { background: var(--accent); transform: scaleY(1.04); transform-origin: bottom; }

.bar-chart-bar.accent { background: var(--accent); }

.bar-chart-labels {
  display: flex;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  padding-top: 6px;
}

.bar-chart-labels span { flex: 1; text-align: center; }

/* Top articles */
.top-list-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13.5px;
}

.top-list-item:last-child { border-bottom: none; }

.top-list-rank {
  font-family: var(--font-display);
  font-size: 22px;
  font-style: italic;
  color: var(--text-3);
  line-height: 1;
}

.top-list-bar {
  height: 3px;
  background: var(--paper-2);
  border-radius: var(--r-full);
  position: relative;
  margin-top: 6px;
}

.top-list-bar-fill {
  position: absolute;
  inset: 0;
  background: var(--accent);
  border-radius: var(--r-full);
}

.top-list-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
}

/* ============================================
   Card / panel utility
   ============================================ */

.card { background: var(--surface); border-radius: var(--r-lg); }
.card-pad { padding: 22px; }

.empty-state { text-align: center; padding: 80px 20px; color: var(--text-3); }

/* ============================================
   Utilities
   ============================================ */

.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-3 { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.text-mono { font-family: var(--font-mono); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.text-display { font-family: var(--font-display); }
.text-italic { font-style: italic; }

.sparkline { width: 100%; height: 36px; }

/* body scroll style */
body::-webkit-scrollbar { width: 10px; height: 10px; }
body::-webkit-scrollbar-track { background: transparent; }
body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); border: 2px solid var(--paper); }
body::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* responsive: collapse bento on narrow */
@media (max-width: 1200px) {
  .bento-grid { grid-template-columns: repeat(4, 1fr); }
  .article-card.size-feature { grid-column: span 4; }
}

@media (max-width: 900px) {
  .bento-grid { grid-template-columns: repeat(2, 1fr); }
  .article-card,
  .article-card.size-wide,
  .article-card.size-feature,
  .article-card.size-square { grid-column: span 2; }
  .article-card.size-tall { grid-row: span 1; }
}

/* ── 4.9 Взаимодействие со статьями ── */

.article-mandatory-badge {
  color: #DC2626;
  font-weight: 600;
  font-size: 12px;
}

.article-views-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-3);
}

.btn.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.article-ix {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.article-ix-loading {
  margin-top: 48px;
  padding-top: 32px;
  color: var(--text-3);
  font-size: 14px;
}

/* —— «Была ли статья полезной?» —— */

.article-feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.article-feedback-question {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}

.article-feedback-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.article-feedback-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.article-feedback-btn:hover:not(:disabled) {
  background: var(--paper-2);
  border-color: var(--text-3);
}

.article-feedback-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.article-feedback-btn.is-active.is-yes {
  border-color: #10B981;
  background: #ECFDF5;
  color: #047857;
}

.article-feedback-btn.is-active.is-no {
  border-color: #EF4444;
  background: #FEF2F2;
  color: #DC2626;
}

/* —— Предыдущая / следующая статья —— */

.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-top: 28px;
  overflow: hidden;
  background: #fff;
}

.article-nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 22px;
  border: none;
  background: #fff;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background 0.12s ease;
  min-height: 88px;
}

.article-nav-item:hover:not(.article-nav-item--empty) {
  background: var(--paper-2);
}

.article-nav-item--next {
  justify-content: flex-end;
  text-align: right;
  border-left: 1px solid var(--border);
}

.article-nav-item--empty {
  cursor: default;
  background: var(--paper-2);
}

.article-nav-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.article-nav-label {
  font-size: 12px;
  color: var(--text-3);
}

.article-nav-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-nav-chevron {
  flex-shrink: 0;
  color: var(--text-3);
}

.article-nav-chevron--left {
  transform: rotate(180deg);
}

/* —— Обязательное ознакомление —— */

.article-ix-mandatory-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 28px;
  border: 1px solid #FDE68A;
  border-radius: var(--r-md);
  background: #FFFBEB;
}

.article-ix-mandatory-bar.is-done {
  background: #F0FDF4;
  border-color: #BBF7D0;
}

.article-ix-mandatory-bar-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.article-ix-mandatory-test-hint {
  font-weight: 400;
  color: var(--text-3);
}

/* —— Комментарии —— */

.article-comments {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--border-soft);
}

.article-comments-title {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.article-ix-ack-done {
  margin: 0;
  color: #15803D;
  font-size: 13px;
}

.article-ix-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 80px;
  box-sizing: border-box;
}

.article-ix-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.article-ix-comment-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.article-ix-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.article-ix-item {
  padding: 14px 16px;
  border-radius: var(--r-sm);
  background: var(--paper-2);
  border: 1px solid var(--border-soft);
}

.article-ix-item--reply {
  margin-left: 20px;
  margin-top: 8px;
}

.article-ix-item-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.article-ix-author {
  font-weight: 600;
  font-size: 13px;
}

.article-ix-date {
  font-size: 12px;
  color: var(--text-3);
}

.article-ix-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.article-ix-item-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.article-ix-link-btn {
  border: none;
  background: none;
  padding: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-text);
  cursor: pointer;
}

.article-ix-link-btn:hover {
  text-decoration: underline;
}

.article-ix-link-btn--danger {
  color: #DC2626;
}

.article-ix-reply-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  align-items: flex-start;
}

.article-ix-replies {
  margin-top: 4px;
}

@media (max-width: 640px) {
  .article-nav {
    grid-template-columns: 1fr;
  }

  .article-nav-item--next {
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .article-feedback {
    flex-direction: column;
    align-items: flex-start;
  }
}

.sb-notify {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}

.kb-aside-subscribe {
  width: 100%;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.kb-aside-subscribe.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.ack-report-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ack-report-row {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
}

.ack-report-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.ack-report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.ack-report-pending {
  margin: 0;
  font-size: 13px;
  color: #B45309;
}

.ack-report-done {
  margin: 4px 0 0;
}

.notifications-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notification-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.notification-row.is-read {
  opacity: 0.65;
}

.notification-main {
  flex: 1;
  min-width: 0;
}

.notification-main p {
  margin: 0 0 4px;
  font-size: 14px;
}
