/**
 * 行业 RPS 趋势选股页
 * 色板跟随 finance_navigation tokens
 * Page Shell：只改 --sa-topbar-max-width；gutter 走 --sa-topbar-px，避免 body 双重留白
 */

body.irs-page {
    --sa-topbar-max-width: 1600px;
    --irs-bg: var(--bg-color, #f5f7fa);
    --irs-card: var(--card-bg, #fff);
    --irs-border: var(--border-color, #e8eaed);
    --irs-text: var(--text-primary, #262626);
    --irs-muted: var(--text-secondary, #8c8c8c);
    --irs-primary: var(--primary-color, #1a56a7);
    --irs-up: #cf1322;
    --irs-down: #389e0d;
    --irs-radius: 12px;
    --irs-shadow: 0 2px 12px rgba(15, 23, 42, 0.045);
    margin: 0;
    /* 覆盖 finance_navigation.css body 左右 padding，避免与 .sa-page-shell 双重留白 */
    padding: 0;
    background:
        radial-gradient(1200px 480px at 12% -10%, rgba(26, 86, 167, 0.08), transparent 60%),
        radial-gradient(900px 420px at 92% 0%, rgba(78, 205, 196, 0.07), transparent 55%),
        var(--irs-bg);
    color: var(--irs-text);
    font-family: var(--font-family-base, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif);
    -webkit-font-smoothing: antialiased;
}

@media (min-width: 1680px) {
    body.irs-page { --sa-topbar-max-width: 1720px; }
}
@media (min-width: 1920px) {
    body.irs-page { --sa-topbar-max-width: 1840px; }
}
@media (max-width: 720px) {
    body.irs-page { --sa-topbar-max-width: 100%; }
}

body.irs-page > .sa-page-shell,
body.irs-page .sa-page-shell {
    max-width: var(--sa-topbar-max-width, 1600px);
    width: 100%;
    margin-inline: auto;
    /* 水平 gutter 由 site_topbar .sa-page-shell 的 padding-inline 提供 */
    padding-top: 14px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}

.irs-top-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--irs-border);
    background: var(--irs-card);
    color: var(--irs-primary);
    text-decoration: none;
    font-size: 12px;
    font-weight: 650;
}
.irs-top-link:hover { border-color: #b7c9e4; background: #f4f8fd; }

.irs-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--irs-border);
    background: var(--irs-card);
    color: var(--irs-text);
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
}
.irs-btn--primary {
    background: var(--irs-primary);
    border-color: var(--irs-primary);
    color: #fff;
}
.irs-btn--primary:hover { filter: brightness(1.05); }

.irs-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.8fr);
    gap: 16px;
    padding: 18px 18px 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f7fbff 55%, #f3faf8 100%);
    border: 1px solid var(--irs-border);
    border-radius: 14px;
    box-shadow: var(--irs-shadow);
    margin-bottom: 14px;
}
.irs-eyebrow {
    margin: 0 0 6px;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--irs-muted);
    font-weight: 700;
}
.irs-industry-name {
    margin: 0 0 8px;
    font-size: clamp(1.5rem, 2.4vw, 2rem);
    font-weight: 780;
    letter-spacing: -0.02em;
    color: #123a6b;
}
.irs-hero-desc {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.55;
    color: var(--irs-muted);
    max-width: 42em;
}
.irs-hero-side {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
}
.irs-quad-card {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #d7e5f5;
    background: rgba(255, 255, 255, 0.85);
}
.irs-quad-label {
    display: block;
    font-size: 11px;
    color: var(--irs-muted);
    margin-bottom: 4px;
}
.irs-quad-value {
    display: inline-block;
    font-size: 1.1rem;
    font-weight: 780;
    padding: 2px 10px;
    border-radius: 999px;
    background: #eef4fb;
    color: var(--irs-primary);
}
.irs-quad-value.is-leading { background: #ffe8e8; color: #c0392b; }
.irs-quad-value.is-improving { background: #e6f8f6; color: #0f766e; }
.irs-quad-value.is-lagging { background: #e8f4fa; color: #1d6f9a; }
.irs-quad-value.is-weakening { background: #eef7ef; color: #3d7a4a; }
.irs-quad-metrics {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    color: var(--irs-muted);
    font-variant-numeric: tabular-nums;
}
.irs-stat-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.irs-stat {
    text-align: center;
    padding: 10px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--irs-border);
}
.irs-stat b {
    display: block;
    font-size: 1.15rem;
    font-weight: 780;
    color: #123a6b;
    font-variant-numeric: tabular-nums;
}
.irs-stat span {
    font-size: 11px;
    color: var(--irs-muted);
}

.irs-chip-rail {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.irs-chip {
    appearance: none;
    border: 1px solid var(--irs-border);
    background: var(--irs-card);
    color: #35506e;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.irs-chip:hover { border-color: #b7c9e4; background: #f4f8fd; }
.irs-chip.is-active {
    background: var(--irs-primary);
    border-color: var(--irs-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(26, 86, 167, 0.22);
}

.irs-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 10px 12px;
    margin-bottom: 14px;
    background: var(--irs-card);
    border: 1px solid var(--irs-border);
    border-radius: 10px;
    box-shadow: var(--irs-shadow);
}
.irs-field {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--irs-muted);
}
.irs-field input,
.irs-field select {
    height: 30px;
    border: 1px solid var(--irs-border);
    border-radius: 7px;
    padding: 0 8px;
    color: var(--irs-text);
    background: #fff;
    font-size: 12px;
    font-weight: 650;
}
.irs-field input { width: 72px; }
.irs-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--irs-text);
    cursor: pointer;
    user-select: none;
}
.irs-toolbar-hint {
    margin: 0 0 0 auto;
    font-size: 11px;
    color: var(--irs-muted);
}

.irs-status {
    min-height: 160px;
    display: grid;
    place-items: center;
}
.irs-status[hidden] {
    display: none !important;
}
.irs-status-card {
    text-align: center;
    padding: 28px 20px;
    color: var(--irs-muted);
}
.irs-status-card i {
    font-size: 1.4rem;
    color: var(--irs-primary);
    margin-bottom: 10px;
}
.irs-status-card p {
    margin: 0 0 6px;
    color: var(--irs-text);
    font-weight: 650;
}
.irs-status-card.is-error i { color: var(--irs-up); }

.irs-main {
    background: var(--irs-card);
    border: 1px solid var(--irs-border);
    border-radius: 12px;
    box-shadow: var(--irs-shadow);
    overflow: hidden;
}
/* 首屏 / 空表时 SaInlineLoading 需有可遮罩高度 */
.irs-main.sa-il-host.is-loading {
    min-height: 220px;
}
.irs-list-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--irs-border);
}
.irs-list-head h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 750;
}
.irs-list-head p {
    margin: 0;
    font-size: 12px;
    color: var(--irs-muted);
}

.irs-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.irs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.irs-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    color: var(--irs-muted);
    font-weight: 700;
    background: #f8fafc;
    border-bottom: 1px solid var(--irs-border);
    white-space: nowrap;
}
.irs-table th.irs-th-sort {
    cursor: pointer;
    user-select: none;
    transition: color 0.12s ease, background 0.12s ease;
}
.irs-table th.irs-th-sort:hover {
    color: var(--irs-primary);
    background: #eef4fb;
}
.irs-table th.irs-th-sort.is-asc::after,
.irs-table th.irs-th-sort.is-desc::after {
    content: "";
    display: inline-block;
    margin-left: 4px;
    border-left: 3.5px solid transparent;
    border-right: 3.5px solid transparent;
    vertical-align: middle;
}
.irs-table th.irs-th-sort.is-asc::after {
    border-bottom: 5px solid var(--irs-primary);
}
.irs-table th.irs-th-sort.is-desc::after {
    border-top: 5px solid var(--irs-primary);
}
.irs-table th.irs-th-sort.is-asc,
.irs-table th.irs-th-sort.is-desc {
    color: var(--irs-primary);
}
.irs-table td {
    padding: 11px 12px;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: middle;
}
.irs-table tbody tr {
    cursor: pointer;
    transition: background 0.12s ease;
}
.irs-table tbody tr:hover { background: #f5f9fd; }
.irs-col-rank { width: 42px; color: var(--irs-muted); font-variant-numeric: tabular-nums; }
.irs-col-num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.irs-col-flag { text-align: center !important; white-space: nowrap; }
.irs-stock-code {
    display: block;
    font-weight: 750;
    color: #123a6b;
    font-variant-numeric: tabular-nums;
}
.irs-stock-name {
    display: block;
    font-size: 12px;
    color: var(--irs-muted);
    margin-top: 2px;
}
.irs-score {
    font-weight: 750;
    color: var(--irs-primary);
}
.irs-score-bar {
    display: block;
    height: 3px;
    margin-top: 5px;
    border-radius: 99px;
    background: #e8eef5;
    overflow: hidden;
}
.irs-score-bar > i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #4e8fd6, #1a56a7);
    border-radius: inherit;
}
.irs-pill {
    display: inline-block;
    min-width: 2.4em;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}
.irs-pill--ok { background: #e8f8ef; color: #237a45; }
.irs-pill--no { background: #f3f4f6; color: #8c8c8c; }
.irs-ret-up { color: var(--irs-up); font-weight: 700; }
.irs-ret-down { color: var(--irs-down); font-weight: 700; }
.irs-empty {
    margin: 0;
    padding: 28px 16px;
    text-align: center;
    color: var(--irs-muted);
    font-size: 13px;
}

.irs-howto {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--irs-border);
    background: rgba(255, 255, 255, 0.7);
    color: var(--irs-muted);
    font-size: 13px;
}
.irs-howto summary {
    cursor: pointer;
    font-weight: 700;
    color: #35506e;
}
.irs-howto ol {
    margin: 10px 0 0;
    padding-left: 1.2em;
    line-height: 1.6;
}

@media (max-width: 820px) {
    .irs-hero { grid-template-columns: 1fr; }
    .irs-toolbar-hint { margin-left: 0; flex-basis: 100%; }
    .irs-btn-label { display: none; }
}
