/* =============================================================
   ChatMMM Ticker page (V2) — styles

   Scope note: this page also loads analysis-v2.css and reuses its
   primitives rather than restating them — `andetail-card`,
   `andetail-btn`, `andetail-dir`, `andetail-detail__loading/error`
   and the whole `andetail-chartcard__*` price-chart block. That
   block IS the shared price-chart visual language; duplicating it
   here would guarantee the two pages drift apart. Everything below
   is ticker-page-specific only.
   ============================================================= */
@layer components {

    .tkr-page {
        max-width: 1280px;
        margin: 0 auto;
        padding: 0 4px;
    }

    /* ---------- Identity header ---------- */
    .tkr-head {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-end;
        gap: 10px 16px;
        margin: 4px 0 14px;
    }
    .tkr-head__back {
        flex: 0 0 100%;
        display: inline-flex;
        align-items: center;
        gap: 7px;
        margin-bottom: 2px;
        font-size: var(--fs-xs);
        color: var(--text-muted);
        text-decoration: none;
        width: fit-content;
    }
    .tkr-head__back:hover { color: var(--text-primary); }

    .tkr-head__identity { min-width: 0; }
    .tkr-sym {
        display: block;
        font-family: 'JetBrains Mono', ui-monospace, monospace;
        font-size: 30px;
        font-weight: 700;
        letter-spacing: -0.02em;
        line-height: 1.1;
        color: var(--text-primary);
    }
    .tkr-name {
        margin-top: 3px;
        font-size: var(--fs-sm);
        font-weight: 500;
        color: var(--text-secondary);
    }
    .tkr-name:empty { display: none; }
    .tkr-industry {
        margin-top: 1px;
        font-size: var(--fs-xs);
        color: var(--text-muted);
    }
    .tkr-industry:empty { display: none; }

    /* Price block sits opposite the identity. */
    .tkr-head__price { margin-left: auto; text-align: right; }
    .tkr-price {
        font-family: 'JetBrains Mono', ui-monospace, monospace;
        font-size: 26px;
        font-weight: 700;
        line-height: 1.15;
        color: var(--text-primary);
    }
    .tkr-change {
        margin-top: 2px;
        font-family: 'JetBrains Mono', ui-monospace, monospace;
        font-size: var(--fs-xs);
        font-weight: 600;
        color: var(--text-muted);
    }
    .tkr-change--up   { color: var(--bull-strong, #16a34a); }
    .tkr-change--down { color: var(--bear-strong, #dc2626); }
    .tkr-change--flat { color: var(--text-muted); }
    .tkr-change__note {
        font-family: 'Inter', system-ui, sans-serif;
        font-weight: 500;
        color: var(--text-muted);
    }
    /* Price freshness (stale / last close) — quiet, never alarming. */
    .tkr-quote-note {
        margin-top: 3px;
        font-size: 10px;
        letter-spacing: 0.02em;
        color: var(--text-muted);
    }
    .tkr-quote-note:empty { display: none; }

    /* ---------- Stat tiles ---------- */
    /* auto-fit: the grid adapts to however many tiles actually have data,
       so a sparse ticker never shows an empty column. */
    .tkr-tiles {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 10px;
        margin-bottom: 14px;
    }
    .tkr-tiles:empty { display: none; }
    .tkr-tile {
        display: flex;
        flex-direction: column;
        gap: 3px;
        padding: 10px 12px;
        background: var(--surface-card);
        border: 1px solid var(--border-color);
        border-radius: 10px;
        min-width: 0;
    }
    .tkr-tile__label {
        font-size: 10px;
        font-weight: 600;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--text-muted);
    }
    .tkr-tile__value {
        font-size: var(--fs-sm);
        font-weight: 600;
        color: var(--text-primary);
        overflow-wrap: anywhere;
    }

    /* ---------- Disclaimer (tone mirrors .perf-disclaimer) ---------- */
    .tkr-disclaimer {
        margin: 0 0 14px;
        display: flex;
        gap: 8px;
        align-items: baseline;
        font-size: var(--fs-xs);
        line-height: 1.5;
        color: var(--text-muted);
    }
    .tkr-disclaimer i { color: var(--text-muted); opacity: 0.7; }
    .tkr-disclaimer a { color: var(--text-secondary); text-decoration: underline; }

    /* ---------- Track record ---------- */
    .tkr-record__intro {
        margin: -2px 0 12px;
        font-size: var(--fs-xs);
        color: var(--text-muted);
        line-height: 1.5;
    }
    .tkr-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .tkr-item {
        display: grid;
        grid-template-columns: 92px minmax(0, 1fr);
        gap: 4px 14px;
        padding: 12px 14px;
        background: var(--surface-card);
        border: 1px solid var(--border-color);
        border-left: 3px solid var(--border-color);
        border-radius: 10px;
    }
    .tkr-item[data-dir="bullish"] { border-left-color: var(--bull-strong, #16a34a); }
    .tkr-item[data-dir="bearish"] { border-left-color: var(--bear-strong, #dc2626); }

    .tkr-item__date {
        grid-row: 1 / span 2;
        font-size: var(--fs-xs);
        font-weight: 600;
        color: var(--text-secondary);
        line-height: 1.35;
    }
    .tkr-item__ago {
        display: block;
        margin-top: 2px;
        font-weight: 400;
        color: var(--text-muted);
    }

    .tkr-item__main { min-width: 0; }
    .tkr-item__top {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
        margin-bottom: 4px;
    }
    .tkr-item__headline {
        display: block;
        font-size: var(--fs-sm);
        font-weight: 600;
        line-height: 1.4;
        color: var(--text-primary);
        text-decoration: none;
    }
    a.tkr-item__headline:hover { color: var(--brand-500); text-decoration: underline; }

    /* "Mentioned in" — this ticker was an affected company, not the subject. */
    .tkr-item__role {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 1px 7px;
        border-radius: 999px;
        font-size: 10px;
        font-weight: 600;
        letter-spacing: 0.03em;
        background: var(--surface-sunken);
        border: 1px solid var(--border-color);
        color: var(--text-muted);
    }
    .tkr-item__lock {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 1px 7px;
        border-radius: 999px;
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.04em;
        background: color-mix(in srgb, var(--brand-500) 14%, transparent);
        border: 1px solid color-mix(in srgb, var(--brand-500) 32%, transparent);
        color: var(--brand-500);
        text-decoration: none;
    }

    /* Movement strip — the actual outcome of one call. */
    .tkr-move {
        grid-column: 2;
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        gap: 4px 16px;
        margin-top: 6px;
        padding-top: 8px;
        border-top: 1px dashed var(--border-color);
    }
    .tkr-move__leg {
        display: inline-flex;
        align-items: baseline;
        gap: 5px;
        font-size: var(--fs-xs);
    }
    .tkr-move__label {
        font-size: 10px;
        font-weight: 600;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: var(--text-muted);
    }
    .tkr-move__value {
        font-family: 'JetBrains Mono', ui-monospace, monospace;
        font-weight: 600;
        color: var(--text-primary);
    }
    .tkr-move__pct {
        font-family: 'JetBrains Mono', ui-monospace, monospace;
        font-weight: 600;
    }
    .tkr-move__pct--up   { color: var(--bull-strong, #16a34a); }
    .tkr-move__pct--down { color: var(--bear-strong, #dc2626); }
    .tkr-move__pct--flat { color: var(--text-muted); }

    /* Lagging feed — named, not passed off as a live tick. */
    .tkr-move__stale {
        padding: 0 5px;
        border-radius: 999px;
        font-size: 9px;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        background: var(--surface-sunken);
        border: 1px solid var(--border-color);
        color: var(--text-muted);
    }

    /* No tracked position on this analysis — stated, never faked with zeros. */
    .tkr-move--none {
        font-size: var(--fs-xs);
        color: var(--text-muted);
        font-style: italic;
    }

    /* ---------- Empty state ---------- */
    .tkr-empty {
        text-align: center;
        padding: 44px 16px;
        background: var(--surface-card);
        border: 1px solid var(--border-color);
        border-radius: 12px;
    }
    .tkr-empty i {
        font-size: 26px;
        color: var(--text-muted);
        opacity: 0.55;
    }
    .tkr-empty h3 {
        margin: 12px 0 6px;
        font-size: var(--fs-md);
        font-weight: 600;
        color: var(--text-primary);
    }
    .tkr-empty p {
        margin: 0 auto;
        max-width: 46ch;
        font-size: var(--fs-xs);
        line-height: 1.6;
        color: var(--text-muted);
    }
    .tkr-empty__actions { margin-top: 16px; }

    /* ---------- Narrow screens ---------- */
    @media (max-width: 640px) {
        .tkr-head__price { margin-left: 0; text-align: left; }
        .tkr-sym { font-size: 26px; }
        .tkr-price { font-size: 22px; }
        .tkr-item {
            grid-template-columns: minmax(0, 1fr);
        }
        .tkr-item__date { grid-row: auto; }
        .tkr-move { grid-column: 1; }
    }
}
.tkr-page { max-width: 1120px; }
.tkr-overview { max-width: 70ch; margin: 0 0 20px; color: var(--text-secondary); font-size: .95rem; line-height: 1.6; }
.tkr-content-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 320px); gap: 28px; align-items: start; }
.tkr-content-grid:has(#cmmTkrProfile:empty) { grid-template-columns: minmax(0, 1fr); }
.tkr-content-grid > * { min-width: 0; }
.tkr-record__heading, .tkr-focus__top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.tkr-record__heading { margin: 22px 0 12px; min-height: 28px; }
.tkr-record__heading h2, .tkr-profile h2 { margin: 0; font-size: 1.05rem; }
.tkr-record__heading > span, .tkr-focus__source, .tkr-profile__source { font-size: .75rem; color: var(--text-secondary); }
.tkr-list { display: grid; gap: 0; }
.tkr-focus { border: 1px solid color-mix(in srgb, var(--brand-500) 55%, var(--border-color)); border-radius: 16px; padding: 16px 20px; margin-bottom: 8px; background: var(--surface-card); }
.tkr-focus__top { color: var(--text-secondary); font-size: .8rem; }
.tkr-focus__top button { margin-left: auto; background: none; border: 0; color: inherit; width: 44px; min-height: 44px; cursor: pointer; border-radius: 10px; }
.tkr-focus__read { display: flex; align-items: center; gap: 10px; }
.tkr-focus__read small, .tkr-focus__read strong { display: block; }
.tkr-focus__read small { font-size: .65rem; margin-bottom: 2px; }
.tkr-focus__read strong { font-size: .9rem; color: var(--text-primary); }
.tkr-focus__takeaway { font-size: 1.1rem; line-height: 1.5; margin: 10px 0; overflow-wrap: anywhere; }
.tkr-focus__source { margin: 8px 0; }
.tkr-focus__source a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.tkr-access { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.tkr-focus a:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 3px; }
.tkr-story-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0; background: var(--surface-sunken); color: var(--text-secondary); }
.tkr-story-icon[data-dir="bullish"] { color: var(--bull-strong); background: color-mix(in srgb, var(--bull-strong) 10%, transparent); }
.tkr-story-icon[data-dir="bearish"] { color: var(--bear-strong); background: color-mix(in srgb, var(--bear-strong) 10%, transparent); }
.tkr-story-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 4px; min-height: 64px; border: 0; border-bottom: 1px solid var(--border-color); background: none; color: var(--text-primary); font: inherit; font-size: .85rem; cursor: pointer; }
.tkr-story-row__text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tkr-story-row__text > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }
.tkr-story-row small { display: block; margin-top: 4px; font-size: .72rem; color: var(--text-secondary); }
.tkr-story-chevron { font-size: .65rem; color: var(--text-muted); }
.tkr-focus__bottom { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-top: 14px; }
.tkr-movement { display: flex; align-items: center; gap: 16px; min-width: 0; }
.tkr-movement__label { display: block; color: var(--text-secondary); font-size: .7rem; margin-bottom: 3px; }
.tkr-movement strong { font: 600 1.25rem 'JetBrains Mono', monospace; }
.tkr-movement__empty { color: var(--text-secondary); font-size: .8rem; }
.tkr-spark { width: 85px; height: 34px; }
.tkr-focus__dive button { display: inline-flex; width: auto; margin: 0; padding: 10px 12px; min-height: 44px; border-radius: 10px; font-size: .8rem; background: var(--surface-sunken); }
.tkr-details { font-size: .75rem; color: var(--text-secondary); }
.tkr-details > summary { width: fit-content; padding: 12px 0; cursor: pointer; }
.tkr-details[open] > summary { color: var(--text-primary); }
.tkr-details .tkr-move { margin: 0 0 12px; padding-top: 12px; }
.tkr-disclaimer { display: block; margin: 6px 0 0; }
.tkr-disclaimer > span { display: block; padding-bottom: 12px; }
.tkr-history-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.tkr-history-actions button { min-height: 44px; font-size: .78rem; }
.tkr-profile { margin-top: 22px; }
.tkr-profile h2 { min-height: 28px; display: flex; align-items: center; margin-bottom: 12px; }
.tkr-facts-panel { padding: 4px 16px 0; border: 1px solid var(--border-color); border-radius: 16px; background: var(--surface-card); }
.tkr-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.tkr-fact { padding: 16px 8px; min-width: 0; overflow-wrap: anywhere; }
.tkr-fact:last-child:nth-child(odd) { grid-column: 1 / -1; }
.tkr-fact dt { display: flex; align-items: center; gap: 6px; font-size: .7rem; color: var(--text-secondary); }
.tkr-fact dt i { color: var(--text-muted); }
.tkr-fact dd { margin: 8px 0 0; font-size: .95rem; font-weight: 600; line-height: 1.35; }
.tkr-range { padding: 16px 8px; border-top: 1px solid var(--border-color); font-size: .75rem; color: var(--text-secondary); }
.tkr-range__track { height: 5px; margin: 18px 6px 12px; background: color-mix(in srgb, var(--brand-500) 16%, transparent); border-radius: 3px; position: relative; }
.tkr-range__track > span { position: absolute; width: 2px; height: 17px; top: -6px; margin-left: -1px; background: var(--brand-500); border-radius: 0; }
.tkr-range__ends { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.tkr-story-row:focus-visible, .tkr-focus button:focus-visible, .tkr-history-actions button:focus-visible, .tkr-details > summary:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 3px; }
/* Match existing dark-theme market colors and override its global span reset. */
html.theme-dark .tkr-page { --bull-strong: #86efac; --bear-strong: #f87171; }
html.theme-dark .tkr-movement__label, html.theme-dark .tkr-focus__source,
html.theme-dark .tkr-fact dt, html.theme-dark .tkr-profile__source { color: var(--text-secondary); }
@media (max-width: 850px) { .tkr-content-grid { grid-template-columns: minmax(0, 1fr); gap: 0; } .tkr-focus { padding: 12px 16px; } }
@media (max-width: 480px) { .tkr-head { flex-wrap: wrap; gap: 14px; } .tkr-head__price { margin-left: auto; } .tkr-move { flex-wrap: wrap; } }
/* Allow the shell's search field to shrink instead of widening this page. */
body[data-cmm-page="ticker"] .cmm-topbar { min-width: 0; }
body[data-cmm-page="ticker"] .cmm-topbar__search { min-width: 0; flex: 1; }
body[data-cmm-page="ticker"] .cmm-topbar__search input { min-width: 0; width: 100%; }
@media (max-width: 640px) {
    body[data-cmm-page="ticker"] .cmm-topbar { gap: 8px; }
    body[data-cmm-page="ticker"] .cmm-topbar__search kbd { display: none; }
    body[data-cmm-page="ticker"] .cmm-breadcrumbs__sep,
    body[data-cmm-page="ticker"] .cmm-breadcrumbs__crumb.is-current { display: none; }
    .tkr-move__leg { flex-wrap: wrap; }
}

.tkr-range__price { display: block; margin-top: 8px; font-size: 14px; }
.tkr-range__ends { flex-wrap: wrap; gap: 10px; }
.tkr-profile__attribution { padding: 12px 0; border-top: 1px solid var(--border-color); }
.tkr-profile__attribution p { margin: 4px 0; }
.tkr-focus__event { font-size: 15px; font-weight: 600; line-height: 1.5; margin: 16px 0 8px; }
