/* Документация: /docs/features/ropika-help.md, /docs/ui/ACTIONS_AND_MENUS.md */
.knowledge-workspace { min-width: 0; }
.knowledge-workspace [hidden] { display: none !important; }
.kw-page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.kw-page-header h1 { margin-bottom: 6px; }
.kw-muted { font-size: 12px; line-height: 1.6; color: #64748b; }
.kw-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.kw-tabs { display: flex; gap: 24px; border-bottom: 1px solid #e2e8f0; margin-bottom: 24px; }
.kw-tabs a { display: flex; align-items: center; gap: 8px; padding: 0 2px 13px; border-bottom: 2px solid transparent; font-size: 13px; color: #64748b; font-weight: 600; }
.kw-tabs a[aria-current] { color: #2563eb; border-color: #2563eb; }
.kw-layout { display: grid; grid-template-columns: 246px minmax(0,1fr); gap: 24px; align-items: start; }
.kw-layout > section { min-width: 0; }
.kw-navigation { position: sticky; top: 16px; min-width: 0; max-height: var(--kw-navigation-height,calc(100dvh - 48px)); display: flex; flex-direction: column; overflow: hidden; overflow-anchor: none; border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; box-shadow: 0 1px 3px #0f172a0a; }
.kw-sections { min-width: 0; flex-shrink: 0; }
.kw-sections-toggle { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 44px; padding: 12px 16px; text-align: left; color: #475569; }
.kw-sections-toggle:hover { color: #2563eb; background: #f8fafc; }
.kw-sections-toggle > span { flex: 1; min-width: 0; }
.kw-sections-toggle > svg { flex-shrink: 0; }
.kw-sections-toggle[aria-expanded=true] > svg:last-child { transform: rotate(90deg); }
.kw-sections-label { display: block; font-size: 12px; font-weight: 600; }
.kw-section-current { display: none; font-size: 12px; line-height: 1.5; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kw-navigation.is-collapsed .kw-section-current { display: block; }
.kw-navigation.is-collapsed .kw-sections-label { font-size: 10px; font-weight: 400; color: #64748b; margin-bottom: 2px; }
.kw-sections-list { padding: 0 8px 10px; max-height: min(420px,calc(var(--kw-navigation-height,600px) - 60px)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.kw-navigation.has-outline .kw-sections-list { max-height: min(240px,calc(var(--kw-navigation-height,600px) * .4)); }
.kw-section-link { display: flex; align-items: flex-start; gap: 8px; border-radius: 8px; padding: 10px; font-size: 12px; color: #334155; }
.kw-section-link:hover { background: #eff6ff; }
.kw-section-link[aria-current] { color: #2563eb; background: #e7efff; font-weight: 600; }
.kw-section-link > svg { flex-shrink: 0; margin-top: 2px; }
.kw-sections-list .ui-btn { font-size: 12px; white-space: normal; box-shadow: none; }
.kw-outline { border-top: 1px solid #e2e8f0; display: flex; flex-direction: column; min-height: 108px; max-height: min(440px,60dvh); flex: 1 1 auto; padding: 16px 12px; overflow: hidden; }
.kw-outline h2 { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin: 0 4px 12px; font-size: 12px; font-weight: 600; }
.kw-outline h2 svg { color: #2563eb; }
.kw-outline nav { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.kw-outline a { display: block; border-left: 2px solid transparent; border-radius: 0 6px 6px 0; padding: 8px 8px 8px calc(8px + var(--heading-depth) * 8px); color: #475569; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.kw-outline a:hover { background: #eff6ff; color: #2563eb; }
.kw-outline a[aria-current] { background: #e7efff; border-left-color: #2563eb; color: #2563eb; font-weight: 600; }
.knowledge-workspace .kw-mobile-sections { display: none; }
.kw-back { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: #64748b; margin-bottom: 18px; }
.kw-back:hover { color: #2563eb; }
.kw-reading { min-width: 0; max-width: 896px; }
.kw-paper { min-width: 0; padding: 0; overflow-wrap: anywhere; }
.kw-paper-header { padding: 28px 32px 22px; border-bottom: 1px solid #e2e8f0; }
.kw-paper-header h1, .kw-paper-header h2 { margin: 12px 0 0; font-size: 28px; line-height: 1.3; font-weight: 700; letter-spacing: -.5px; }
.kw-article-body { padding: 26px 32px; color: #334155; font-size: 15px; line-height: 1.85; }
.kw-article-body img { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid #e2e8f0; margin: 20px auto; }
.kw-article-body :is(h1,h2,h3,h4,h5,h6) { scroll-margin-top: 16px; }
.kw-section-title { font-size: 21px; font-weight: 650; margin-bottom: 18px; }
.kw-search { display: flex; gap: 8px; margin-bottom: 18px; }
.kw-search .ui-control { min-width: 0; padding: 8px 12px; }
.kw-article-list { padding: 0; overflow: hidden; }
.kw-article-row { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid #edf1f6; font-size: 13px; }
.kw-article-row:last-child { border-bottom: 0; }
.kw-article-row:hover { background: #f8fbff; }
.kw-article-row > svg { color: #8195b1; flex-shrink: 0; }
.kw-article-row > span { flex: 1; min-width: 0; }
.kw-article-row strong { display: block; font-weight: 600; }
.kw-article-row small { display: block; color: #64748b; margin-top: 4px; font-size: 12px; }
.kw-empty { padding: 24px; font-size: 13px; color: #64748b; }
.kw-public-help { padding-block: 48px; max-width: 960px; margin-inline: auto; }
.kw-public-help > .kw-muted { margin-block: 10px 24px; }
.kw-panel-article h1 { font-size: 22px; line-height: 1.4; font-weight: 700; }
.kw-panel-article .kw-article-body { padding: 20px 0; font-size: 14px; }
@media (max-width: 1199px) { .kw-layout { grid-template-columns: 205px minmax(0,1fr); gap: 20px; } }
@media (max-width: 767px) {
  .kw-page-header { gap: 12px; flex-wrap: wrap; }
  .kw-page-header .kw-muted { display: none; }
  .kw-tabs { gap: 16px; }
  .kw-tabs a { font-size: 12px; }
  .kw-layout { display: block; }
  .kw-navigation { position: static; max-height: none; margin-bottom: 20px; }
  .kw-navigation.mobile-hidden { display: none; }
  .kw-sections-toggle { display: none; }
  .kw-sections-list, .kw-navigation.has-outline .kw-sections-list { max-height: 320px; padding-top: 12px; }
  .kw-outline { border-top: 0; min-height: 0; max-height: none; }
  .kw-outline a { min-height: 40px; display: flex; align-items: center; }
  .knowledge-workspace .kw-mobile-sections { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; width: 100%; }
  .kw-paper-header { padding: 22px 20px; }
  .kw-paper-header h1, .kw-paper-header h2 { font-size: 24px; }
  .kw-article-body { padding: 22px 20px; font-size: 14px; }
}
.kw-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.kw-section-heading .kw-section-title { margin-bottom: 8px; }
.kw-section-heading > div:first-child { min-width: 0; }
.kw-breadcrumbs { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 16px; color: #64748b; font-size: 12px; }
.kw-breadcrumbs a:hover { color: #2563eb; }
.kw-menu { max-height: min(70dvh, 480px); overflow-y: auto; overscroll-behavior: contain; position: absolute; right: 0; top: calc(100% + 6px); z-index: 35; width: min(290px, 80vw); background: white; border: 1px solid #e2e8f0; border-radius: 12px; padding: 6px; box-shadow: 0 6px 24px #0f172a1a; font-size: 13px; }
.kw-menu > a, .kw-menu > button, .kw-menu > form > button, .kw-article-info summary { display: block; width: 100%; padding: 9px 10px; border-radius: 6px; text-align: left; cursor: pointer; }
.kw-menu > a:hover, .kw-menu > button:hover, .kw-menu > form > button:hover, .kw-article-info summary:hover { background: #f1f5f9; }
.kw-menu hr { margin: 6px 0; border-color: #e2e8f0; }
.kw-menu .kw-danger { color: #dc2626; }
.kw-article-info dl { padding: 8px 10px; font-size: 12px; line-height: 1.6; }
.kw-article-info dt { color: #64748b; margin-top: 5px; }
.kw-article-summary { margin-top: 16px; color: #64748b; font-size: 14px; line-height: 1.7; }
.kw-movable-row { position: relative; border-bottom: 1px solid #edf1f6; }
.kw-movable-row:last-child { border-bottom: 0; }
.kw-row-content { display: flex; align-items: center; padding-left: 8px; }
.kw-row-content .kw-article-row { flex: 1; min-width: 0; border: 0; }
.kw-row-content .kw-status { flex: 0 0 auto; color: #a16207; font-size: 11px; }
.kw-drag { flex-shrink: 0; color: #9aaac0; padding: 2px; cursor: grab; }
.kw-dropzone { position: absolute; inset-inline: 0; height: 8px; z-index: 1; border: 1px solid transparent; pointer-events: none; }
.kw-dropzone[data-placement=before] { top: -4px; }
.kw-dropzone[data-placement=after] { bottom: -4px; }
.knowledge-workspace:has([data-knowledge-node-move-target=handle][draggable]) .kw-dropzone { pointer-events: auto; }
.kw-pagination { display: flex; justify-content: center; margin-top: 20px; }
.kw-tree-toggle { color: #64748b; font-size: 11px; padding: 8px 10px; }
.kw-editor { min-width: 0; }
.kw-editor-paper { padding: 0; }
.kw-editor-toolbar { position: sticky; bottom: 0; margin-top: 12px; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; background: #f5f7fb; }
.kw-editor .knowledge-editor-shell { border-radius: 10px; }
.kw-editor .toastui-editor-defaultUI { border: 0; }
.kw-publication-access { display: grid; gap: 10px; padding: 20px 16px; border-top: 1px solid #e2e8f0; font-size: 13px; }
.kw-publication-access .ui-control { padding: 9px 12px; width: min(100%, 380px); }
.kw-icon-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.kw-icon-choices legend { font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.kw-icon-choices label { position: relative; cursor: pointer; }
.kw-icon-choices input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kw-icon-choices span { display: flex; align-items: center; gap: 7px; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 10px; font-size: 12px; color: #64748b; }
.kw-icon-choices input:checked + span { border-color: #2563eb; color: #2563eb; background: #eff6ff; }
.kw-icon-choices input:focus-visible + span { outline: 2px solid #2563eb; outline-offset: 2px; }
.kw-validation { padding: 16px; margin-bottom: 16px; background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; color: #b91c1c; font-size: 13px; }
@media (max-width: 767px) {
  .kw-actions { flex-wrap: wrap; }
  .kw-editor-toolbar { flex-wrap: wrap; }
  .kw-paper-header .kw-section-heading { flex-wrap: wrap; }
}
.kw-sections-list [data-tree-depth]:not([data-tree-depth="0"]) { margin-left: 8px; padding-left: 8px; border-left-width: 1px; }
.kw-sections-list .kw-tree-title { font-size: 12px; line-height: 1.5; }
.kw-sections-list .kw-tree-current, .kw-sections-list .kw-tree-description { display: none; }
.kw-sections-list .ui-btn { padding: 10px 6px; gap: 7px; }
.kw-sections-list [data-knowledge-tree-target=button] { width: 24px; height: 32px; }
.kw-image-open { position: relative; display: block; width: 100%; cursor: zoom-in; }
.kw-image-open > span { position: absolute; bottom: 12px; right: 12px; padding: 6px 9px; background: white; border: 1px solid #e2e8f0; border-radius: 7px; color: #475569; font-size: 11px; box-shadow: 0 1px 4px #0f172a10; }
.kw-image-open:focus-visible { outline: 2px solid #2563eb; outline-offset: 4px; }
.kw-image-dialog { width: min(1440px, calc(100vw - 32px)); max-width: none; height: min(1000px, calc(100dvh - 32px)); max-height: none; margin: auto; padding: 0; border: 1px solid #e2e8f0; border-radius: 14px; background: white; }
.kw-image-dialog[open] { display: flex; flex-direction: column; }
.kw-image-dialog::backdrop { background: #0f172a99; }
.kw-image-dialog header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid #e2e8f0; font-size: 13px; flex-shrink: 0; }
.kw-image-dialog > div { padding: 16px; overflow: auto; min-height: 0; flex: 1; }
.kw-image-dialog img { max-width: 100%; width: auto; height: auto; margin: 0 auto; }

.kw-public-workspace { padding-block: 40px; max-width: 1280px; margin-inline: auto; }

.public-site .knowledge-workspace .kw-outline h2 { font-size: 12px; line-height: 1.5; letter-spacing: 0; margin: 0 4px 12px; }
.public-site .knowledge-workspace .kw-paper-header h1 { font-size: 28px; line-height: 1.3; letter-spacing: -.5px; margin: 12px 0 0; }
.public-site .knowledge-workspace .kw-article-body h2 { font-size: 21px; line-height: 1.5; margin: 28px 0 10px; letter-spacing: 0; }
.public-site .knowledge-workspace .kw-article-body h3 { font-size: 18px; line-height: 1.5; margin: 22px 0 10px; letter-spacing: 0; }
.public-site .knowledge-workspace .kw-article-body p { margin-bottom: 16px; }
.public-site .knowledge-workspace .kw-article-body ul, .public-site .knowledge-workspace .kw-article-body ol { margin: 12px 0 12px 20px; }

.kw-image-open[data-image-state=loading], .kw-image-open[data-image-state=error] { min-height: 140px; margin-block: 20px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc; cursor: default; }
.kw-image-open[data-image-state=error] > span { color: #b91c1c; }
