/* News page — card-stack feed with infinite scroll.
   Reuses agi's design tokens (--color-text, --color-border, --color-bg-elev,
   --color-primary) so dark/light mode follows the rest of the app. Layout is
   intentionally narrower than the knowledge grid because a long-form list
   reads better in a single column.
*/

.news-page {
    max-width: 820px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 4rem;
}

.news-toolbar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 .25rem 1rem;
    color: var(--color-text-secondary);
    font-size: .875rem;
}

.news-toolbar-count {
    font-weight: 600;
    color: var(--color-text);
}

.news-toolbar-hint {
    color: var(--color-text-muted);
}

.news-list {
    display: flex;
    flex-direction: column;
    gap: .85rem;
}

.news-card {
    display: block;
    padding: 1rem 1.15rem;
    background: var(--color-bg-elev, #fff);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}

.news-card:hover {
    border-color: var(--color-primary, #2563eb);
    box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.04);
}

.news-card:active {
    transform: translateY(1px);
}

.news-card-head {
    display: flex;
    align-items: baseline;
    gap: .65rem;
    margin-bottom: .4rem;
    font-size: .8rem;
    color: var(--color-text-muted);
}

.news-card-source {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--color-text-secondary);
}

.news-card-symbols {
    display: inline-flex;
    flex-wrap: wrap;
    gap: .25rem;
}

.news-card-symbol {
    padding: 1px 6px;
    background: var(--color-bg-subtle, #f3f4f6);
    border-radius: 4px;
    font-size: .7rem;
    color: var(--color-text-secondary);
}

.news-card-date {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

.news-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--color-text);
    margin: 0 0 .35rem;
}

.news-card-preview {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: .9rem;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-loading,
.news-sentinel {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: .875rem;
}

.news-sentinel { min-height: 1px; }

.news-empty {
    margin-top: 3rem;
    text-align: center;
    color: var(--color-text-muted);
}

@media (max-width: 640px) {
    .news-page { padding: 1rem .75rem 3rem; }
    .news-card { padding: .85rem .95rem; }
    .news-card-title { font-size: .98rem; }
    .news-card-preview { -webkit-line-clamp: 2; font-size: .85rem; }
}

/* ─── Home (chat) page summary block ───────────────────────────────────────
   Embedded BELOW the chat example cards on the new-chat landing. Visually
   demoted from the main feed (smaller cards, denser spacing) so it doesn't
   compete with the chat input.

   No max-width / horizontal padding — we want this block to align exactly
   with .chat-examples-wrap above. The example wrapper sets its own width
   from the chat layout container; if we constrain max-width here, our
   block reads as slightly narrower than the examples and the visual
   alignment breaks.
*/

.home-news-summary {
    margin: 1.75rem 0 0;
}

.home-news-summary-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: .75rem;
    padding: 0 .25rem;
}

.home-news-summary-title {
    font-size: .95rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.home-news-summary-time {
    font-size: .8rem;
    color: var(--color-text-muted);
}

.home-news-summary-link {
    font-size: .8rem;
    color: var(--color-primary, #2563eb);
    text-decoration: none;
}

.home-news-summary-link:hover { text-decoration: underline; }

/* Single-column stack — mirrors the alpha news service. Multi-column
   makes scanning hard (the eye has to z-pattern across categories), and
   expand panels (`.home-news-summary-related`) would shove neighboring
   columns down inconsistently. One narrow column = a clear top-to-bottom
   reading path that matches the article feed on /news. */
.home-news-summary-grid {
    display: flex;
    flex-direction: column;
    gap: .65rem;
}

.home-news-summary-card {
    padding: .75rem .85rem;
    background: var(--color-bg-elev, #fff);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 10px;
}

.home-news-summary-cat {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--color-primary, #2563eb);
    margin-bottom: .35rem;
}

.home-news-summary-items {
    margin: 0;
    padding-left: 1rem;
    font-size: .85rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.home-news-summary-items li { margin-bottom: .25rem; }
.home-news-summary-items li:last-child { margin-bottom: 0; }

/* Inline item layout — text + count badge inline so the badge sits on the
   same line as the summary line, not below it. */
.home-news-summary-item {
    display: flex;
    align-items: baseline;
    gap: .35rem;
    flex-wrap: wrap;
    padding: 1px 4px;
    margin-left: -4px;       /* visually align with non-expandable items */
    border-radius: 6px;
    transition: background .1s ease;
}

/* Expandable rows: full-row click target. Cursor + subtle hover bg make the
   affordance obvious without a heavy border. */
.home-news-summary-item--expandable {
    cursor: pointer;
}

.home-news-summary-item--expandable:hover {
    background: var(--color-bg-subtle, #f3f4f6);
}

.home-news-summary-item--expandable:focus-visible {
    outline: 2px solid var(--color-primary, #2563eb);
    outline-offset: 1px;
}

.home-news-summary-item-text { flex: 1 1 auto; min-width: 0; }

.home-news-summary-badge {
    display: inline-flex;
    align-items: center;
    gap: .15rem;
    padding: 1px 6px;
    background: var(--color-bg-subtle, #f3f4f6);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 999px;
    font-size: .72rem;
    color: var(--color-text-secondary);
    line-height: 1.4;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
}

/* Hover on the row also styles the badge — single visual unit. */
.home-news-summary-item--expandable:hover .home-news-summary-badge {
    background: var(--color-bg-elev, #fff);
    border-color: var(--color-primary, #2563eb);
    color: var(--color-primary, #2563eb);
}

.home-news-summary-item--expandable[aria-expanded="true"] .home-news-summary-badge {
    background: var(--color-primary, #2563eb);
    border-color: var(--color-primary, #2563eb);
    color: #fff;
}

.home-news-summary-badge-count { font-weight: 600; }

.home-news-summary-related {
    flex-basis: 100%;
    margin: .35rem 0 0;
    padding: .45rem .55rem;
    background: var(--color-bg-subtle, #f8fafc);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 8px;
    list-style: none;
}

.home-news-summary-related li { margin-bottom: .25rem; }
.home-news-summary-related li:last-child { margin-bottom: 0; }

.home-news-summary-related-link {
    display: flex;
    flex-direction: column;
    gap: 1px;
    text-decoration: none;
    color: inherit;
    padding: 3px 4px;
    border-radius: 5px;
}

.home-news-summary-related-link:hover {
    background: var(--color-bg-elev, #fff);
}

.home-news-summary-related-title {
    font-size: .8rem;
    font-weight: 500;
    color: var(--color-text);
    line-height: 1.35;
}

.home-news-summary-related-meta {
    font-size: .7rem;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}

.home-news-summary-related-empty {
    color: var(--color-text-muted);
    font-size: .75rem;
    font-style: italic;
}

.home-news-summary-empty {
    padding: .75rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: .85rem;
    border: 1px dashed var(--color-border, #e5e7eb);
    border-radius: 10px;
}
