.news-graph-legend {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: var(--color-bg-title);
    border: 1px solid var(--color-border-primary);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 220px;
}

.news-graph-legend-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0;
}

.news-graph-legend-subtitle {
    font-size: 12px;
    font-weight: 400;
    color: var(--color-text-tertiary);
    margin: 0;
    padding: 2px 0;
}

.news-graph-legend-divider {
    width: 100%;
    height: 1px;
    background: var(--color-border-primary);
}

.news-graph-legend-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.news-graph-legend-section-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.news-graph-legend-section-note {
    font-size: 11px;
    font-weight: 400;
    color: var(--color-text-tertiary);
    margin: 0;
}

.news-graph-legend-note {
    font-size: 11px;
    font-weight: 400;
    color: var(--color-text-tertiary);
    margin: 0;
    font-style: italic;
}

.legend-shape {
    display: inline-block;
    flex-shrink: 0;
}

.legend-shape--sphere {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-text-tertiary);
}

.legend-shape--cone {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 12px solid var(--color-text-tertiary);
}

.news-graph-legend-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.news-graph-legend-items li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-primary);
}

.news-graph-legend-items .legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}


.news-graph-overview {
    display: none;
    flex-direction: column;
    gap: 12px;
    background: var(--color-bg-block);
    border: 1px solid var(--color-border-primary);
    border-radius: 16px;
    padding: 20px 16px;
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    position: relative;
}

body.news-graph-active .news-graph-overview {
    display: flex;
}

body.news-graph-active #right-container {
    display: none;
}

.news-graph-overview.is-market-overview::before {
    content: 'AI';
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--color-text-tertiary);
    background: var(--color-button-secondary);
    border: 1px solid var(--color-border-primary);
    border-radius: 4px;
    padding: 1px 6px;
    line-height: 1.6;
    pointer-events: none;
    user-select: none;
    z-index: 1;
}

.news-graph-overview-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0;
}

.news-graph-overview-text {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--color-text-primary);
    margin: 0;
}

.news-graph-detail-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
    color: var(--color-text-primary);
}

.news-graph-detail-columns {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.news-graph-detail-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.news-graph-column-title {
    font-size: 15px;
    color: var(--color-text-tertiary);
    margin: 0;
    font-weight: 500;
}

.news-graph-stocks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.news-graph-stocks-list .asset-pill {
    background: var(--color-button-secondary);
    border: 1px solid var(--color-border-primary);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--color-text-primary);
    font-weight: 600;
}

.news-graph-stocks-list .positive {
    color: #10b981;
    margin-left: 8px;
}

.news-graph-stocks-list .negative {
    color: #ef4444;
    margin-left: 8px;
}

.news-graph-news-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.news-pill {
    background: var(--color-button-secondary);
    border: 1px solid var(--color-border-primary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--color-text-primary);
    text-decoration: none;
    font-weight: 500;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    max-width: 100%;
    transition: background 0.2s ease;
    text-align: left;
    line-height: 1.4;
}

.news-pill:hover {
    background: var(--color-button-primary);
}

.news-graph-news-list--inline {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
}

.news-pill--ticker-price {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.news-pill--ticker-price .ticker-price-symbol {
    font-weight: 600;
}

.news-pill--no-data {
    justify-content: center;
}

.rel-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-tertiary);
    background: var(--color-button-secondary);
    border-radius: 4px;
    padding: 1px 5px;
    margin-right: 6px;
    vertical-align: middle;
    line-height: 1.6;
}

.news-graph-summary-title {
    font-size: 20px;
    color: var(--color-text-primary);
    margin: 8px 0;
    font-weight: 600;
}

.news-graph-detail-summary {
    position: relative;
    padding-top: 8px;
}

.news-graph-detail-summary::before {
    content: 'AI';
    position: absolute;
    top: 12px;
    right: 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--color-text-tertiary);
    background: var(--color-button-secondary);
    border: 1px solid var(--color-border-primary);
    border-radius: 4px;
    padding: 1px 6px;
    line-height: 1.6;
    pointer-events: none;
    user-select: none;
}

.news-graph-toolbar {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px 16px;
    z-index: 20;
}

.ng-view-toggle,
.ng-tool-btn {
    flex: 1;
}

.ng-view-toggle {
    display: flex;
    background-color: var(--color-button-secondary);
    border-radius: 8px;
    padding: 2px;
    height: 33px;
}

.ng-variant {
    flex: 1;
    height: 29px;
    border-radius: 6px;
    border: none;
    outline: none;
    background: transparent;
    color: var(--color-text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: 200ms;
    padding: 0 14px;
    white-space: nowrap;
}

.ng-variant.active {
    background-color: var(--color-icon-toggle-active);
    color: var(--color-text-cta);
}

.ng-variant:hover:not(.active) {
    opacity: 0.9;
}

.ng-tool-btn {
    height: 33px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--color-button-primary);
    color: var(--color-text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: 250ms;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ng-tool-btn:hover {
    border-color: var(--color-border-hover);
}

.ng-tool-btn.active {
    background: var(--color-button-accent);
    color: var(--color-text-button-accent);
    border-color: transparent;
}

.ng-tool-btn.active:hover {
    background: var(--color-button-accent-hover, var(--color-button-accent));
    border-color: transparent;
}

@media (max-width: 768px) {
    .news-graph-legend {
        right: 16px;
        top: auto;
        bottom: 70px;
        transform: none;
        width: calc(100% - 32px);
        max-width: 280px;
        max-height: 200px;
        overflow-y: auto;
        padding: 10px 12px;
        font-size: 12px;
    }
    .news-graph-legend-title {
        font-size: 13px;
    }
    .news-graph-legend-section-title {
        font-size: 12px;
    }
    .news-graph-legend-items li {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .news-graph-toolbar {
        gap: 8px;
        padding: 0 8px 8px;
    }
    .ng-tool-btn, .ng-variant {
        font-size: 12px;
        padding: 0 8px;
        height: 28px;
    }
    .ng-view-toggle {
        height: 28px;
    }
}

html.desktop-scaled-page.desktop-portrait-accepted.desktop-portrait body.news-graph-active #main-block #news-graph-legend {
    left: 50%;
    top: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%);
    width: 280px;
    max-height: none;
    overflow: visible;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background: var(--color-bg-page);
    border-radius: 16px;
    padding: 16px 20px;
}

html.desktop-scaled-page.desktop-portrait-accepted.desktop-portrait body.news-graph-active #main-block .desktop-chart-panel {
    display: none;
}

html.desktop-scaled-page.desktop-portrait-accepted.desktop-portrait body.news-graph-active #main-block {
    height: calc(100dvh - var(--desktop-header-stack));
    max-height: calc(100dvh - var(--desktop-header-stack));
    padding-bottom: 0;
}

html.desktop-scaled-page.desktop-portrait-accepted.desktop-portrait body.news-graph-active #main-block #news-graph-toolbar {
    margin-bottom: 16px;
}

html.desktop-scaled-page.desktop-portrait-accepted.desktop-portrait body.news-graph-active #main-block #news-graph-close-btn {
    display: flex;
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    background: var(--color-button-secondary);
    border: 1px solid var(--color-border-primary);
    z-index: 1000;
    cursor: pointer;
    pointer-events: auto;
}

html.desktop-scaled-page.desktop-portrait-accepted.desktop-portrait body.news-graph-active #main-block #news-graph-close-btn:hover {
    border-color: var(--color-border-hover);
}

html.desktop-scaled-page.desktop-portrait-accepted.desktop-portrait body.news-graph-active #main-block #news-graph-close-btn img {
    width: 18px;
    height: 18px;
    display: block;
}

body.cb-light #news-graph-close-btn img,
body.light #news-graph-close-btn img {
    filter: invert(1);
}

html.desktop-scaled-page.desktop-portrait-accepted.desktop-portrait body.news-graph-active #main-block .chart-wrapper {
    pointer-events: auto;
}

