/* 题材演进：跟站点 token，不另起皮肤 */
body.tev-page {
    --sa-topbar-max-width: 1680px;
    --tev-label-col: 132px;
    --tev-date-col: 44px;
    background: var(--bg-color);
    color: var(--text-primary);
}

@media (min-width: 1680px) {
    body.tev-page { --sa-topbar-max-width: 1720px; }
}

@media (min-width: 1920px) {
    body.tev-page { --sa-topbar-max-width: 1840px; }
}

@media (max-width: 720px) {
    body.tev-page {
        --sa-topbar-max-width: 100%;
        --tev-label-col: 92px;
        --tev-date-col: 44px;
    }
}

body.tev-no-scroll { overflow: hidden; }

.tev-shell {
    padding-top: 16px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
}

.tev-top-link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 13px;
    padding: 0 8px;
    border-radius: 8px;
}

.tev-top-link:hover,
.tev-top-link:focus-visible {
    background: var(--primary-light);
    outline: none;
}

.tev-layout {
    display: grid;
    grid-template-columns: 268px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.tev-ledger,
.tev-panel,
.tev-stat {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
}

.tev-ledger {
    position: sticky;
    top: calc(var(--sa-topbar-height, 52px) + 12px);
    max-height: calc(100vh - var(--sa-topbar-height, 52px) - 24px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tev-ledger-head,
.tev-panel-head,
.tev-drawer-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 12px 14px 8px;
}

.tev-panel-head > div,
.tev-drawer-head > div {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.tev-ledger-head h2,
.tev-panel-head h2,
.tev-drawer-head h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.tev-kicker {
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--primary-color);
    font-family: var(--font-family-number);
    flex: none;
}

.tev-muted,
.tev-hint,
.tev-status {
    color: var(--text-tertiary);
    font-size: 12px;
    margin: 0;
}

.tev-status:empty { display: none; }

.tev-status {
    margin: 0 0 10px;
}

.tev-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-tertiary);
    flex: none;
}

.tev-legend i {
    display: block;
    width: 64px;
    height: 6px;
    border-radius: 99px;
    background: linear-gradient(90deg, rgba(26, 86, 167, 0.22), var(--primary-color));
}

.tev-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 12px 10px;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    min-height: 40px;
}

.tev-search input {
    border: 0;
    background: transparent;
    width: 100%;
    font: inherit;
    color: inherit;
    outline: none;
    min-height: 40px;
}

.tev-ledger-list {
    overflow: auto;
    padding: 0 8px 12px;
    -webkit-overflow-scrolling: touch;
}

.tev-day {
    width: 100%;
    text-align: left;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 10px;
    padding: 10px 10px 10px 12px;
    margin-bottom: 4px;
    cursor: pointer;
    color: inherit;
    min-height: 44px;
}

.tev-day:hover,
.tev-day:focus-visible {
    background: var(--primary-light);
    outline: none;
}

.tev-day.is-active {
    border-color: transparent;
    background: var(--primary-light);
    box-shadow: inset 3px 0 0 var(--primary-color);
}

.tev-day-meta {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-family-number);
    font-size: 13px;
    margin-bottom: 6px;
    font-variant-numeric: tabular-nums;
}

.tev-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tev-chip {
    font-size: 12px;
    line-height: 1.4;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--bg-color);
    color: var(--text-secondary);
}

.tev-chip.is-hot {
    background: var(--primary-color);
    color: #fff;
}

.tev-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.tev-stat {
    padding: 12px 14px 11px;
    min-width: 0;
}

.tev-stat span {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.tev-stat strong {
    display: block;
    font-size: 26px;
    line-height: 1.1;
    font-weight: 650;
    font-family: var(--font-family-number);
    font-variant-numeric: tabular-nums;
    color: var(--primary-active);
    letter-spacing: -0.02em;
}

.tev-stat em {
    display: block;
    margin-top: 4px;
    font-style: normal;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tev-panel { margin-bottom: 12px; }

.tev-matrix-wrap {
    overflow: auto;
    max-height: min(520px, 62vh);
    padding: 0 4px 10px 0;
    -webkit-overflow-scrolling: touch;
}

.tev-matrix {
    display: grid;
    gap: 2px 0;
    min-width: max(100%, 640px);
    align-items: center;
}

.tev-matrix-label,
.tev-matrix-date,
.tev-matrix-corner {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--card-bg);
}

.tev-matrix-corner {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 4;
    height: 28px;
}

.tev-matrix-label {
    position: sticky;
    left: 0;
    z-index: 2;
    text-align: left;
    padding: 0 8px 0 12px;
    cursor: pointer;
    border: 0;
    font: inherit;
    min-height: 32px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow: 6px 0 8px -8px rgba(15, 23, 42, 0.35);
}

.tev-matrix-label.is-on {
    color: var(--primary-color);
    font-weight: 650;
}

.tev-matrix-date {
    position: sticky;
    top: 0;
    z-index: 3;
    text-align: center;
    font-family: var(--font-family-number);
    font-size: 11px;
    height: 28px;
    line-height: 28px;
    font-variant-numeric: tabular-nums;
}

.tev-matrix-date.is-on,
.tev-bubble.is-col,
.tev-matrix-date.is-col {
    background: var(--primary-light);
    color: var(--primary-active);
    font-weight: 650;
}

.tev-bubble {
    width: 100%;
    height: 32px;
    border: 0;
    background: transparent;
    cursor: default;
    border-radius: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

button.tev-bubble { cursor: pointer; }

.tev-bubble span {
    display: block;
    border-radius: 999px;
    background: var(--primary-color);
    min-width: 8px;
    min-height: 8px;
}

.tev-bubble.is-selected span {
    outline: 2px solid var(--primary-active);
    outline-offset: 2px;
}

.tev-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
    padding: 0 12px 14px;
}

.tev-card {
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 12px 12px 10px;
    background: var(--bg-secondary);
    text-align: left;
    cursor: pointer;
    color: inherit;
    min-height: 44px;
}

.tev-card:hover,
.tev-card:focus-visible {
    border-color: var(--primary-hover);
    outline: none;
}

.tev-card.is-focus {
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--primary-color);
}

.tev-card-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 6px;
}

.tev-card h3 {
    margin: 0;
    font-size: 15px;
    line-height: 1.35;
}

.tev-badge {
    flex: none;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary-active);
    font-family: var(--font-family-number);
}

.tev-reason {
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-secondary);
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tev-stocks {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tev-stock {
    font-size: 12px;
    text-decoration: none;
    color: var(--text-primary);
    background: var(--card-bg);
    border-radius: 6px;
    padding: 4px 6px;
    border: 1px solid var(--border-light);
    min-height: 28px;
}

.tev-stock .up { color: var(--up-color); font-family: var(--font-family-number); }
.tev-stock .down { color: var(--down-color); font-family: var(--font-family-number); }

.tev-drawer[hidden] { display: none; }

.tev-drawer {
    position: fixed;
    inset: 0;
    z-index: 140;
}

.tev-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.38);
}

.tev-drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: min(440px, 100%);
    background: var(--card-bg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tev-sheet-handle { display: none; }

.tev-drawer-body {
    overflow: auto;
    padding: 0 16px 24px;
    -webkit-overflow-scrolling: touch;
}

.tev-drawer-body > p:first-child {
    margin: 4px 0 8px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-secondary);
}

.tev-icon-btn {
    border: 0;
    background: var(--bg-color);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    flex: none;
    color: var(--text-secondary);
}

.tev-icon-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.tev-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tev-table th,
.tev-table td {
    text-align: left;
    padding: 10px 4px;
    border-bottom: 1px solid var(--border-light);
    font-variant-numeric: tabular-nums;
}

.tev-table a { color: var(--primary-color); text-decoration: none; }

@media (max-width: 960px) {
    .tev-shell { padding-top: 10px; }

    .tev-layout {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .tev-ledger {
        position: sticky;
        top: var(--sa-topbar-height, 52px);
        z-index: 30;
        max-height: none;
        border-radius: 12px;
    }

    .tev-ledger-list {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        padding: 0 10px 12px;
    }

    .tev-day {
        flex: 0 0 196px;
        width: 196px;
        margin: 0;
        scroll-snap-align: start;
        background: var(--bg-secondary);
        border-color: var(--border-light);
    }

    .tev-chip:nth-child(n + 3) { display: none; }

    .tev-stats { grid-template-columns: 1fr 1fr; }

    .tev-stat strong { font-size: 22px; }

    .tev-matrix { min-width: 720px; }

    .tev-matrix-wrap { max-height: 46vh; }
}

@media (max-width: 720px) {
    .tev-top-link {
        min-height: 44px;
        padding: 0 6px;
    }

    .tev-panel-head {
        align-items: flex-start;
        padding: 12px 12px 6px;
    }

    .tev-legend i { width: 40px; }

    .tev-matrix-label,
    button.tev-bubble,
    .tev-bubble {
        min-height: 44px;
        height: 44px;
    }

    .tev-matrix-corner,
    .tev-matrix-date {
        height: 32px;
        line-height: 32px;
    }

    .tev-cards {
        grid-template-columns: 1fr;
        padding: 0 10px 12px;
    }

    .tev-stock {
        min-height: 36px;
        display: inline-flex;
        align-items: center;
        padding: 6px 8px;
        font-size: 13px;
    }

    .tev-sheet-handle {
        display: block;
        width: 36px;
        height: 4px;
        border-radius: 99px;
        background: var(--border-color);
        margin: 8px auto 0;
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
    }

    .tev-drawer-panel {
        top: auto;
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        height: min(82vh, 680px);
        border-radius: 16px 16px 0 0;
    }

    .tev-drawer-head {
        padding-top: 18px;
    }

    .tev-icon-btn {
        width: 44px;
        height: 44px;
    }

    .tev-table th:nth-child(2),
    .tev-table td:nth-child(2) {
        display: none;
    }
}

.tev-panel-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex: none;
    margin-left: auto;
}

.tev-export-btn.is-loading {
    opacity: 0.7;
    pointer-events: none;
}

@media (max-width: 720px) {
    .tev-main .tev-panel-head {
        flex-wrap: wrap;
        align-items: flex-start;
    }
    .tev-main .tev-panel-tools {
        width: 100%;
        justify-content: space-between;
    }
    .tev-export-btn {
        height: 44px;
        min-height: 44px;
        padding: 0 12px;
    }
}

/* 离屏导出：固定桌面宽，不受当前视口 / 手机端媒体查询影响 */
.tev-export-host {
    position: fixed;
    left: -16000px;
    top: 0;
    z-index: -1;
    pointer-events: none;
    box-sizing: border-box;
    width: 1280px;
    padding: 18px 18px 14px;
    background: var(--bg-color, #F5F7FA);
    color: var(--text-primary, #262626);
    --tev-label-col: 148px;
    --tev-date-col: 48px;
    font-family: var(--font-family-base);
}

.tev-export-host .tev-export-meta {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--text-secondary, #595959);
}

.tev-export-host .tev-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.tev-export-host .tev-stat {
    padding: 12px 14px 11px;
}

.tev-export-host .tev-stat strong {
    font-size: 26px;
}

.tev-export-host .tev-panel-head {
    align-items: center;
    padding: 12px 14px 8px;
}

.tev-export-host .tev-matrix-wrap {
    overflow: visible;
    max-height: none;
    padding: 0 0 8px;
}

.tev-export-host .tev-matrix {
    min-width: 100%;
    width: 100%;
}

.tev-export-host .tev-matrix-label,
.tev-export-host .tev-matrix-date,
.tev-export-host .tev-matrix-corner,
.tev-export-host .tev-bubble {
    position: static;
    height: 32px;
    min-height: 32px;
    line-height: 32px;
}

.tev-export-host .tev-matrix-label {
    box-shadow: none;
    text-align: left;
}

.tev-export-host .tev-export-foot {
    margin: 10px 0 0;
    font-size: 11px;
    color: var(--text-tertiary, #8C8C8C);
}
