/**
 * K线学堂 — 对齐站点原结构：page-title + 左列表 / 右说明
 * 不依赖 shop_index 固定高度裁剪；保留 #container 侧栏 padding
 */
html {
    min-width: 0 !important;
}

.kb-page {
    --kb-bg: #f0f2f5;
    --kb-paper: #ffffff;
    --kb-ink: #1c2430;
    --kb-muted: #5c6b7a;
    --kb-line: #d9dee6;
    --kb-brand: #c8161d;
    --kb-navy: #2c50a9;
    --kb-tab: #434343;
    --kb-up: #c8161d;
    --kb-down: #0a7a45;
    --kb-rev: #2c50a9;
    background: var(--kb-bg) !important;
    color: var(--kb-ink);
}

/* 只放开高度/滚动，不改 home.css 的 padding-left（侧栏偏移） */
.kb-page #container {
    box-sizing: border-box;
    height: auto !important;
    min-height: calc(100vh - 4rem);
    overflow: visible !important;
    background: var(--kb-bg);
    padding-bottom: 2.5rem;
}

.kb-page #container .page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--kb-paper);
    border-bottom: 1px solid var(--kb-line);
    margin: 0;
    padding-right: 1.25rem;
}

.kb-page-cta a {
    display: inline-block;
    background: #2c50a9;
    border: 1px solid #233f85;
    padding: 0.7rem 1rem;
    border-radius: 5px;
    color: #fff !important;
    font-size: 1rem;
    text-decoration: none !important;
    white-space: nowrap;
}

.kb-page-cta a:hover {
    opacity: 0.92;
}

/* 主体：左主右辅（与原 left-part / right-part 一致） */
.kb-body {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 0.83333rem 1.25rem 0 1.66667rem;
    box-sizing: border-box;
}

.kb-main {
    flex: 1 1 auto;
    min-width: 0;
}

.kb-side {
    flex: 0 0 28.33333rem;
    width: 28.33333rem;
    max-width: 100%;
}

.kb-side-inner {
    position: sticky;
    top: 4.5rem;
    background: var(--kb-paper);
    border: 1px solid var(--kb-line);
    border-radius: 4px;
    padding: 1rem 1.1rem 1.25rem;
}

.kb-side-title {
    margin: 0 0 0.75rem;
    padding-bottom: 0.65rem;
    border-bottom: 2px solid var(--kb-navy);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--kb-ink);
}

.kb-side-body {
    max-height: calc(100vh - 10rem);
    overflow: auto;
}

.kb-side-body p {
    margin: 0 0 0.85rem;
    font-size: 0.875rem;
    line-height: 1.75;
    color: var(--kb-muted);
}

.kb-side-body p:last-child {
    margin-bottom: 0;
}

/* Tab：沿用原深色条风格，宽度按 4 项均分 */
.kb-tabs.choose-list {
    display: flex;
    list-style: none;
    margin: 0 0 0 !important;
    padding: 0;
    width: 100%;
    height: 3.33333rem;
    background-color: var(--kb-tab);
}

.kb-tabs.choose-list > li {
    flex: 1 1 0;
    height: 3.33333rem;
    line-height: 1.25;
    color: #fff;
    text-align: center;
    font-size: 1.05rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
}

.kb-tabs.choose-list > li span {
    display: inline-block;
    min-width: 1.5em;
    padding: 0 0.35em;
    height: 1.35em;
    line-height: 1.35em;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 0.75rem;
}

.kb-tabs.choose-list > li:hover {
    background: rgba(255, 255, 255, 0.08);
}

.kb-tabs.choose-list > li.actived,
.kb-tabs.choose-list > li.is-active {
    background: var(--kb-navy);
}

.kb-content-box {
    position: relative;
    background: transparent;
    padding: 1rem 0 0;
    overflow: visible;
}

.kb-pane[hidden] {
    display: none !important;
}

.kb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

/* 形态卡片：接近原 dl 结构 */
.kb-item {
    position: relative;
    margin: 0;
    background: var(--kb-paper);
    border: 1px solid var(--kb-line);
    border-radius: 4px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.kb-item:hover {
    border-color: #b8c2d0;
    box-shadow: 0 6px 18px rgba(28, 36, 48, 0.08);
}

.kb-item-hit {
    position: absolute;
    inset: 0;
    z-index: 3;
    text-indent: -9999px;
}

.kb-item > dt {
    margin: 0;
    padding: 0.85rem 0.9rem 0.5rem;
    position: relative;
    z-index: 1;
}

.kb-item > dt h3 {
    margin: 0.35rem 0 0.2rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--kb-ink);
    line-height: 1.35;
}

.kb-item-fun {
    margin: 0;
    font-size: 0.75rem;
    color: var(--kb-muted);
    line-height: 1.4;
}

.kb-item > dd {
    margin: 0;
    position: relative;
    z-index: 1;
}

.kb-page .kb-item {
    margin-bottom: 0;
}

.kb-tag {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 2px;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.45;
}

.kb-tag--up { background: var(--kb-up); }
.kb-tag--down { background: var(--kb-down); }
.kb-tag--rev { background: var(--kb-rev); }

.kb-mini-chart {
    width: 100%;
    height: 180px;
    background: #f7f8fa;
    position: relative;
    border-top: 1px solid var(--kb-line);
    border-bottom: 1px solid var(--kb-line);
}

.kb-chart-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9aa5b1;
    font-size: 12px;
}

.kb-chart-placeholder.is-error {
    color: var(--kb-brand);
}

.kb-mini-chart.kb-mini-img {
    background: #f7f8fa;
}

.kb-mini-chart.kb-mini-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.kb-mini-chart.kb-mini-img.is-empty::after {
    content: '暂无示意图';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9aa5b1;
    font-size: 12px;
}

.kb-item-desc {
    margin: 0;
    padding: 0.75rem 0.9rem 0.9rem;
    font-size: 0.75rem;
    line-height: 1.65;
    color: var(--kb-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 1100px) {
    .kb-body {
        flex-direction: column;
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .kb-side {
        flex: none;
        width: 100%;
        order: -1;
    }

    .kb-side-inner {
        position: static;
    }

    .kb-side-body {
        max-height: none;
    }
}

@media (max-width: 640px) {
    .kb-tabs.choose-list {
        height: auto;
        flex-wrap: wrap;
    }

    .kb-tabs.choose-list > li {
        flex: 1 1 50%;
        font-size: 0.95rem;
    }

    .kb-grid {
        grid-template-columns: 1fr;
    }

    .kb-page #container .page-title {
        padding: 0.75rem 1rem;
    }
}
