﻿/* ==========================================================================
   SAMVA KNOWLEDGE BASE (Base de Conocimiento / Wiki)
   Estilos del portal de documentación — complementa samva-design-system.css
   ========================================================================== */

:root {
    --sv-kb-pinned-bg: #f8fafc;
    --sv-kb-pinned-border: #94a3b8;
    --sv-kb-pinned-icon: #0ea5e9;
    --sv-kb-sidebar-width: 300px;
    --sv-kb-reader-sidebar-width: 280px;
    --sv-kb-panel-collapsed-width: 52px;
}

/* Página KB: layout a altura completa (mismo patrón que Notificaciones / Colas). */
html.sv-kb-page,
body.sv-kb-page,
body.sv-kb-page.sv-layout-v2-active {
    height: 100%;
    overflow: hidden !important;
}

body.sv-kb-page #base,
body.sv-kb-page.sv-layout-v2-active #base {
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    box-sizing: border-box;
}

body.sv-kb-page #base > .sv-v2-top-chrome {
    flex: 0 0 auto;
}

body.sv-kb-page #content,
body.sv-kb-page.sv-layout-v2-active #content {
    flex: 1 1 0;
    min-height: 0;
    height: auto !important;
    max-height: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

/* Layout2: banner arriba, contenido abajo llenando el resto */
body.sv-kb-page #content > .sv-page-banner-section {
    flex: 0 0 auto;
    margin-bottom: 0;
}

body.sv-kb-page #content > section {
    flex: 1 1 0;
    min-height: 0;
    height: auto !important;
    max-height: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    padding-bottom: 8px !important;
}

body.sv-kb-page #content > section > .section-body {
    flex: 1 1 0;
    min-height: 0;
    height: auto !important;
    max-height: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    margin-top: 0 !important;
    padding-top: 8px;
}

/* Layout2 con banner: sin título duplicado ni hueco extra */
body.sv-kb-page #content > section > .section-body > [id$="dvTitulo"],
body.sv-kb-page #content > section > .section-body > #dvTitulo {
    display: none !important;
}

body.sv-kb-page #content > section > .section-body > div[id$="UpdatePanel3"],
body.sv-kb-page #content > section > .section-body > div[id*="UpdatePanel3"] {
    flex: 1 1 0;
    min-height: 0;
    height: auto !important;
    max-height: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

body.sv-kb-page #content > .sv-page-banner-section + section > .section-body > div[id$="UpdatePanel3"] > .sv-kb-app,
body.sv-kb-page #content > .sv-page-banner-section + section > .section-body > div[id*="UpdatePanel3"] > .sv-kb-app,
body.sv-kb-page #content > section > .section-body > div[id$="UpdatePanel3"] > .sv-kb-app,
body.sv-kb-page #content > section > .section-body > div[id*="UpdatePanel3"] > .sv-kb-app {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: none;
}

/* Contenedor principal wiki */
.sv-kb-app {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    flex: 1 1 0;
    min-height: 0;
    align-self: stretch;
    /* Fallback; JS fija la altura exacta al espacio bajo el header/banner. */
    --sv-kb-viewport-height: calc(100vh - 220px);
    height: var(--sv-kb-viewport-height);
    max-height: var(--sv-kb-viewport-height);
    font-family: var(--sv-font);
    color: var(--sv-text-main);
    margin-top: 0;
    margin-bottom: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.sv-kb-app .sv-wiki-layout {
    display: flex;
    gap: 24px;
    flex-grow: 1;
    align-items: stretch;
    min-height: 0;
    height: 100%;
    position: relative;
    overflow: visible;
}

/* Panel lateral colapsable / fijable */
.sv-kb-panel {
    position: relative;
    transition: width 0.25s ease, min-width 0.25s ease, opacity 0.2s ease;
}

.sv-kb-panel-toolbar {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin-bottom: 0;
    flex-shrink: 0;
    z-index: 4;
}

.sv-kb-panel-toolbar .btn.btn-icon-toggle,
.sv-kb-panel-toolbar .btn-icon-toggle {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    border-radius: var(--sv-radius-md);
    border: 1px solid var(--sv-border);
    background: var(--sv-white);
    color: var(--sv-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.15s;
    box-shadow: var(--sv-shadow-sm);
}

.sv-kb-panel-toolbar .btn.btn-icon-toggle:hover,
.sv-kb-panel-toolbar .btn-icon-toggle:hover {
    border-color: var(--sv-primary);
    color: var(--sv-primary);
    background: var(--sv-primary-alpha);
}

.sv-kb-panel-toolbar .btn.btn-icon-toggle.is-active,
.sv-kb-panel-toolbar .btn-icon-toggle.is-active {
    background: var(--sv-primary-alpha);
    color: var(--sv-primary);
    border-color: var(--sv-primary);
}

/* Botón primario dentro del wiki */
.sv-kb-app .btn-primary-custom {
    background: var(--sv-primary);
    color: #fff;
    border: 1px solid transparent;
    box-shadow: var(--sv-shadow-sm);
    border-radius: var(--sv-radius-md);
    font-weight: 700;
    font-size: 12px;
    padding: 10px 14px;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    outline: none;
    text-decoration: none !important;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    width: 100%;
    box-sizing: border-box;
}

.sv-kb-app .btn-primary-custom:hover,
.sv-kb-app .btn-primary-custom:focus {
    opacity: 0.92;
    color: #fff;
    box-shadow: var(--sv-shadow-md);
}

/* Buscador sidebar y home */
.sv-kb-app .sv-input-group {
    position: relative;
    display: block;
    width: 100%;
    min-height: 38px;
}

.sv-kb-app .sv-input-group > i {
    position: absolute;
    left: 12px;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: var(--sv-text-muted);
    z-index: 2;
    pointer-events: none;
    font-size: 13px;
    line-height: 1;
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sv-kb-app .sv-sidebar-search .sv-input,
.sv-kb-app .sv-input-group .sv-input,
.sv-kb-app .sv-input-group > span.sv-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px 9px 34px !important;
    font-size: 13px;
    height: 38px;
    border-radius: var(--sv-radius-md);
    background: var(--sv-bg-soft);
    border: 1px solid var(--sv-border-light);
}

.sv-kb-app .sv-sidebar-search .sv-input:focus,
.sv-kb-app .sv-input-group .sv-input:focus {
    background: var(--sv-white);
    border-color: var(--sv-primary);
    box-shadow: 0 0 0 3px var(--sv-primary-alpha);
    outline: none;
}

.sv-sidebar-search .sv-input-group,
.sv-sidebar-search a.sv-input-group {
    position: relative !important;
    display: block !important;
    width: 100% !important;
}
.sv-sidebar-search .sv-input-group > i {
    position: absolute !important;
    left: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
    line-height: 1 !important;
    z-index: 3 !important;
}
.sv-sidebar-search .sv-input-group > span.sv-input {
    text-align: left;
    color: var(--sv-text-muted);
    line-height: 20px;
}

.sv-wiki-sidebar.sv-kb-panel {
    width: var(--sv-kb-sidebar-width);
    min-width: var(--sv-kb-sidebar-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--sv-white);
    border: 1px solid var(--sv-border);
    border-radius: var(--sv-radius-lg);
    padding: 42px 16px 16px;
    overflow: hidden;
    box-shadow: var(--sv-shadow-sm);
    height: 100%;
    max-height: none;
    align-self: stretch;
}

.sv-wiki-sidebar.sv-kb-panel.is-collapsed {
    width: var(--sv-kb-panel-collapsed-width);
    min-width: var(--sv-kb-panel-collapsed-width);
    padding: 42px 8px 12px;
}

.sv-wiki-sidebar.sv-kb-panel.is-collapsed .sv-kb-panel-body {
    display: none;
}

.sv-kb-panel.is-unpinned-hidden {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    flex: 0 0 0 !important;
}

.sv-kb-panel.is-peek-open {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 120;
    opacity: 1 !important;
    pointer-events: auto !important;
    overflow: visible;
    box-shadow: var(--sv-shadow-lg);
    flex: 0 0 auto !important;
}

.sv-wiki-sidebar.sv-kb-panel.is-peek-open {
    left: 0;
    width: var(--sv-kb-sidebar-width) !important;
    min-width: var(--sv-kb-sidebar-width) !important;
    max-width: var(--sv-kb-sidebar-width) !important;
    padding: 42px 16px 16px !important;
    border: 1px solid var(--sv-border) !important;
}

.sv-reader-sidebar.sv-kb-panel.is-peek-open {
    right: 0;
    width: var(--sv-kb-reader-sidebar-width) !important;
    min-width: var(--sv-kb-reader-sidebar-width) !important;
    max-width: var(--sv-kb-reader-sidebar-width) !important;
    padding: 52px 20px 20px !important;
    border-left: 1px solid var(--sv-border) !important;
}

.sv-kb-peek-trigger {
    position: absolute;
    top: 72px;
    z-index: 80;
    width: 30px;
    height: 48px;
    padding: 0;
    border: 1px solid var(--sv-border);
    background: var(--sv-white);
    color: var(--sv-text-main);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--sv-shadow-sm);
    transition: 0.15s;
}

.sv-kb-peek-trigger.is-visible {
    display: inline-flex !important;
}

.sv-kb-peek-trigger:hover {
    color: var(--sv-primary);
    border-color: var(--sv-primary);
    background: var(--sv-primary-alpha);
}

/* Izquierdo: en el layout, borde izquierdo (visible aunque el card tenga overflow). */
.sv-kb-peek-trigger-left {
    left: 0;
    transform: none;
    border-radius: 0 10px 10px 0;
    border-left: none;
}

/* Derecho: dentro del card blanco, borde derecho. */
.sv-kb-peek-trigger-right {
    right: 0;
    transform: none;
    border-radius: 10px 0 0 10px;
    border-right: none;
}



.sv-wiki-sidebar.sv-kb-panel.is-pinned {
    position: relative;
    top: auto;
    align-self: stretch;
    max-height: none;
    height: 100%;
}

.sv-kb-panel-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    flex-grow: 1;
    min-height: 0;
}

.sv-kb-panel-body::-webkit-scrollbar { width: 4px; }
.sv-kb-panel-body::-webkit-scrollbar-thumb { background: var(--sv-border); border-radius: 4px; }

/* Árbol de artículos */
.sv-tree-nav { display: flex; flex-direction: column; gap: 0; margin: 0; }
.sv-tree-node { display: flex; flex-direction: column; gap: 0; }
.sv-tree-row {
    display: flex; align-items: flex-start; gap: 2px; min-height: 30px;
    position: relative;
}
.sv-tree-item {
    display: flex; align-items: flex-start; gap: 8px; flex: 1; min-width: 0;
    padding: 4px 8px; border-radius: var(--sv-radius-sm);
    color: var(--sv-text-main); font-size: 13px; font-weight: 500; line-height: 1.35;
    transition: 0.15s; text-decoration: none !important;
}
a.sv-tree-item:hover { background: var(--sv-bg-soft); color: var(--sv-primary); }
a.sv-tree-item.active { background: var(--sv-primary-alpha); color: var(--sv-primary); font-weight: 600; }
.sv-tree-icon { color: var(--sv-text-muted); width: 15px; text-align: center; font-size: 13px; flex-shrink: 0; margin-top: 2px; }
a.sv-tree-item.active .sv-tree-icon { color: var(--sv-primary); }
.sv-tree-caret {
    color: var(--sv-text-muted); font-size: 10px; width: 18px; height: 18px; flex-shrink: 0;
    cursor: pointer; border: none; background: transparent; padding: 0; margin: 2px 0 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 4px; transition: 0.15s;
}
.sv-tree-caret:hover { background: var(--sv-bg-soft); color: var(--sv-text-main); }
.sv-tree-caret.expanded i { transform: rotate(90deg); }
.sv-tree-caret i { transition: transform 0.15s ease; display: block; }
.sv-tree-caret-spacer { visibility: hidden; pointer-events: none; }
.sv-tree-children {
    display: none; flex-direction: column; gap: 0;
    padding-left: 12px; margin-left: 8px;
    border-left: 1px solid var(--sv-border-light);
}
.sv-tree-children.is-open { display: flex; }
.sv-tree-label {
    min-width: 0;
    flex: 1;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}
.sv-tree-label.is-single-word {
    white-space: nowrap;
    display: block;
    -webkit-line-clamp: unset;
    text-overflow: ellipsis;
    overflow: hidden;
}
.sv-tree-actions {
    flex-shrink: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    margin-top: 1px;
}
.sv-tree-row:hover .sv-tree-actions,
.sv-tree-row.is-menu-open .sv-tree-actions {
    opacity: 1;
    visibility: visible;
}
.sv-tree-menu-btn {
    width: 24px;
    height: 24px;
    min-width: 24px;
    padding: 0;
    border-radius: var(--sv-radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--sv-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.sv-tree-menu-btn:hover,
.sv-tree-row.is-menu-open .sv-tree-menu-btn {
    border-color: var(--sv-border);
    background: var(--sv-white);
    color: var(--sv-text-main);
}
.sv-tree-actions .dropdown-menu {
    font-size: 13px;
    min-width: 190px;
}
.sv-tree-actions .dropdown-menu li a {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Sidebar secciones */
.sv-sidebar-section { display: flex; flex-direction: column; gap: 10px; }
.sv-sidebar-title {
    font-size: 11px; font-weight: 800; color: var(--sv-text-muted);
    text-transform: uppercase; letter-spacing: 0.5px; margin: 0;
    display: flex; justify-content: space-between; align-items: center;
}
.sv-sidebar-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.sv-tag-clickable { cursor: pointer; transition: 0.2s; }
.sv-tag-clickable:hover { background: var(--sv-bg-soft); border-color: var(--sv-border); color: var(--sv-text-main); }
.sv-tag-clickable.active { background: var(--sv-primary); color: white; border-color: var(--sv-primary); }

/* Área principal wiki */
.sv-wiki-main {
    flex-grow: 1; display: flex; flex-direction: column; min-width: 0;
    background: var(--sv-white); border: 1px solid var(--sv-border);
    border-radius: var(--sv-radius-lg); box-shadow: var(--sv-shadow-sm);
    overflow: hidden; position: relative;
    height: 100%;
    max-height: none;
    align-self: stretch;
}

.sv-main-header {
    padding: 20px 28px; border-bottom: 1px solid var(--sv-border);
    display: flex; flex-direction: column; gap: 14px; background: #ffffff; flex-shrink: 0;
}

.sv-breadcrumbs {
    display: flex; align-items: center; gap: 8px; font-size: 12px;
    font-weight: 500; color: var(--sv-text-muted); flex-wrap: wrap;
}
.sv-breadcrumb-item { cursor: pointer; transition: 0.2s; display: flex; align-items: center; gap: 6px; text-decoration: none !important; color: inherit; }
.sv-breadcrumb-item:hover { color: var(--sv-primary); }
.sv-breadcrumb-item:last-child, .sv-breadcrumb-item.is-current {
    color: var(--sv-text-main); font-weight: 600; cursor: default;
    max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sv-breadcrumb-sep { color: var(--sv-text-light); font-size: 10px; }

.sv-main-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: nowrap; }
.sv-main-title-row > div:first-child { flex: 1; min-width: 0; }
.sv-main-title { font-size: 22px; font-weight: 800; color: var(--sv-text-main); margin: 0; line-height: 1.3; }
.sv-main-subtitle { font-size: 13px; color: var(--sv-text-muted); margin-top: 4px; display: block; }

.sv-main-content-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: var(--sv-bg-main);
    min-height: 0;
    position: relative;
}
.sv-main-content-scroll:has(.sv-reader-layout) {
    background: var(--sv-white);
}
.sv-main-content-scroll::-webkit-scrollbar { width: 8px; }
.sv-main-content-scroll::-webkit-scrollbar-thumb { background: var(--sv-border); border-radius: 10px; }

/* Vista HOME */
.sv-home-hero {
    background: var(--sv-white); padding: 40px 28px 32px; text-align: center;
    border-bottom: 1px solid var(--sv-border);
    display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.sv-home-greeting { font-size: 28px; font-weight: 800; color: var(--sv-text-main); margin: 0; letter-spacing: -0.02em; }
.sv-home-sub { font-size: 14px; color: var(--sv-text-muted); font-weight: 500; margin: 0; max-width: 480px; }
.sv-home-search-wrap { max-width: 580px; width: 100%; margin: 8px auto 0; }
.sv-home-search-wrap .sv-input-group { position: relative; display: block; width: 100%; }
.sv-home-search-wrap .sv-input {
    padding: 14px 108px 14px 44px !important; font-size: 14px; border-radius: 999px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06); border: 1px solid var(--sv-border-light);
    background: var(--sv-bg-soft); width: 100%; height: 48px; box-sizing: border-box;
}
.sv-home-search-wrap .sv-input:focus { background: white; border-color: var(--sv-primary); box-shadow: 0 0 0 4px var(--sv-primary-alpha); outline: none; }
.sv-home-search-wrap .sv-input-group > i {
    position: absolute !important; left: 18px !important; top: 50% !important; transform: translateY(-50%) !important;
    color: var(--sv-text-muted); font-size: 15px; pointer-events: none; z-index: 2;
}
.sv-home-hero .btn-primary-custom.sv-home-search-btn {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    border-radius: 999px; padding: 8px 16px; font-size: 12px; min-height: 0; width: auto;
}
.sv-home-search-wrap .sv-input-group .sv-input { display: block; }
.sv-link-ver-todos {
    font-size: 12px; font-weight: 700; color: var(--sv-primary);
    text-decoration: none !important; padding: 6px 12px; border-radius: var(--sv-radius-md);
    transition: 0.15s; background: transparent;
}
.sv-link-ver-todos:hover { background: var(--sv-primary-alpha); color: var(--sv-primary); }

.sv-home-section {
    padding: 28px 32px 32px; display: flex; flex-direction: column; gap: 18px;
    max-width: 1120px; width: 100%; margin: 0 auto; box-sizing: border-box;
}
.sv-section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.sv-section-heading h3 { font-size: 15px; font-weight: 800; color: var(--sv-text-main); margin: 0; display: flex; align-items: center; gap: 8px; }

.sv-category-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}
@media (max-width: 1200px) {
    .sv-category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .sv-category-grid { grid-template-columns: 1fr; }
}
.sv-category-card {
    background: var(--sv-white); border: 1px solid var(--sv-border); border-radius: var(--sv-radius-lg);
    padding: 20px; display: flex; align-items: center; gap: 14px; min-height: 88px;
    cursor: pointer; transition: 0.2s; box-shadow: var(--sv-shadow-sm); text-decoration: none !important; color: inherit;
}
.sv-category-card:hover { border-color: var(--sv-primary); box-shadow: var(--sv-shadow-md); transform: translateY(-2px); }
.sv-cat-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.sv-cat-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.sv-cat-title {
    font-size: 13px; font-weight: 700; color: var(--sv-text-main); margin: 0;
    line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sv-cat-count { font-size: 11px; font-weight: 600; color: var(--sv-text-muted); }

/* Lista de artículos */
.sv-article-list { display: flex; flex-direction: column; padding: 16px 28px 28px; gap: 10px; }

.sv-article-card {
    display: flex; align-items: flex-start; gap: 14px; padding: 14px;
    background: var(--sv-white); border: 1px solid var(--sv-border);
    border-radius: var(--sv-radius-md); transition: all 0.2s ease;
    color: inherit; position: relative; z-index: 1;
}
.sv-article-card:has(.btn-group.open),
.sv-article-card.is-menu-open {
    z-index: 80;
}
.sv-article-card .btn-group.open { position: relative; z-index: 30; }
.sv-article-card .dropdown-menu { z-index: 1040; }
.sv-article-card > a.sv-article-card-link {
    display: flex; align-items: flex-start; gap: 14px; flex-grow: 1; min-width: 0;
    text-decoration: none !important; color: inherit;
}
.sv-article-card:hover { border-color: var(--sv-primary-alpha); box-shadow: var(--sv-shadow-md); transform: translateY(-1px); }
.sv-article-card.is-pinned { background: var(--sv-kb-pinned-bg); border-color: var(--sv-kb-pinned-border); }
.sv-article-card.is-pinned:hover { border-color: var(--sv-primary); }

.sv-ac-thumb {
    width: 52px; height: 52px; border-radius: 10px; flex-shrink: 0;
    overflow: hidden; background: #eff6ff; border: 1px solid #dbeafe;
    display: flex; align-items: center; justify-content: center;
}
.sv-ac-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.sv-ac-icon { font-size: 20px; color: #3b82f6; }
.sv-article-card.is-pinned .sv-ac-icon { color: var(--sv-kb-pinned-icon); }
.sv-ac-icon.code { color: #7c3aed; }
.sv-ac-thumb:has(.sv-ac-icon.code) { background: #f5f3ff; border-color: #ddd6fe; }
.sv-ac-icon.doc { color: #dc2626; }
.sv-ac-thumb:has(.sv-ac-icon.doc) { background: #fef2f2; border-color: #fecaca; }
.sv-ac-thumb.sv-ac-thumb-doc { background: #eff6ff; border-color: #dbeafe; }

.sv-ac-content { display: flex; flex-direction: column; gap: 5px; flex-grow: 1; min-width: 0; }
.sv-ac-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sv-ac-title { font-size: 14px; font-weight: 700; color: var(--sv-text-main); margin: 0; line-height: 1.3; }
.sv-article-card:hover .sv-ac-title { color: var(--sv-primary); }
.sv-ac-desc {
    font-size: 12px; color: var(--sv-text-muted); line-height: 1.5; margin: 0;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sv-ac-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 11px; font-weight: 500; color: var(--sv-text-light); margin-top: 2px; }
.sv-ac-meta-item { display: flex; align-items: center; gap: 5px; }

.sv-kb-empty {
    text-align: center; padding: 48px 24px; color: var(--sv-text-muted);
}
.sv-kb-empty i { font-size: 48px; color: var(--sv-text-light); margin-bottom: 16px; display: block; }
.sv-kb-empty h2 { font-size: 18px; font-weight: 700; color: var(--sv-text-muted); margin: 0 0 8px; }

/* Filtros en sidebar */
.sv-kb-filters {
    display: flex; flex-direction: column; gap: 8px;
    padding: 12px; background: var(--sv-bg-soft); border-radius: var(--sv-radius-md); border: 1px solid var(--sv-border-light);
}
.sv-kb-filter-scope { margin-top: 4px; }
.sv-kb-filter-scope .sv-input-compact { width: 100%; }

.sv-input-compact,
.sv-list-toolbar .sv-input-compact {
    padding: 7px 32px 7px 12px; font-size: 12px; height: auto; min-height: 34px;
    border-radius: var(--sv-radius-md); background: var(--sv-white);
    border-color: var(--sv-border); color: var(--sv-text-main); font-weight: 600;
}

.sv-list-toolbar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-shrink: 0;
}
.sv-list-toolbar .sv-list-sort:last-child { min-width: 190px; }

/* Tarjetas destacadas (home) */
.sv-featured-card {
    padding: 18px 20px; border-radius: var(--sv-radius-lg);
    align-items: center; text-decoration: none !important;
}
.sv-featured-card .sv-ac-thumb { width: 56px; height: 56px; }
.sv-featured-card .sv-ac-title { font-size: 15px; }
.sv-featured-card .sv-ac-desc { -webkit-line-clamp: 3; }
.sv-featured-card .sv-ac-meta .sv-badge { font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; }

/* Lector — resumen e índice inline */
.sv-reader-lead {
    font-size: 15px; color: var(--sv-text-muted); margin-bottom: 24px; line-height: 1.6;
}
.sv-reader-lead:empty { display: none; }

.sv-kb-doc-index-wrap { margin-bottom: 28px; }
.sv-kb-doc-index {
    background: #f8fafc; border: 1px solid var(--sv-border);
    border-radius: var(--sv-radius-lg); padding: 0; overflow: hidden;
}
.sv-kb-doc-index.sv-kb-heading-toc { padding: 0; }
.sv-kb-related-index .sv-kb-heading-toc-summary i:first-child { color: var(--sv-primary); }
.sv-kb-related-index .sv-kb-doc-index-list {
    list-style: none; margin: 0; padding: 0 18px 14px;
    display: flex; flex-direction: column; gap: 4px;
    border-top: 1px solid var(--sv-border-light);
}
.sv-kb-doc-index-head {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 800; color: var(--sv-text-main); margin-bottom: 12px;
}
.sv-kb-doc-index-head i { color: var(--sv-primary); }
.sv-kb-doc-index-list {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 4px;
    counter-reset: kb-doc-index;
}
.sv-kb-doc-index-list li { margin: 0; }
.sv-kb-doc-index-link {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 8px 10px; border-radius: var(--sv-radius-sm);
    text-decoration: none !important; color: var(--sv-text-main);
    font-size: 13px; font-weight: 600; line-height: 1.4; transition: 0.15s;
}
.sv-kb-doc-index-link:hover { background: var(--sv-white); color: var(--sv-primary); box-shadow: var(--sv-shadow-sm); }
.sv-kb-doc-index-num {
    width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
    background: var(--sv-white); border: 1px solid var(--sv-border);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 800; color: var(--sv-primary);
}
.sv-kb-doc-index-label { flex: 1; min-width: 0; }

/* Índice por encabezados (contenido largo sin hijos) */
.sv-kb-heading-toc-wrap { margin-bottom: 28px; }
.sv-kb-heading-toc {
    background: #f8fafc; border: 1px solid var(--sv-border);
    border-radius: var(--sv-radius-lg); overflow: hidden;
}
.sv-kb-heading-toc-details { margin: 0; }
.sv-kb-heading-toc-summary {
    list-style: none; cursor: pointer; padding: 14px 18px;
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 800; color: var(--sv-text-main);
    user-select: none;
}
.sv-kb-heading-toc-summary::-webkit-details-marker { display: none; }
.sv-kb-heading-toc-summary i:first-child { color: var(--sv-primary); }
.sv-kb-heading-toc-chevron {
    margin-left: auto; font-size: 11px; color: var(--sv-text-muted);
    transition: transform 0.2s ease;
}
.sv-kb-heading-toc-details[open] .sv-kb-heading-toc-chevron { transform: rotate(180deg); }
.sv-kb-heading-toc-list {
    list-style: none; margin: 0; padding: 0 18px 14px;
    display: flex; flex-direction: column; gap: 2px;
    border-top: 1px solid var(--sv-border-light);
}
.sv-kb-heading-toc-item a {
    display: block; padding: 7px 8px; border-radius: var(--sv-radius-sm);
    font-size: 12px; font-weight: 600; color: var(--sv-text-muted);
    text-decoration: none !important; transition: 0.15s; line-height: 1.4;
}
.sv-kb-heading-toc-item a:hover { background: var(--sv-white); color: var(--sv-primary); }
.sv-kb-heading-toc-item.is-mid a { padding-left: 16px; }
.sv-kb-heading-toc-item.is-sub a { padding-left: 22px; font-weight: 500; }

/* Botón copiar enlace en títulos (hover) */
.dynamic-html-content h1.sv-heading-with-copy,
.dynamic-html-content h2.sv-heading-with-copy,
.dynamic-html-content h3.sv-heading-with-copy,
.dynamic-html-content h4.sv-heading-with-copy {
    position: relative;
    padding-right: 2rem;
}
.dynamic-html-content .sv-heading-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.4rem;
    padding: 0.15rem 0.35rem;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #94a3b8;
    font-size: 0.75em;
    line-height: 1;
    vertical-align: middle;
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.dynamic-html-content h1.sv-heading-with-copy:hover .sv-heading-copy-btn,
.dynamic-html-content h2.sv-heading-with-copy:hover .sv-heading-copy-btn,
.dynamic-html-content h3.sv-heading-with-copy:hover .sv-heading-copy-btn,
.dynamic-html-content h4.sv-heading-with-copy:hover .sv-heading-copy-btn,
.dynamic-html-content .sv-heading-copy-btn:focus {
    opacity: 1;
}
.dynamic-html-content .sv-heading-copy-btn:hover,
.dynamic-html-content .sv-heading-copy-btn:focus {
    color: var(--sv-primary, #0369a1);
    background: rgba(3, 105, 161, 0.08);
    outline: none;
}

/* Sidebar lector — detalles */
.sv-reader-details {
    display: flex; flex-direction: column; gap: 14px;
    padding-bottom: 16px; margin-bottom: 4px;
    border-bottom: 1px solid var(--sv-border-light);
}
.sv-meta-section-title {
    font-size: 12px; font-weight: 800; color: var(--sv-text-main);
    letter-spacing: 0.02em;
}
.sv-toc-sidebar { margin-top: 4px; }
.sv-toc-sidebar { margin-top: 4px; }
.sv-toc-sidebar .sv-toc-link { font-size: 12px; padding: 4px 0; white-space: normal; line-height: 1.35; }
.sv-toc-categories .sv-toc-count { font-size: 10px; margin-left: 4px; }

.sv-kb-filters .sv-input,
.sv-kb-filters select.sv-input {
    padding: 8px 10px; font-size: 12px; height: auto; background: var(--sv-white);
}

/* Lector de artículo: llena el alto del card; crece si el contenido es más alto. */
.sv-reader-layout {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    flex: 1 0 auto;
    min-height: 100%;
    height: auto;
    width: 100%;
    position: relative;
}
.sv-reader-content {
    flex: 1 1 auto;
    align-self: stretch;
    padding: 24px 32px;
    max-width: none;
    margin: 0;
    background: var(--sv-white);
    min-height: 100%;
    width: 100%;
    position: relative;
    box-sizing: border-box;
}
.sv-kb-app.is-reader-expanded .sv-wiki-sidebar.sv-kb-panel,
.sv-kb-app.is-reader-expanded .sv-reader-sidebar.sv-kb-panel { display: none !important; }
.sv-kb-app.is-reader-expanded .sv-reader-content { max-width: none; padding: 28px 48px; }
.sv-kb-app.is-reader-expanded .sv-main-header { padding-right: 48px; }
.sv-kb-app.is-reader-expanded .sv-wiki-main {
    position: fixed;
    inset: 8px;
    z-index: 1200;
    border-radius: var(--sv-radius-lg);
    box-shadow: var(--sv-shadow-lg);
}
.sv-kb-app.is-reader-expanded .sv-main-content-scroll {
    height: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.sv-reader-category {
    display: inline-flex; align-items: center; gap: 8px; margin-top: 8px;
}
.sv-reader-cat-icon {
    width: 28px; height: 28px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
}
.sv-reader-cat-name { font-size: 13px; font-weight: 700; color: var(--sv-text-main); }

.sv-kb-author { display: inline-flex; align-items: center; gap: 8px; }
.sv-kb-author-avatar { border-radius: 50% !important; object-fit: cover; border: 1px solid var(--sv-border); }
.sv-kb-author-name { font-size: 13px; font-weight: 600; color: var(--sv-text-main); }

.sv-meta-date { white-space: normal; flex-wrap: wrap !important; gap: 6px !important; }
.sv-meta-date i { flex-shrink: 0; }

.sv-kb-app .sv-main-title-row .btn-default-bright {
    display: inline-flex; align-items: center; gap: 6px; text-decoration: none !important;
    font-weight: 600; font-size: 13px; padding: 8px 14px; border-radius: var(--sv-radius-md);
}
.sv-kb-app .sv-reader-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.sv-reader-actions { align-self: flex-start; }
.sv-reader-actions-toolbar {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px;
    border: 1px solid var(--sv-border);
    border-radius: var(--sv-radius-lg);
    background: var(--sv-white);
    box-shadow: var(--sv-shadow-sm);
}
.sv-kb-app .sv-reader-actions-toolbar .sv-reader-toolbar-btn,
.sv-kb-app .sv-reader-actions-toolbar .btn-default-bright {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    min-height: 36px !important;
    height: auto !important;
    min-width: 36px !important;
    width: auto !important;
    padding: 8px 14px !important;
    border-radius: var(--sv-radius-md) !important;
    border: 1px solid var(--sv-border) !important;
    background: var(--sv-white) !important;
    color: var(--sv-text-main) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    text-decoration: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    transition: 0.15s ease !important;
    white-space: nowrap;
}
.sv-kb-app .sv-reader-actions-toolbar .sv-reader-toolbar-btn:hover,
.sv-kb-app .sv-reader-actions-toolbar .btn-default-bright:hover,
.sv-kb-app .sv-reader-actions-toolbar .sv-reader-toolbar-btn:focus,
.sv-kb-app .sv-reader-actions-toolbar .btn-default-bright:focus {
    border-color: var(--sv-primary) !important;
    color: var(--sv-primary) !important;
    background: var(--sv-primary-alpha) !important;
}
.sv-reader-actions-toolbar .btn-group {
    display: inline-flex;
    margin: 0;
}
.sv-reader-actions-toolbar .btn-group .dropdown-toggle {
    margin: 0 !important;
}
.sv-reader-actions-toolbar .dropdown-menu {
    font-size: 13px;
}
.sv-reader-cover {
    width: 100%; height: 200px; border-radius: var(--sv-radius-lg);
    overflow: hidden; margin-bottom: 28px; background: var(--sv-bg-soft);
}
.sv-reader-cover img { width: 100%; height: 100%; object-fit: cover; }

.sv-reader-body { font-size: 14px; line-height: 1.7; color: #334155; }
.sv-reader-body h1 { font-size: 20px; font-weight: 800; color: var(--sv-text-main); margin: 24px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--sv-border-light); }
.sv-reader-body h2 { font-size: 18px; font-weight: 800; color: var(--sv-text-main); margin: 28px 0 14px; padding-bottom: 6px; border-bottom: 1px solid var(--sv-border-light); }
.sv-reader-body h3 { font-size: 15px; font-weight: 700; color: var(--sv-text-main); margin: 20px 0 10px; }
.sv-reader-body p { margin-bottom: 14px; }
.sv-reader-body ul, .sv-reader-body ol { padding-left: 22px; margin-bottom: 14px; }
.sv-reader-body li { margin-bottom: 6px; }
.sv-reader-body img { max-width: 100%; border-radius: var(--sv-radius-md); border: 1px solid var(--sv-border); margin: 14px 0; }
.sv-reader-body pre,
.sv-reader-body .dynamic-html-content pre {
    background: #f1f5f9; border: 1px solid var(--sv-border); border-radius: var(--sv-radius-md);
    padding: 16px; overflow-x: auto; font-size: 12px; line-height: 1.5; margin: 16px 0;
}
.sv-reader-body code { font-family: Consolas, "Courier New", monospace; font-size: 12px; }

.sv-reader-sidebar.sv-kb-panel {
    width: var(--sv-kb-reader-sidebar-width);
    min-width: var(--sv-kb-reader-sidebar-width);
    flex: 0 0 auto;
    flex-shrink: 0;
    border-left: 1px solid var(--sv-border);
    background: #fafafa;
    padding: 52px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-self: stretch;
    min-height: 100%;
    height: auto;
    max-height: none;
    overflow: hidden;
    box-sizing: border-box;
}
.sv-reader-sidebar.sv-kb-panel.is-collapsed {
    width: var(--sv-kb-panel-collapsed-width); min-width: var(--sv-kb-panel-collapsed-width);
    padding: 12px 8px;
}
.sv-reader-sidebar.sv-kb-panel.is-collapsed .sv-kb-panel-body { display: none; }
.sv-reader-sidebar.sv-kb-panel.is-pinned {
    position: relative;
    top: auto;
    align-self: stretch;
    min-height: 100%;
    height: auto;
    max-height: none;
    overflow: hidden;
}

.sv-meta-block { display: flex; flex-direction: column; gap: 6px; }
.sv-meta-label { font-size: 10px; font-weight: 800; color: var(--sv-text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.sv-meta-value { font-size: 12px; font-weight: 500; color: var(--sv-text-main); display: flex; align-items: center; gap: 8px; }

.sv-toc { display: flex; flex-direction: column; gap: 6px; border-left: 2px solid var(--sv-border); padding-left: 10px; }
.sv-toc-link { font-size: 11px; font-weight: 500; color: var(--sv-text-muted); text-decoration: none !important; transition: 0.2s; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-toc-link:hover, .sv-toc-link.active { color: var(--sv-primary); }

.sv-kb-indice { margin-bottom: 24px; }
.sv-kb-indice-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--sv-border); border-radius: var(--sv-radius-md); overflow: hidden; }
.sv-kb-indice-list li { border-bottom: 1px solid var(--sv-border); }
.sv-kb-indice-list li:last-child { border-bottom: none; }
.sv-kb-indice-list a {
    display: block; padding: 10px 14px; font-size: 13px; font-weight: 500;
    color: var(--sv-text-main); text-decoration: none !important; transition: 0.15s;
}
.sv-kb-indice-list a:hover { background: var(--sv-bg-soft); color: var(--sv-primary); }

/* Paginación dentro del wiki */
.sv-kb-app .pagination {
    margin: 20px 28px 24px;
    display: flex;
    justify-content: flex-end;
    float: none !important;
}

.ocultar { display: none !important; }

/* Fijo a la base visible del card de lectura (no al final del documento). */
.sv-kb-back-top-wrap {
    position: absolute;
    right: 18px;
    bottom: 18px;
    z-index: 50;
    width: auto;
    height: auto;
    margin: 0;
    pointer-events: none;
}
.sv-wiki-main:has(.sv-reader-sidebar.sv-kb-panel:not(.is-unpinned-hidden):not(.is-peek-open)) .sv-kb-back-top-wrap {
    right: calc(var(--sv-kb-reader-sidebar-width) + 26px);
}
.sv-kb-back-top {
    pointer-events: none;
    width: 42px;
    height: 42px;
    margin: 0;
    flex-shrink: 0;
    border-radius: 999px;
    border: 1px solid var(--sv-border);
    background: var(--sv-primary);
    color: #fff;
    box-shadow: var(--sv-shadow-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(8px);
    transition: 0.2s;
}
.sv-kb-back-top.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Ajustes dentro de section-body existente */
.section-body.contain-lg > .sv-kb-app,
.contain-lg > .sv-kb-app { margin-top: 0; }

@media (max-width: 1024px) {
    html.sv-kb-page,
    body.sv-kb-page,
    body.sv-kb-page.sv-layout-v2-active {
        height: auto;
        overflow: auto !important;
    }
    body.sv-kb-page #base,
    body.sv-kb-page.sv-layout-v2-active #base,
    body.sv-kb-page #content,
    body.sv-kb-page.sv-layout-v2-active #content,
    body.sv-kb-page #content > section,
    body.sv-kb-page #content > section > .section-body,
    body.sv-kb-page #content > section > .section-body > div[id$="UpdatePanel3"],
    body.sv-kb-page #content > section > .section-body > div[id*="UpdatePanel3"] {
        height: auto !important;
        max-height: none;
        display: block;
        overflow: visible;
        flex: none;
        min-height: 0;
    }
    .sv-kb-app {
        height: auto !important;
        max-height: none !important;
        min-height: 0;
        flex: none;
    }
    .sv-kb-app .sv-wiki-layout {
        height: auto;
        flex-direction: column;
    }
    .sv-main-title-row { flex-direction: column; align-items: stretch; flex-wrap: wrap; }
    .sv-list-toolbar { width: 100%; }
    .sv-list-toolbar .sv-list-sort { flex: 1; min-width: 0; }
    .sv-wiki-sidebar.sv-kb-panel:not(.is-peek-open):not(.is-unpinned-hidden),
    .sv-wiki-sidebar.sv-kb-panel.is-collapsed {
        width: 100%; min-width: 100%; max-width: 100%; height: auto; max-height: 320px;
    }
    .sv-wiki-sidebar.sv-kb-panel.is-collapsed .sv-kb-panel-body { display: flex; }
    .sv-wiki-main {
        height: auto;
        max-height: none;
    }
    .sv-kb-panel.is-unpinned-hidden {
        max-height: 0;
    }
    .sv-kb-panel.is-peek-open {
        position: fixed;
        top: 72px;
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        z-index: 200;
    }
    .sv-reader-layout {
        flex-direction: column;
        height: auto;
        min-height: 0;
    }
    .sv-reader-sidebar.sv-kb-panel:not(.is-peek-open):not(.is-unpinned-hidden),
    .sv-reader-sidebar.sv-kb-panel.is-collapsed { width: 100%; min-width: 100%; height: auto; border-left: none; border-top: 1px solid var(--sv-border); }
    .sv-reader-content { padding: 20px; }
}

/* Banner Layout2 — variante base de conocimiento (prototipo Samva Tech Info) */
.sv-page-banner.sv-banner-knowledge .sv-pb-icon.is-circle {
    border: none;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.35);
}

.sv-page-banner.sv-banner-knowledge .sv-pb-tabs > li.active > a,
.sv-page-banner.sv-banner-knowledge .sv-pb-tabs > li > a.active {
    color: var(--sv-kb-pinned-icon);
    border-bottom-color: var(--sv-kb-pinned-icon);
}
