/* ===== from dashboard.html <style> block #1 ===== */
* {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        :root {
            --bg-primary: #0a0e1a;
            --bg-secondary: #121826;
            --bg-card: #1a2235;
            --accent-green: #00ff88;
            --accent-cyan: #00d9ff;
            --accent-red: #ff3366;
            --accent-orange: #ff9500;
            --accent-amber: #ffaa00;
            --text-primary: #e8edf4;
            --text-secondary: #7d8ba7;
            --border-color: #2d3748;
        }

        /* ===== ETF 共識訊號橫幅 ===== */
        .signals-banner {
            background: linear-gradient(135deg, var(--bg-card) 0%, #1a2235 100%);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            padding: 18px 22px;
            margin-bottom: 20px;
            text-decoration: none;
            color: var(--text-primary);
            display: block;
            transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
            position: relative;
            overflow: hidden;
        }
        .signals-banner::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 2px;
            background: linear-gradient(90deg, #fbbf24 0%, #f87171 50%, #4ade80 100%);
        }
        .signals-banner:hover {
            border-color: var(--accent-cyan);
            transform: translateY(-2px);
            box-shadow: 0 8px 24px rgba(0, 217, 255, 0.15);
        }
        .sb-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 12px;
            padding-bottom: 10px;
            border-bottom: 1px solid var(--border-color);
        }
        .sb-title {
            font-family: 'JetBrains Mono', monospace;
            font-size: 12px;
            font-weight: 600;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            color: var(--accent-cyan);
        }
        .sb-date {
            font-family: 'JetBrains Mono', monospace;
            font-size: 11px;
            color: var(--text-secondary);
        }
        .sb-stats {
            display: flex;
            gap: 18px;
            flex-wrap: wrap;
            align-items: center;
        }
        .sb-stat {
            display: flex;
            align-items: baseline;
            gap: 6px;
            font-family: 'JetBrains Mono', monospace;
            font-size: 12px;
        }
        .sb-stat .count {
            font-size: 18px;
            font-weight: 600;
        }
        .sb-stat .label {
            color: var(--text-secondary);
        }
        .sb-stat.new .count {
            color: #fbbf24;
        }
        .sb-stat.buy .count {
            color: #ff3366;
        }
        .sb-stat.sell .count {
            color: #4ade80;
        }
        .sb-preview {
            flex: 1;
            color: var(--text-secondary);
            font-size: 12px;
            text-align: right;
            padding-left: 12px;
        }
        .sb-preview .stock {
            color: var(--text-primary);
            margin: 0 4px;
        }
        .sb-preview .arrow {
            color: var(--accent-cyan);
            margin-left: 8px;
            transition: transform 0.2s;
        }
        .signals-banner:hover .sb-preview .arrow {
            transform: translateX(4px);
        }
        .sb-loading {
            color: var(--text-secondary);
            font-family: 'JetBrains Mono', monospace;
            font-size: 11px;
        }

        body {
            font-family: 'JetBrains Mono', 'Noto Sans TC', monospace;
            background: var(--bg-primary);
            color: var(--text-primary);
            min-height: 100vh;
            padding-top: 56px;   /* 預留空間給 fixed .header */
            background-image:
                repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 255, 136, 0.03) 2px, rgba(0, 255, 136, 0.03) 4px);
        }

        .container {
            max-width: 1600px;
            margin: 0 auto;
            padding: 10px 10px;
        }

        /* 頂部欄 — Phase 1 fixed
           (原本 sticky 因 .header 父層 .container 在文件中段就關閉,
            sticky 一旦 scroll 超過 .container 範圍就失效。改用 fixed 跨整個 viewport,
            body 用 padding-top 預留空間) */
        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 12px;
            border-bottom: 1px solid var(--accent-green);
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 100;
            height: 56px;
            background: var(--bg-primary);
        }

        .header .logo { cursor: pointer; }

        /* === 快速定位 panel (Quick-Find) === */
        .qf-btn {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            height: 32px;
            min-width: 160px;
            padding: 0 12px;
            border-radius: 6px;
            background: #0d1117;
            border: 1px solid #30363d;
            color: #6e7681;
            font-size: 13px;
            font-family: inherit;
            cursor: pointer;
            transition: border-color 0.15s, background 0.15s;
            flex-shrink: 0;
            text-align: left;
            justify-content: flex-start;
        }
        .qf-btn:hover {
            border-color: #58a6ff;
            background: rgba(88, 166, 255, 0.06);
        }
        .qf-btn .qf-btn-icon {
            color: #8b949e;
            font-size: 14px;
            flex-shrink: 0;
        }
        .qf-btn .qf-btn-text {
            color: #6e7681;
        }
        .qf-btn .qf-btn-spacer {
            flex: 1;
        }
        .qf-btn .qf-btn-kbd {
            font-family: inherit;
            font-size: 11px;
            padding: 1px 6px;
            border: 1px solid #30363d;
            border-radius: 4px;
            background: #161b22;
            color: #8b949e;
            font-weight: 600;
            line-height: 1;
        }

        .qf-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 99998;
            display: none;
        }
        .qf-overlay.active {
            display: block;
        }

        .qf-panel {
            position: fixed;
            top: 80px;
            left: 50%;
            transform: translateX(-50%);
            width: 560px;
            max-width: calc(100vw - 32px);
            max-height: calc(100vh - 120px);
            background: #161b22;
            border: 1px solid #58a6ff;
            border-radius: 8px;
            box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
            z-index: 99999;
            display: none;
            flex-direction: column;
            overflow: hidden;
        }
        .qf-panel.active {
            display: flex;
        }

        .qf-search-wrap {
            display: flex;
            align-items: center;
            padding: 12px 16px;
            border-bottom: 1px solid #30363d;
            gap: 12px;
        }
        .qf-search-icon {
            color: #8b949e;
            font-size: 16px;
            flex-shrink: 0;
        }
        .qf-search-input {
            flex: 1;
            background: transparent;
            border: none;
            outline: none;
            color: #e6edf3;
            font-size: 14px;
            font-family: inherit;
        }
        .qf-search-input::placeholder {
            color: #8b949e;
        }
        .qf-esc-hint {
            color: #8b949e;
            font-size: 11px;
            padding: 2px 6px;
            border: 1px solid #30363d;
            border-radius: 4px;
            flex-shrink: 0;
            font-family: inherit;
        }

        .qf-results {
            overflow-y: auto;
            padding: 8px;
            max-height: calc(100vh - 200px);
        }
        .qf-results-empty {
            padding: 16px;
            color: #8b949e;
            font-size: 13px;
            text-align: center;
        }
        .qf-group-label {
            color: #8b949e;
            font-size: 11px;
            padding: 8px 12px 4px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .qf-result-item {
            display: flex;
            align-items: center;
            padding: 10px 12px;
            border-radius: 6px;
            cursor: pointer;
            color: #e6edf3;
            font-size: 14px;
            gap: 10px;
        }
        .qf-result-item.active {
            background: rgba(88, 166, 255, 0.12);
        }
        .qf-result-icon {
            color: #58a6ff;
            flex-shrink: 0;
            width: 18px;
            text-align: center;
        }
        .qf-result-text {
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .qf-result-hint {
            color: #8b949e;
            font-size: 12px;
            flex-shrink: 0;
        }

        /* section highlight flash (跳轉後閃爍提示) */
        @keyframes section-highlight-flash {
            0%   { background-color: rgba(88, 166, 255, 0); }
            15%  { background-color: rgba(88, 166, 255, 0.12); }
            100% { background-color: rgba(88, 166, 255, 0); }
        }
        .section-highlighted {
            animation: section-highlight-flash 1.5s ease-out;
        }

        @media (max-width: 768px) {
            .qf-panel {
                top: 64px;
                width: calc(100vw - 16px);
                max-height: calc(100vh - 80px);
            }
        }

        .logo {
            font-size: 28px;
            font-weight: 800;
            letter-spacing: 2px;
        }

        .logo .ts { color: var(--accent-green); }
        .logo .we { color: var(--text-primary); }
        .logo .monitor { color: var(--accent-cyan); font-size: 14px; margin-left: 10px; }

        .status {
            display: flex;
            gap: 20px;
            font-size: 12px;
        }

        .status-item {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
        }

        .status-label {
            color: var(--text-secondary);
            margin-bottom: 4px;
        }

        .status-value {
            color: var(--accent-green);
            font-weight: 600;
        }

        /* 主要指標卡片 */
        .metrics-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
            gap: 20px;
            margin-bottom: 30px;
        }

        .metric-card {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 24px;
            position: relative;
        
            transition: all 0.3s ease;
        }

        .metric-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 4px;
            height: 100%;
            background: var(--accent-green);
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .metric-card:hover::before {
            opacity: 1;
        }

        .metric-card:hover {
            border-color: var(--accent-green);
            box-shadow: 0 0 20px rgba(0, 255, 136, 0.1);
        }

        .metric-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .metric-title {
            font-size: 14px;
            color: var(--text-secondary);
            font-weight: 400;
            letter-spacing: 1px;
        }

        .metric-date {
            font-size: 11px;
            color: var(--text-secondary);
            background: var(--bg-secondary);
            padding: 4px 10px;
            border-radius: 4px;
        }

        .metric-value-container {
            display: flex;
            align-items: baseline;
            gap: 10px;
            margin-bottom: 24px;
        }

        .metric-value {
            font-size: 72px;
            font-weight: 800;
            line-height: 1;
            letter-spacing: -2px;
        }

        .metric-unit {
            font-size: 32px;
            color: var(--text-secondary);
            font-weight: 400;
        }

        .metric-details {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
        }

        .detail-item {
            background: var(--bg-secondary);
            padding: 12px;
            border-radius: 6px;
        }

        .detail-label {
            font-size: 11px;
            color: var(--text-secondary);
            margin-bottom: 6px;
        }

        .detail-value {
            font-size: 16px;
            font-weight: 600;
        }

        /* 圖表區域 */
        .retail-chart-full {
            grid-column: 1 / -1;
        }
        .charts-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 20px;
            margin-bottom: 30px;
        }

        .chart-card {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 24px;
        }

        .chart-title {
            font-size: 16px;
            font-weight: 700;
            color: var(--accent-green);
            margin-bottom: 20px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .chart-title::before {
            content: '▸';
            color: var(--accent-cyan);
        }

        canvas {
            width: 100% !important;
            height: 300px !important;
        }

        /* 底部資訊 */
        .footer {
            text-align: center;
            padding: 30px 0;
            border-top: 1px solid var(--border-color);
            color: var(--text-secondary);
            font-size: 12px;
        }

        .footer-warning {
            color: var(--accent-amber);
            margin-top: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        /* 閃爍動畫 */
        @keyframes blink {
            0%, 50% { opacity: 1; }
            51%, 100% { opacity: 0.6; }
        }

        .live-indicator {
            display: inline-block;
            width: 8px;
            height: 8px;
            background: var(--accent-green);
            border-radius: 50%;
            animation: blink 2s ease-in-out infinite;
        }

        /* 數據來源指示器 */
        .data-indicator {
            display: inline-block;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            margin-right: 0;
        }

        .data-indicator.real {
            background: var(--accent-green);
            box-shadow: 0 0 8px var(--accent-green);
        }

        .data-indicator.mock {
            background: var(--accent-amber);
            box-shadow: 0 0 8px var(--accent-amber);
            animation: blink 1.5s ease-in-out infinite;
        }

        /* 響應式 */
        @media (max-width: 768px) {
            .metrics-grid,
            .charts-grid {
                grid-template-columns: 1fr;
            }

            .metric-value {
                font-size: 56px;
            }

            .header {
                flex-direction: column;
                gap: 20px;
            }
        }

        /* Loading 狀態 */
        .loading {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 400px;
            font-size: 18px;
            color: var(--accent-green);
        }

        .loading::after {
            content: '...';
            animation: dots 1.5s steps(4, end) infinite;
        }

        @keyframes dots {
            0%, 20% { content: '.'; }
            40% { content: '..'; }
            60%, 100% { content: '...'; }
        }

        /* 模擬數據警告 */
        .mock-warning {
            background: rgba(255, 170, 0, 0.15);
            border: 2px solid var(--accent-amber);
            border-radius: 8px;
            margin-bottom: 20px;
            animation: slideDown 0.5s ease;
        }

        @keyframes slideDown {
            from {
                opacity: 0;
                transform: translateY(-20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .mock-warning-content {
            display: flex;
            align-items: center;
            gap: 16px;
            padding: 16px 24px;
        }

        .mock-warning-icon {
            font-size: 28px;
            flex-shrink: 0;
        }

        .mock-warning-text {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .mock-warning-text strong {
            color: var(--accent-amber);
            font-size: 16px;
            font-weight: 700;
        }

        .mock-warning-text span {
            color: var(--text-secondary);
            font-size: 15px;
        }

        .mock-warning-close {
            background: none;
            border: none;
            color: var(--text-secondary);
            font-size: 24px;
            cursor: pointer;
            width: 32px;
            height: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 4px;
            transition: all 0.2s ease;
            flex-shrink: 0;
        }

        .mock-warning-close:hover {
            background: var(--accent-amber);
            color: var(--bg-primary);
        }

        /* 數據解讀指南 */

        /* ===== 台指期結算日倒數 ===== */
        .futures-settlement {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 8px 14px;
            border-radius: 6px;
            background: rgba(255,255,255,0.05);
            border: 1px solid rgba(255,255,255,0.12);
            font-family: 'JetBrains Mono', monospace;
            font-size: 13px;
            color: #d4d4d4;
            white-space: nowrap;
            margin-right: 8px;
            transition: all 0.3s ease;
        }
        .futures-settlement .fs-label {
            color: #848e9c;
            font-size: 12px;
        }
        .futures-settlement .fs-days {
            font-weight: 700;
            font-size: 14px;
            color: #f0b90b;
            letter-spacing: 0.5px;
        }
        .futures-settlement .fs-date {
            color: #848e9c;
            font-size: 12px;
        }
        .futures-settlement.fs-warning {
            background: rgba(255,77,79,0.1);
            border-color: rgba(255,77,79,0.4);
        }
        .futures-settlement.fs-warning .fs-days {
            color: #ff4d4f;
            animation: fs-pulse 1.5s ease-in-out infinite;
        }
        .futures-settlement.fs-today {
            background: rgba(255,77,79,0.25);
            border-color: #ff4d4f;
        }
        .futures-settlement.fs-today .fs-days {
            color: #fff;
            background: #ff4d4f;
            padding: 2px 8px;
            border-radius: 4px;
            font-size: 13px;
        }
        @keyframes fs-pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.55; }
        }
        /* ===== 台指期結算日倒數 END ===== */

        /* ===== guide-btn v3.8: GitHub Dark + 6 段階梯降級 (2026-05-17) ===== */
        /* === 主 CSS:桌面 (>1450px) 預設樣式 === */
        .guide-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            background: #161b22;
            color: #e6edf3;
            border: 1px solid #30363d;
            border-left: 4px solid #30363d;
            padding: 8px 14px;
            border-radius: 6px;
            font-family: 'JetBrains Mono', monospace;
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
            transition: border-color 0.15s, color 0.15s, background 0.15s;
            letter-spacing: 0.3px;
            margin-right: 0;
            min-width: 0;
            white-space: nowrap;
        }
        .guide-btn:hover {
            background: #1c2128;
            color: #ffffff;
        }
        .guide-btn-icon {
            font-size: 14px;
            opacity: 0.9;
        }
        /* 三色變體:藍=產業鏈 / 綠=ETF / 黃=蒙地卡羅 */
        .guide-btn-industry       { border-left-color: #58a6ff; }
        .guide-btn-industry:hover { border-color: #58a6ff; border-left-color: #58a6ff; }
        .guide-btn-etf            { border-left-color: #3fb950; }
        .guide-btn-etf:hover      { border-color: #3fb950; border-left-color: #3fb950; }
        .guide-btn-monte          { border-left-color: #d29922; }
        .guide-btn-monte:hover    { border-color: #d29922; border-left-color: #d29922; }
        .guide-btn-position       { border-left-color: #f0883e; }
        .guide-btn-position:hover { border-color: #f0883e; border-left-color: #f0883e; }
        .guide-btn-water          { border-left-color: #3fb8a0; }
        .guide-btn-water:hover    { border-color: #3fb8a0; border-left-color: #3fb8a0; }
        /* status-value 在 top bar 內改白 (其他地方仍用 accent-green) */
        .header .status .status-value { color: #e6edf3; }
        /* status 容器: align-items 對齊,wrap 規則只在 ≤700px 啟用 (見 [6]) */
        .header .status { align-items: center; }

        /* ============================================================================
         * Topbar responsive breakpoints (v3.8, 2026-05-18)
         * 設計原則:空間不足時優先收輔助資訊,主功能(搜尋框)最後犧牲
         *   [1] ≤1450  藏 MARKET MONITOR (logo 裝飾)
         *   [3] ≤1050  收 fs 為「剩 X 天」短版
         *   [2] ≤1150  status gap 20→10
         *   [5] ≤1000  guide-btn 收文字、只剩 icon
         *   [4] ≤900   搜尋框收成 🔍 (主功能,最後犧牲)
         *   [6] ≤700   header 換兩行 (手機)
         * ============================================================================ */
        /* === [1] ≤1450px: 藏 MARKET MONITOR === */
        @media (max-width: 1450px) {
            .logo .monitor { display: none !important; }
        }
        /* === [2] ≤1150px: 縮 gap 20→10 === */
        @media (max-width: 1150px) {
            .header .status { gap: 10px; }
        }
        /* === [3] ≤1050px: 藏「台指期結算」字樣 + 藏 .fs-date,只剩「剩 X 天」 === */
        @media (max-width: 1050px) {
            .futures-settlement .fs-label { display: none; }
            .futures-settlement .fs-date  { display: none; }
        }
        /* === [4] ≤900px: 搜尋只剩 🔍 === */
        @media (max-width: 900px) {
            .qf-btn .qf-btn-text,
            .qf-btn .qf-btn-spacer,
            .qf-btn .qf-btn-kbd { display: none; }
            .qf-btn { min-width: auto; padding: 0 10px; }
        }
        /* === [5] ≤1000px: 三按鈕只剩圖示 === */
        @media (max-width: 1000px) {
            .guide-btn { min-width: 0; padding: 6px 10px; }
            .guide-btn-text { display: none; }
        }
        /* === [6] ≤700px: header 兩行 + 綠線跟著下走 (v3.8 breakpoint 880→700) === */
        @media (max-width: 700px) {
            .header {
                height: auto;
                min-height: 56px;
                flex-wrap: wrap;
            }
            body { padding-top: 90px; }
            /* status 啟用 wrap 配合兩行版面 */
            .header .status { flex-wrap: wrap; row-gap: 4px; }
            /* VERSION + LAST UPDATE 推到末位,整組強制換到第二行 */
            .header .status::before {
                content: '';
                flex-basis: 100%;
                height: 0;
                order: 50;
            }
            .header .status .status-item { order: 100; }
            .header .status .status-item:first-of-type { margin-left: auto; }
        }
        /* ===== guide-btn v3.8 END (≤768px 既有手機規則接管,見 line 1694) ===== */

        /* 彈出面板 */
        .guide-panel { position:fixed; top:0; left:0; width:100%; height:100%; z-index:10000; display:none; overflow-y:auto; }
        .guide-panel.active { display:block; }
        .guide-panel-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(10, 14, 26, 0.95);
            backdrop-filter: blur(8px);
        }

        .guide-panel-content {
            z-index: 1;
            position: relative;
            max-width: 1400px;
            max-height: 90vh;
            margin: 5vh auto;
            background: var(--bg-secondary);
            border: 2px solid var(--accent-green);
            border-radius: 12px;
        
            animation: fadeIn 0.3s ease;
        }

        @keyframes slideUp {
            from { 
                opacity: 0;
                transform: translateY(50px);
            }
            to { 
                opacity: 1;
                transform: translateY(0);
            }
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: scale(0.95); }
            to { opacity: 1; transform: scale(1); }
        }

        .guide-panel-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 24px 32px;
            background: var(--bg-card);
            border-bottom: 2px solid var(--accent-green);
        }

        .guide-panel-title {
            font-size: 24px;
            font-weight: 800;
            color: var(--accent-green);
            letter-spacing: 2px;
            font-family: 'Noto Sans TC', sans-serif;
        }

        .guide-panel-close {
            background: none;
            border: none;
            color: var(--text-secondary);
            font-size: 32px;
            cursor: pointer;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 6px;
            transition: all 0.2s ease;
            line-height: 1;
        }

        .guide-panel-close:hover {
            background: var(--accent-red);
            color: white;
            transform: rotate(90deg);
        }

        .guide-panel-body {
            
            max-height: calc(90vh - 90px);
            padding: 32px;
        }

        .guide-panel-body::-webkit-scrollbar {
            width: 8px;
        }

        .guide-panel-body::-webkit-scrollbar-track {
            background: var(--bg-secondary);
        }

        .guide-panel-body::-webkit-scrollbar-thumb {
            background: var(--accent-green);
            border-radius: 4px;
        }

        .guide-grid-popup {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
            gap: 24px;
        }

        .guide-section {
            margin: 40px 0;
        }

        .guide-title {
            font-size: 28px;
            font-weight: 800;
            color: var(--accent-green);
            margin-bottom: 30px;
            text-align: center;
            letter-spacing: 2px;
        }

        .guide-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
            gap: 20px;
        }

        .guide-card {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 24px;
            transition: all 0.3s ease;
        }

        .guide-card:hover {
            border-color: var(--accent-green);
            box-shadow: 0 0 20px rgba(0, 255, 136, 0.1);
        }

        .guide-highlight {
            grid-column: 1 / -1;
            border: 1px solid var(--accent-cyan);
        }

        .guide-header {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 20px;
            padding-bottom: 16px;
            border-bottom: 1px solid var(--border-color);
        }

        .guide-icon {
            font-size: 28px;
        }

        .guide-header h3 {
            font-size: 18px;
            font-weight: 700;
            color: var(--text-primary);
            font-family: 'Noto Sans TC', sans-serif;
        }

        .guide-intro {
            color: var(--text-secondary);
            margin-bottom: 20px;
            font-size: 15px;
            line-height: 1.6;
        }

        .guide-content {
            font-family: 'Noto Sans TC', sans-serif;
        }

        .level-item {
            background: var(--bg-secondary);
            border-radius: 6px;
            padding: 16px;
            margin-bottom: 12px;
            border-left: 3px solid transparent;
            transition: all 0.2s ease;
        }

        .level-item:hover {
            transform: translateX(4px);
        }

        .level-danger {
            border-left-color: var(--accent-red);
        }

        .level-warning {
            border-left-color: var(--accent-amber);
        }

        .level-safe {
            border-left-color: var(--accent-green);
        }

        .level-cold {
            border-left-color: var(--accent-cyan);
        }

        .level-badge {
            display: inline-block;
            background: rgba(0, 255, 136, 0.1);
            padding: 6px 12px;
            border-radius: 4px;
            font-weight: 700;
            font-size: 15px;
            margin-bottom: 10px;
        }

        .level-info {
            margin-left: 8px;
        }

        .level-title {
            font-weight: 700;
            font-size: 15px;
            color: var(--text-primary);
            margin-bottom: 6px;
        }

        .level-desc {
            color: var(--text-secondary);
            font-size: 15px;
            margin-bottom: 6px;
            line-height: 1.5;
        }

        .level-action {
            color: var(--accent-cyan);
            font-size: 12px;
            font-weight: 600;
        }

        /* 提示列表 */
        .tips-list {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        .tip-item {
            display: flex;
            gap: 16px;
            align-items: flex-start;
            background: var(--bg-secondary);
            padding: 16px;
            border-radius: 6px;
        }

        .tip-warning {
            background: rgba(255, 170, 0, 0.05);
            border: 1px solid var(--accent-amber);
        }

        .tip-number {
            display: flex;
            align-items: center;
            justify-content: center;
            min-width: 32px;
            height: 32px;
            background: var(--accent-green);
            color: var(--bg-primary);
            border-radius: 50%;
            font-weight: 800;
            font-size: 14px;
            flex-shrink: 0;
        }

        .tip-warning .tip-number {
            background: var(--accent-amber);
        }

        .tip-text strong {
            display: block;
            color: var(--text-primary);
            margin-bottom: 6px;
            font-size: 14px;
        }

        .tip-text p {
            color: var(--text-secondary);
            font-size: 12px;
            line-height: 1.6;
            margin: 0;
        }

        @media (max-width: 768px) {
            .guide-grid,
            .guide-grid-popup {
                grid-template-columns: 1fr;
            }

            .guide-panel-content {
            z-index: 1;
                margin: 2vh auto;
                max-height: 96vh;
            }

            .guide-panel-body {
                padding: 10px 10px;
            }

            .guide-btn-text {
                display: none;
            }
        }
    
/* 情緒指標進度條 v2.0 */
.sentiment-components {
    padding: 12px 16px;
}
.component-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 10px;
}
.component-row:last-child {
    margin-bottom: 0;
}
.comp-label {
    width: 75px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
}
.comp-bar-wrap {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;

}
.comp-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease, background 0.3s ease;
}
.comp-score {
    width: 30px;
    text-align: right;
    font-size: 15px;
    font-weight: 600;
    flex-shrink: 0;
}
.comp-desc {
    width: 70px;
    font-size: 11px;
    text-align: right;
    flex-shrink: 0;
    opacity: 0.9;
}
/* 進度條顏色依分數 */
.comp-bar.score-low { background: linear-gradient(90deg, #ea384d, #f5991c); }
.comp-bar.score-mid { background: linear-gradient(90deg, #f5991c, #ffd700); }
.comp-bar.score-high { background: linear-gradient(90deg, #93d258, #16c784); }

/* ==================== 周轉率表格 - 單欄置中版 ==================== */

/* 單欄表格容器 - 限寬置中 */
.turnover-single-wrap {
    max-width: 850px;
    margin: 0 auto;
}

/* 排序狀態列 */
.sort-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0, 217, 255, 0.1);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 15px;
}

.sort-status-text {
    color: var(--text-secondary);
}

.sort-status-text .sort-field {
    color: var(--accent-cyan);
    font-weight: 600;
}

.sort-status-text .sort-arrow {
    color: var(--accent-green);
    margin-left: 4px;
}

.sort-clear-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.sort-clear-btn:hover {
    background: var(--accent-red);
    color: white;
}

/* 可排序表頭 */
.turnover-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    position: relative;
}

.turnover-table th.sortable:hover {
    background: rgba(255,255,255,0.1);
}

.turnover-table th.sortable::after {
    content: '⇅';
    margin-left: 6px;
    opacity: 0.6;
    font-size: 12px;
}

.turnover-table th.sortable.sort-asc::after {
    content: '▲';
    opacity: 1;
    color: var(--accent-green);
}

.turnover-table th.sortable.sort-desc::after {
    content: '▼';
    opacity: 1;
    color: var(--accent-green);
}

.turnover-table-wrap {
    overflow-x: auto;
    margin: 15px 0;
    
    
}

.turnover-table-wrap::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.turnover-table-wrap::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.turnover-table-wrap::-webkit-scrollbar-thumb {
    background: var(--accent-green);
    border-radius: 4px;
}

.turnover-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}
.turnover-table th,
.turnover-table td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.turnover-table th {
    background: var(--bg-card);
    font-weight: 600;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}
.turnover-table tbody tr:hover {
    background: rgba(255,255,255,0.05);
}
.turnover-table .stock-code {
    font-weight: 600;
    color: var(--accent-cyan);
}
.turnover-table .stock-name {
    margin-left: 8px;
}
.turnover-table .stock-price {
    color: #fff;
    font-weight: 500;
}
.turnover-table .stock-change {
    font-weight: 600;
    font-size: 0.85em;
}
.turnover-table .change-up { color: #ff4757; }
.turnover-table .change-down { color: #2ed573; }
.turnover-table .rate-danger { color: #ff4757; font-weight: 700; }
.turnover-table .rate-warning { color: #ffa502; font-weight: 600; }
.turnover-table .rate-normal { color: #7bed9f; }
.turnover-table .surge-high { color: #ff6348; font-weight: 700; }
.turnover-table .tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    margin-right: 4px;
}
.turnover-table .tag-overheat { background: rgba(255,71,87,0.2); color: #ff4757; }
.turnover-table .tag-surge { background: rgba(255,99,72,0.2); color: #ff6348; }
.turnover-table .tag-active { background: rgba(72,219,251,0.2); color: #48dbfb; }



/* 產業統計表格 */
.industry-table-wrap {
    overflow-x: auto;
    margin-top: 12px;
}
.industry-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}
.industry-table th,
.industry-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.industry-table th {
    background: rgba(255,255,255,0.05);
    font-weight: 600;
    color: var(--text-secondary);
}
.industry-table tbody tr:hover {
    background: rgba(255,255,255,0.05);
}
.industry-table .top-industry {
    background: rgba(255,99,72,0.1);
}
.industry-table .top-industry:hover {
    background: rgba(255,99,72,0.15);
}
.industry-table .industry-name {
    font-weight: 600;
    color: var(--accent-cyan);
}
.industry-table .industry-count {
    color: #48dbfb;
}
.industry-table .has-overheat {
    color: #ff4757;
    font-weight: 600;
}
.industry-table .rate-danger {
    color: #ff4757;
    font-weight: 600;
}
.industry-table .rate-warning {
    color: #ffa502;
}


/* 情緒指標說明按鈕 */
.sentiment-info-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 14px;
    cursor: pointer;
    margin-left: auto;
    transition: all 0.2s;
}
.sentiment-info-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}
/* Popup 樣式 */
.sentiment-popup-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 999;
}
.sentiment-popup {
    display: none;
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    
    z-index: 1000;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.sentiment-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: sticky;
    top: 0;
    background: var(--bg-card);
}
.sentiment-popup-header h3 {
    margin: 0;
    font-size: 18px;
}
.sentiment-popup-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
}
.sentiment-popup-close:hover {
    color: #fff;
}
.sentiment-popup-content {
    padding: 10px 10px;
    max-height: calc(90vh - 120px);
    overflow-y: auto;
    overflow-x: hidden;
}

.sentiment-popup-content::-webkit-scrollbar {
    width: 8px;
}

.sentiment-popup-content::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
}

.sentiment-popup-content::-webkit-scrollbar-thumb {
    background: rgba(72, 219, 251, 0.5);
    border-radius: 4px;
}

.sentiment-popup-content::-webkit-scrollbar-thumb:hover {
    background: rgba(72, 219, 251, 0.8);
}
.popup-section {
    margin-bottom: 24px;
}
.popup-section h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
    color: var(--accent-cyan);
}
.weight-chart {
    display: flex;
    gap: 20px;
}
.weight-group {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 12px;
}
.weight-title {
    font-weight: 700;
    margin-bottom: 8px;
    color: #ffd700;
}
.weight-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 15px;
    color: var(--text-secondary);
}
.indicator-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.indicator-item {
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    padding: 12px;
}
.indicator-name {
    font-weight: 600;
    margin-bottom: 6px;
    color: #7bed9f;
}
.indicator-desc {
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-secondary);
}
.score-legend {
    display: flex;
    gap: 12px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
}
.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
@media (max-width: 600px) {
    .weight-chart { flex-direction: column; }
    .sentiment-popup { width: 95%; }
}

/* 散戶多空比說明彈窗 */
.retail-info-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.retail-info-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 16px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(100, 116, 139, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.retail-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(100, 116, 139, 0.3);
}

.retail-info-title {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}

.retail-info-close {
    font-size: 28px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    padding: 5px 10px;
}

.retail-info-close:hover {
    color: #ef4444;
    transform: rotate(90deg);
}

.retail-info-section {
    margin-bottom: 25px;
}

.retail-info-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #60a5fa;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.retail-info-content {
    color: #cbd5e1;
    font-size: 14px;
    line-height: 1.8;
}

.retail-info-content strong {
    color: #e2e8f0;
}

.retail-signal-box {
    background: rgba(100, 116, 139, 0.2);
    border-radius: 8px;
    padding: 12px 15px;
    margin: 8px 0;
    border-left: 3px solid;
}

.retail-signal-box.bullish {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.retail-signal-box.bearish {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.retail-signal-box.neutral {
    border-color: #64748b;
    background: rgba(100, 116, 139, 0.1);
}

.retail-formula {
    background: rgba(30, 41, 59, 0.8);
    padding: 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    color: #fbbf24;
    font-size: 13px;
    margin: 10px 0;
}


        /* ==================== 手機版響應式修正 ==================== */
        /* ==================== 手機版響應式修正 ==================== */
        
        /* 平板以下 (< 768px) */
        @media (max-width: 768px) {
            .container {
                max-width: 100%;
                padding: 12px 0px;
            }
        
            /* 頭部調整 — Phase 1 fixed,手機放開高度允許換行 */
            body { padding-top: 120px; }   /* 手機 header wrap 後較高,保守值 */
            .header {
                height: auto;
                min-height: 56px;
                flex-wrap: wrap;
                padding: 8px;
                gap: 8px;
            }

            .header .logo {
                display: none;
            }
        
            .status {
                flex-direction: row;
                gap: 12px;
                font-size: 10px;
                width: 100%;
                justify-content: space-between;
            }
        
            /* 指標卡片 - 改為單欄 */
            .metrics-grid {
                grid-template-columns: 1fr;
                gap: 16px;
                margin-bottom: 20px;
            }
        
            .metric-card {
                padding: 16px;
            }
        
            .metric-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 8px;
                margin-bottom: 16px;
            }
        
            .metric-title {
                font-size: 12px;
            }
        
            .metric-date {
                font-size: 10px;
                padding: 3px 8px;
            }
        
            /* 數值顯示 - 縮小 */
            .metric-value {
                font-size: 48px;
                letter-spacing: -1px;
            }
        
            .metric-unit {
                font-size: 24px;
            }
        
            .metric-value-container {
                margin-bottom: 16px;
            }
        
            /* 詳細資訊 - 保持兩欄但縮小間距 */
            .metric-details {
                gap: 8px;
            }
        
            .detail-item {
                padding: 10px;
            }
        
            .detail-label {
                font-size: 10px;
            }
        
            .detail-value {
                font-size: 14px;
            }
        
            /* 圖表區域 - 改為單欄 */
            .charts-grid {
                grid-template-columns: 1fr;
                gap: 16px;
            }
        
            .retail-chart-full {
                grid-column: 1;
            }
        
            /* 圖表卡片內部調整 */
            .chart-card {
                padding: 16px;
            }
        
            .chart-header {
                margin-bottom: 12px;
            }
        
            .chart-title {
                font-size: 12px;
            }
        
            .info-icon {
                width: 16px;
                height: 16px;
                font-size: 11px;
            }
        
            /* Canvas 容器 - 確保不超出 */
            .chart-container {
                position: relative;
                height: 250px;
                width: 100%;
            
            }
        
            /* 確保 canvas 不超出容器 */
            .chart-container canvas {
                max-width: 100% !important;
                height: auto !important;
            }
        }
        
        /* 小手機 (< 480px) */
        @media (max-width: 480px) {
            .container {
                padding: 8px;
            }
        
            .header {
                padding: 12px 0;
                margin-bottom: 16px;
            }
        
            .logo {
                font-size: 18px;
            }
        
            .logo .monitor {
                display: block;
                margin-left: 0;
                margin-top: 4px;
            }
        
            .status {
                font-size: 9px;
                gap: 8px;
            }
        
            .metrics-grid {
                gap: 12px;
            }
        
            .metric-card {
                padding: 12px;
            }
        
            .metric-value {
                font-size: 36px;
            }
        
            .metric-unit {
                font-size: 18px;
            }
        
            .metric-details {
                grid-template-columns: 1fr;
                gap: 6px;
            }
        
            .detail-item {
                padding: 8px;
            }
        
            .detail-value {
                font-size: 13px;
            }
        
            .charts-grid {
                gap: 12px;
            }
        
            .chart-card {
                padding: 12px;
            }
        
            .chart-container {
                height: 200px;
            }
        }
        
        /* 通用修正 - 防止所有元素超出螢幕 */
        @media (max-width: 768px) {
            * {
                max-width: 100%;
            }
        
            img, canvas, video, iframe {
                max-width: 100%;
                height: auto;
            }
        
            /* 防止表格超出 */
            table {
                display: block;
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
            }
        
            /* 防止長文字撐開容器 */
            .metric-value, .detail-value, .chart-title {
                word-wrap: break-word;
                overflow-wrap: break-word;
            }
        }

/* 漲跌停區塊 - 手機版改為上下排列 */
@media (max-width: 768px) {
    .limit-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    
    .limit-card {
        width: 100%;
    }
}

/* 小手機進一步優化 */
@media (max-width: 480px) {
    .limit-grid {
        gap: 12px;
    }
    
    .limit-section-wrapper {
        padding: 12px;
    }
    
    .limit-main-title {
        font-size: 16px;
        margin-bottom: 12px;
    }
}

/* 國際商品期貨 - 手機版改為單欄 */
@media (max-width: 768px) {
    .commodities-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    
    .commodity-card {
        width: 100%;
    }
    
    .commodity-chart-container {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .commodities-grid {
        gap: 12px;
    }
    
    .commodities-section {
        padding: 12px;
    }
    
    .commodities-main-title {
        font-size: 16px;
    }
    
    .commodity-chart-container {
        height: 200px;
    }
    
    .commodity-price {
        font-size: 28px;
    }
}

/* ==================== 週轉率表格 - 手機版優化 ==================== */
@media (max-width: 768px) {
    /* 隱藏次要欄位: 產業(5), 標籤(8) */
    .turnover-table th:nth-child(5),
    .turnover-table th:nth-child(8),
    .turnover-table td:nth-child(5),
    .turnover-table td:nth-child(8) {
        display: none;
    }
    
    /* 縮小表格字體 */
    .turnover-table {
        font-size: 11px;
    }
    
    /* 調整欄位寬度 */
    .turnover-table th,
    .turnover-table td {
        padding: 8px 4px;
    }
    
    .turnover-table th:nth-child(1),
    .turnover-table td:nth-child(1) {
        width: 8%;  /* # */
    }
    
    .turnover-table th:nth-child(2),
    .turnover-table td:nth-child(2) {
        width: 20%;  /* 股票 */
        font-size: 10px;
    }
    
    .turnover-table th:nth-child(3),
    .turnover-table td:nth-child(3) {
        width: 18%;  /* 股價 */
    }
    
    .turnover-table th:nth-child(4),
    .turnover-table td:nth-child(4) {
        width: 18%;  /* 漲跌 */
    }
    
    .turnover-table th:nth-child(6),
    .turnover-table td:nth-child(6) {
        width: 18%;  /* 周轉率 */
    }
    
    .turnover-table th:nth-child(7),
    .turnover-table td:nth-child(7) {
        width: 18%;  /* 爆量分析 */
        font-size: 9px;
    }
    
    /* 標題區域優化 */
    .turnover-header {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }
    
    .turnover-title {
        font-size: 16px;
    }
    
    /* 統計區域改為 2x2 網格 */
    .turnover-stats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .turnover-stat-item {
        padding: 10px;
    }
    
    .turnover-stat-label {
        font-size: 10px;
    }
    
    .turnover-stat-value {
        font-size: 18px;
    }
}

/* 小手機進一步優化 */
@media (max-width: 480px) {
    /* 再隱藏爆量分析欄位 */
    .turnover-table th:nth-child(7),
    .turnover-table td:nth-child(7) {
        display: none;
    }
    
    /* 調整剩餘欄位寬度 */
    .turnover-table th:nth-child(2),
    .turnover-table td:nth-child(2) {
        width: 28%;  /* 股票 */
    }
    
    .turnover-table th:nth-child(3),
    .turnover-table td:nth-child(3) {
        width: 22%;  /* 股價 */
    }
    
    .turnover-table th:nth-child(4),
    .turnover-table td:nth-child(4) {
        width: 22%;  /* 漲跌 */
    }
    
    .turnover-table th:nth-child(6),
    .turnover-table td:nth-child(6) {
        width: 20%;  /* 周轉率 */
    }
    
    .turnover-table {
        font-size: 10px;
    }
    
    .turnover-table th,
    .turnover-table td {
        padding: 6px 2px;
    }
}

/* 手機版減少左右留白 */
@media (max-width: 768px) {
    .container {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
    
    body {
        padding: 120px 0 0 0 !important;
        margin: 0 !important;
    }
}

@media (max-width: 420px) {
    .container {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }
}

/* ==================== 修正所有 section 的手機版寬度 ==================== */
@media (max-width: 768px) {
    /* 移除 section 的最大寬度限制和過大 padding */
    .foreign-section,
    .limit-section-wrapper,
    .turnover-section,
    .commodities-section {
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 16px 8px !important;
        margin-top: 20px !important;
    }
    
    /* container 也要調整 */
    .container {
        max-width: 100% !important;
        padding: 12px 6px !important;
    }
    
    /* 外資項目內部 */
    .foreign-item {
        padding: 10px 6px !important;
        gap: 4px;
    }
}

@media (max-width: 420px) {
    .foreign-section,
    .limit-section-wrapper,
    .turnover-section,
    .commodities-section {
        padding: 12px 4px !important;
        margin-top: 16px !important;
    }
    
    .container {
        padding: 8px 4px !important;
    }
    
    .foreign-item {
        padding: 8px 4px !important;
        gap: 2px;
    }
}

/* ==================== 外資卡片手機版 padding 修正 ==================== */
@media (max-width: 768px) {
    .foreign-card {
        padding: 12px 6px !important;
        border-radius: 8px;
    }
    
    .foreign-card-title {
        font-size: 16px !important;
        margin-bottom: 10px !important;
    }
}

@media (max-width: 420px) {
    .foreign-card {
        padding: 10px 4px !important;
    }
    
    .foreign-card-title {
        font-size: 14px !important;
        margin-bottom: 8px !important;
    }
}

/* ==================== 精確修正限制寬度的元素 ==================== */
@media (max-width: 768px) {
    /* 週轉率區塊 - 移除 850px 限制 */
    .turnover-single-wrap {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* guide-panel-content - 移除 1400px 限制 */
    .guide-panel-content {
            z-index: 1;
        max-width: 100% !important;
        padding: 12px 6px !important;
    }
    
    /* legend-dot - 移除 600px 限制 */
    .legend-dot {
        max-width: 100% !important;
    }
}

@media (max-width: 420px) {
    .turnover-single-wrap,
    .guide-panel-content {
            z-index: 1;
        padding: 8px 4px !important;
    }
}

/* ==================== 外資產業詳細表格 - 手機版優化 ==================== */
@media (max-width: 768px) {
    /* 表格整體設定 */
    .industry-detail-table {
        font-size: 11px !important;
    }
    
    /* 表頭縮小 padding 和字體 */
    .industry-detail-table thead th {
        font-size: 11px !important;
        padding: 10px 4px !important;
    }
    
    /* tbody 縮小 padding 和字體 */
    .industry-detail-table tbody td {
        padding: 10px 4px !important;
        font-size: 11px !important;
    }
    
    /* 各欄位縮小字體 */
    .industry-detail-table .td-code {
        font-size: 11px !important;
    }
    
    .industry-detail-table .td-foreign {
        font-size: 11px !important;
    }
    
    .industry-detail-table .td-change {
        font-size: 11px !important;
    }
    
    /* 調整欄位寬度比例 */
    .industry-detail-table thead th:nth-child(1) { width: 13% !important; }
    .industry-detail-table thead th:nth-child(2) { width: 21% !important; }
    .industry-detail-table thead th:nth-child(3) { width: 32% !important; }
    .industry-detail-table thead th:nth-child(4) { width: 33% !important; }
}

@media (max-width: 420px) {
    .industry-detail-table {
        font-size: 10px !important;
    }
    
    .industry-detail-table thead th {
        font-size: 10px !important;
        padding: 8px 3px !important;
    }
    
    .industry-detail-table tbody td {
        padding: 8px 3px !important;
        font-size: 10px !important;
    }
    
    .industry-detail-table .td-code,
    .industry-detail-table .td-foreign,
    .industry-detail-table .td-change {
        font-size: 10px !important;
    }
}

/* ==================== 表頭文字換行修正 ==================== */
@media (max-width: 768px) {
    .industry-detail-table thead th {
        font-size: 10px !important;
        padding: 8px 3px !important;
        white-space: normal !important;
        word-break: keep-all !important;
        line-height: 1.4 !important;
        vertical-align: middle !important;
    }
}

/* ==================== 最終覆蓋 - 手機版極小 margin/padding ==================== */
@media (max-width: 768px) {
    /* 最優先級的容器設定 */
    body {
        margin: 0 !important;
        padding: 120px 0 0 0 !important;
    }
    
    .container {
        max-width: 100vw !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 8px 2px !important;
    }
    
    /* 所有卡片和區塊 */
    .metric-card,
    .chart-card,
    .foreign-section,
    .foreign-card,
    .limit-section-wrapper,
    .turnover-section,
    .commodities-section,
    .industry-block,
    .retail-chart-section {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

@media (max-width: 420px) {
    .container {
        padding: 6px 1px !important;
    }
}
.sort-icon {
    display: inline-block;
    width: 16px;
    text-align: center;
    font-size: 12px;
}

.data-update-date {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    font-weight: normal;
    margin-left: 8px;
}

/* ===== from dashboard.html <style> block #2 ===== */
/* 散戶對決區塊 CSS */
.retail-battle-section {
    margin-bottom: 40px;
}

.section-header {
    margin-bottom: 30px;
    text-align: center;
}

.section-header h2 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.battle-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    align-items: center;
}

.battle-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    position: relative;

}

.battle-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--card-accent);
}

.retail-card { --card-accent: var(--accent-cyan); }
.institutional-card { --card-accent: var(--accent-orange); }

.battle-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.battle-icon {
    font-size: 40px;
}

.battle-title h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.battle-title p {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.battle-gauge {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
}

.gauge-visual {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.gauge-circle { transform: rotate(-90deg); }
.gauge-bg {
    fill: none;
    stroke: var(--bg-secondary);
    stroke-width: 12;
}
.gauge-fill {
    fill: none;
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease, stroke 0.3s ease;
}

.gauge-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.gauge-score {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    transition: color 0.3s ease;
}

.gauge-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.battle-info {
    flex: 1;
}

.battle-sentiment {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.battle-signal {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
    opacity: 0.8;
}

.battle-positions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.position-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 15px;
}

.position-row.net {
    border: 1px solid var(--border-color);
    background: transparent;
    margin-top: 4px;
    font-weight: 600;
}

.position-label {
    color: var(--text-secondary);
}

.position-value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

.position-value.long { color: var(--accent-green); }
.position-value.short { color: var(--accent-red); }

.battle-advice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: rgba(0, 217, 255, 0.1);
    border-left: 3px solid var(--accent-cyan);
    border-radius: 8px;
    margin-top: 20px;
}

.advice-icon {
    font-size: 24px;
}

.advice-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
}

.vs-separator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.vs-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-green));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 900;
    color: var(--bg-primary);
    box-shadow: 0 4px 20px rgba(0, 217, 255, 0.3);
}

.vs-line {
    width: 2px;
    height: 100px;
    background: linear-gradient(180deg, 
        var(--accent-cyan), 
        transparent, 
        var(--accent-orange)
    );
}

.inverse-indicator-note {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 10px 10px;
    background: rgba(255, 153, 0, 0.1);
    border: 1px solid rgba(255, 153, 0, 0.3);
    border-radius: 12px;
    margin-top: 30px;
}

.note-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.note-content {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.note-content strong {
    color: var(--accent-orange);
}

@media (max-width: 1200px) {
    .battle-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .vs-separator {
        flex-direction: row;
        justify-content: center;
    }
    
    .vs-line {
        width: 100px;
        height: 2px;
    }
}

@media (max-width: 768px) {
    .battle-gauge {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .gauge-visual {
        width: 100px;
        height: 100px;
    }
    
    .gauge-score {
        font-size: 24px;
    }
    
    .battle-sentiment {
        font-size: 20px;
    }
}

/* 雙情緒圓環 */
.dual-gauge-section { margin-bottom: 40px; }
.dual-gauge-header { text-align: center; margin-bottom: 30px; }
.dual-gauge-header h2 {
    font-size: 28px; font-weight: 800; margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-green));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.dual-gauge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.gauge-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 16px; padding: 30px; position: relative; overflow: hidden;
}
.gauge-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; }
.gauge-card.taiwan::before { background: linear-gradient(90deg, var(--accent-cyan), var(--accent-green)); }
.gauge-card.usa::before { background: linear-gradient(90deg, #ea384d, #16c784); }
.gauge-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.gauge-flag { font-size: 32px; }
.gauge-card-title h3 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.gauge-card-title p { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; }
.fear-greed-gauge { position: relative; width: 100%; max-width: 280px; height: 200px; margin: 20px auto; }
.gauge-arc { position: relative; width: 100%; height: 140px; overflow: hidden; }
.gauge-background {
    width: 280px; height: 140px; border-radius: 280px 280px 0 0;
    background: linear-gradient(90deg, #ea384d 0%, #f5991c 20%, #ffd54f 40%, #93d258 60%, #16c784 100%);
    position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
}
.gauge-inner {
    width: 220px; height: 110px; border-radius: 220px 220px 0 0;
    background: #161b22; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
}
.gauge-needle {
    width: 4px;
    height: 22px;
    background: #fff;
    position: absolute;
    bottom: 114px;
    left: 50%;
    margin-left: -2px;
    transform-origin: 50% 114px;
    transform: rotate(-90deg);
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
    z-index: 15;
}
.gauge-needle::after { content: ''; }
.gauge-center-dot { display: none; }
.gauge-labels {
    position: absolute; width: 100%; bottom: 10px; display: flex; justify-content: space-between;
    padding: 0 10px; font-size: 12px; color: var(--text-secondary);
    text-transform: uppercase; font-weight: 600; letter-spacing: 1px;
}
.gauge-value { position: absolute; bottom: 35px; left: 50%; transform: translateX(-50%); text-align: center; }
.gauge-score-large { font-size: 42px; font-weight: 900; line-height: 1; color: var(--text-primary); }
.gauge-rating { font-size: 15px; font-weight: 700; text-transform: uppercase; margin-top: 4px; letter-spacing: 2px; }
.tw-rating-extreme-pessimistic { color: #ea384d; }
.tw-rating-pessimistic { color: #f5991c; }
.tw-rating-neutral { color: #ffd54f; }
.tw-rating-optimistic { color: #93d258; }
.tw-rating-extreme-optimistic { color: #16c784; }
.us-rating-extreme-fear { color: #ea384d; }
.us-rating-fear { color: #f5991c; }
.us-rating-neutral { color: #ffd54f; }
.us-rating-greed { color: #93d258; }
.us-rating-extreme-greed { color: #16c784; }
.gauge-history { margin-top: 20px; padding: 15px; background: var(--bg-secondary); border-radius: 8px; }
.gauge-history-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid var(--border-color);
}
.gauge-history-item:last-child { border-bottom: none; }
.gauge-history-label { font-size: 12px; color: var(--text-secondary); }
.gauge-history-value { display: flex; align-items: center; gap: 8px; }
.gauge-history-score { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 600; }
.gauge-history-badge {
    padding: 2px 8px; border-radius: 4px; font-size: 12px;
    font-weight: 700; text-transform: uppercase;
}
.badge-extreme-fear { background: rgba(234, 56, 77, 0.2); color: #ea384d; }
.badge-fear { background: rgba(245, 153, 28, 0.2); color: #f5991c; }
.badge-neutral { background: rgba(255, 213, 79, 0.2); color: #ffd54f; }
.badge-greed { background: rgba(147, 210, 88, 0.2); color: #93d258; }
.badge-extreme-greed { background: rgba(22, 199, 132, 0.2); color: #16c784; }
@media (max-width: 1024px) { .dual-gauge-grid { grid-template-columns: 1fr; gap: 30px; } }


/* ==================== 周轉率過熱監控 ==================== */
.turnover-section {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.turnover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255,255,255,0.1);
}

.turnover-title {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
}

.turnover-stats {
    display: flex;
    gap: 20px;
}

.turnover-stat-item {
    text-align: center;
    padding: 10px 20px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
}

.turnover-stat-label {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 5px;
}

.turnover-stat-value {
    font-size: 24px;
    font-weight: 700;
}

.stat-danger { color: #ff4757; }
.stat-severe { color: #ff6348; }
.stat-warning { color: #ffa502; }
.stat-normal { color: #1dd1a1; }

.empty-state {
    text-align: center;
    padding: 40px;
    color: rgba(255,255,255,0.5);
    font-size: 16px;
}

@media (max-width: 768px) {
    .turnover-header {
        flex-direction: column;
        gap: 20px;
    }
    
    .turnover-stats {
        width: 100%;
        justify-content: space-around;
    }
    
    .turnover-single-wrap {
        max-width: 100%;
    }
}



/* 爆量分析欄位 */
.surge-analysis {
    font-size: 14px;
    line-height: 1.8;
}

.surge-5d {
    display: block;
    color: rgba(255,255,255,0.9);
    font-weight: 600;
    font-size: 14px;
}

.surge-20d {
    display: block;
    color: rgba(255,255,255,0.5);
    font-size: 11px;
    margin-top: 2px;
}


/* ==================== 商品期貨走勢 ==================== */
.commodities-section {
    margin-top: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.commodities-main-title {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 30px;
    text-align: center;
}

.commodities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    max-width: 1600px;
    margin: 0 auto;
}

.commodity-card {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 10px 10px;
    border-top: 3px solid;
    margin-bottom: 20px;
}

.commodity-card.copper {
    border-color: #ff9f43;
}

.commodity-card.gold {
    border-color: #ffd700;
}
.commodity-card.silver {
    border-color: #c0c0c0;
}

.commodity-card.oil {
    border-color: #2d3436;
}


.commodity-card.steel {
    border-color: #7f8c8d;
}

.commodity-title.steel { color: #95a5a6; }
.commodity-header {
    margin-bottom: 15px;
}

.commodity-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.commodity-title.silver { color: #c0c0c0; }
.commodity-title.copper { color: #ff9f43; }
.commodity-title.gold { color: #ffd700; }
.commodity-title.oil { color: #95a5a6; }

.commodity-unit {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}

.commodity-price-info {
    margin: 15px 0;
}

.commodity-price {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
}

.commodity-change {
    font-size: 14px;
    font-weight: 600;
    margin-top: 5px;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.commodity-change.positive {
    background: rgba(29, 209, 161, 0.2);
    color: #1dd1a1;
}

.commodity-change.negative {
    background: rgba(255, 71, 87, 0.2);
    color: #ff4757;
}

.commodity-chart {
    height: 340px;
    margin-top: 15px;
}

@media (max-width: 1200px) {
    .commodities-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .commodity-chart {
        height: 250px;
    }
}

/* 產業分析 */
.industry-analysis {
    margin-top: 30px;
    padding: 10px 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
}

.industry-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 15px;
}

/* 散戶多空比說明彈窗 */
.retail-info-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.retail-info-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 16px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(100, 116, 139, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.retail-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(100, 116, 139, 0.3);
}

.retail-info-title {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}

.retail-info-close {
    font-size: 28px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    padding: 5px 10px;
}

.retail-info-close:hover {
    color: #ef4444;
    transform: rotate(90deg);
}

.retail-info-section {
    margin-bottom: 25px;
}

.retail-info-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #60a5fa;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.retail-info-content {
    color: #cbd5e1;
    font-size: 14px;
    line-height: 1.8;
}

.retail-info-content strong {
    color: #e2e8f0;
}

.retail-signal-box {
    background: rgba(100, 116, 139, 0.2);
    border-radius: 8px;
    padding: 12px 15px;
    margin: 8px 0;
    border-left: 3px solid;
}

.retail-signal-box.bullish {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.retail-signal-box.bearish {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.retail-signal-box.neutral {
    border-color: #64748b;
    background: rgba(100, 116, 139, 0.1);
}

.retail-formula {
    background: rgba(30, 41, 59, 0.8);
    padding: 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    color: #fbbf24;
    font-size: 13px;
    margin: 10px 0;
}


        /* ==================== 手機版響應式修正 ==================== */
        /* ==================== 手機版響應式修正 ==================== */
        
        /* 平板以下 (< 768px) */
        @media (max-width: 768px) {
            .container {
                max-width: 100%;
                padding: 12px 0px;
            }
        
            /* 頭部調整 — Phase 1 fixed,手機放開高度允許換行 */
            body { padding-top: 120px; }   /* 手機 header wrap 後較高,保守值 */
            .header {
                height: auto;
                min-height: 56px;
                flex-wrap: wrap;
                padding: 8px;
                gap: 8px;
            }

            .header .logo {
                display: none;
            }
        
            .status {
                flex-direction: row;
                gap: 12px;
                font-size: 10px;
                width: 100%;
                justify-content: space-between;
            }
        
            /* 指標卡片 - 改為單欄 */
            .metrics-grid {
                grid-template-columns: 1fr;
                gap: 16px;
                margin-bottom: 20px;
            }
        
            .metric-card {
                padding: 16px;
            }
        
            .metric-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 8px;
                margin-bottom: 16px;
            }
        
            .metric-title {
                font-size: 12px;
            }
        
            .metric-date {
                font-size: 10px;
                padding: 3px 8px;
            }
        
            /* 數值顯示 - 縮小 */
            .metric-value {
                font-size: 48px;
                letter-spacing: -1px;
            }
        
            .metric-unit {
                font-size: 24px;
            }
        
            .metric-value-container {
                margin-bottom: 16px;
            }
        
            /* 詳細資訊 - 保持兩欄但縮小間距 */
            .metric-details {
                gap: 8px;
            }
        
            .detail-item {
                padding: 10px;
            }
        
            .detail-label {
                font-size: 10px;
            }
        
            .detail-value {
                font-size: 14px;
            }
        
            /* 圖表區域 - 改為單欄 */
            .charts-grid {
                grid-template-columns: 1fr;
                gap: 16px;
            }
        
            .retail-chart-full {
                grid-column: 1;
            }
        
            /* 圖表卡片內部調整 */
            .chart-card {
                padding: 16px;
            }
        
            .chart-header {
                margin-bottom: 12px;
            }
        
            .chart-title {
                font-size: 12px;
            }
        
            .info-icon {
                width: 16px;
                height: 16px;
                font-size: 11px;
            }
        
            /* Canvas 容器 - 確保不超出 */
            .chart-container {
                position: relative;
                height: 250px;
                width: 100%;
            
            }
        
            /* 確保 canvas 不超出容器 */
            .chart-container canvas {
                max-width: 100% !important;
                height: auto !important;
            }
        }
        
        /* 小手機 (< 480px) */
        @media (max-width: 480px) {
            .container {
                padding: 8px;
            }
        
            .header {
                padding: 12px 0;
                margin-bottom: 16px;
            }
        
            .logo {
                font-size: 18px;
            }
        
            .logo .monitor {
                display: block;
                margin-left: 0;
                margin-top: 4px;
            }
        
            .status {
                font-size: 9px;
                gap: 8px;
            }
        
            .metrics-grid {
                gap: 12px;
            }
        
            .metric-card {
                padding: 12px;
            }
        
            .metric-value {
                font-size: 36px;
            }
        
            .metric-unit {
                font-size: 18px;
            }
        
            .metric-details {
                grid-template-columns: 1fr;
                gap: 6px;
            }
        
            .detail-item {
                padding: 8px;
            }
        
            .detail-value {
                font-size: 13px;
            }
        
            .charts-grid {
                gap: 12px;
            }
        
            .chart-card {
                padding: 12px;
            }
        
            .chart-container {
                height: 200px;
            }
        }
        
        /* 通用修正 - 防止所有元素超出螢幕 */
        @media (max-width: 768px) {
            * {
                max-width: 100%;
            }
        
            img, canvas, video, iframe {
                max-width: 100%;
                height: auto;
            }
        
            /* 防止表格超出 */
            table {
                display: block;
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
            }
        
            /* 防止長文字撐開容器 */
            .metric-value, .detail-value, .chart-title {
                word-wrap: break-word;
                overflow-wrap: break-word;
            }
        }

/* 漲跌停區塊 - 手機版改為上下排列 */
@media (max-width: 768px) {
    .limit-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    
    .limit-card {
        width: 100%;
    }
}

/* 小手機進一步優化 */
@media (max-width: 480px) {
    .limit-grid {
        gap: 12px;
    }
    
    .limit-section-wrapper {
        padding: 12px;
    }
    
    .limit-main-title {
        font-size: 16px;
        margin-bottom: 12px;
    }
}

/* 國際商品期貨 - 手機版改為單欄 */
@media (max-width: 768px) {
    .commodities-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    
    .commodity-card {
        width: 100%;
    }
    
    .commodity-chart-container {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .commodities-grid {
        gap: 12px;
    }
    
    .commodities-section {
        padding: 12px;
    }
    
    .commodities-main-title {
        font-size: 16px;
    }
    
    .commodity-chart-container {
        height: 200px;
    }
    
    .commodity-price {
        font-size: 28px;
    }
}

/* ==================== 週轉率表格 - 手機版優化 ==================== */
@media (max-width: 768px) {
    /* 隱藏次要欄位: 產業(5), 標籤(8) */
    .turnover-table th:nth-child(5),
    .turnover-table th:nth-child(8),
    .turnover-table td:nth-child(5),
    .turnover-table td:nth-child(8) {
        display: none;
    }
    
    /* 縮小表格字體 */
    .turnover-table {
        font-size: 11px;
    }
    
    /* 調整欄位寬度 */
    .turnover-table th,
    .turnover-table td {
        padding: 8px 4px;
    }
    
    .turnover-table th:nth-child(1),
    .turnover-table td:nth-child(1) {
        width: 8%;  /* # */
    }
    
    .turnover-table th:nth-child(2),
    .turnover-table td:nth-child(2) {
        width: 20%;  /* 股票 */
        font-size: 10px;
    }
    
    .turnover-table th:nth-child(3),
    .turnover-table td:nth-child(3) {
        width: 18%;  /* 股價 */
    }
    
    .turnover-table th:nth-child(4),
    .turnover-table td:nth-child(4) {
        width: 18%;  /* 漲跌 */
    }
    
    .turnover-table th:nth-child(6),
    .turnover-table td:nth-child(6) {
        width: 18%;  /* 周轉率 */
    }
    
    .turnover-table th:nth-child(7),
    .turnover-table td:nth-child(7) {
        width: 18%;  /* 爆量分析 */
        font-size: 9px;
    }
    
    /* 標題區域優化 */
    .turnover-header {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }
    
    .turnover-title {
        font-size: 16px;
    }
    
    /* 統計區域改為 2x2 網格 */
    .turnover-stats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .turnover-stat-item {
        padding: 10px;
    }
    
    .turnover-stat-label {
        font-size: 10px;
    }
    
    .turnover-stat-value {
        font-size: 18px;
    }
}

/* 小手機進一步優化 */
@media (max-width: 480px) {
    /* 再隱藏爆量分析欄位 */
    .turnover-table th:nth-child(7),
    .turnover-table td:nth-child(7) {
        display: none;
    }
    
    /* 調整剩餘欄位寬度 */
    .turnover-table th:nth-child(2),
    .turnover-table td:nth-child(2) {
        width: 28%;  /* 股票 */
    }
    
    .turnover-table th:nth-child(3),
    .turnover-table td:nth-child(3) {
        width: 22%;  /* 股價 */
    }
    
    .turnover-table th:nth-child(4),
    .turnover-table td:nth-child(4) {
        width: 22%;  /* 漲跌 */
    }
    
    .turnover-table th:nth-child(6),
    .turnover-table td:nth-child(6) {
        width: 20%;  /* 周轉率 */
    }
    
    .turnover-table {
        font-size: 10px;
    }
    
    .turnover-table th,
    .turnover-table td {
        padding: 6px 2px;
    }
}

/* 手機版減少左右留白 */
@media (max-width: 768px) {
    .container {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
    
    body {
        padding: 120px 0 0 0 !important;
        margin: 0 !important;
    }
}

@media (max-width: 420px) {
    .container {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }
}

/* ==================== 修正所有 section 的手機版寬度 ==================== */
@media (max-width: 768px) {
    /* 移除 section 的最大寬度限制和過大 padding */
    .foreign-section,
    .limit-section-wrapper,
    .turnover-section,
    .commodities-section {
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 16px 8px !important;
        margin-top: 20px !important;
    }
    
    /* container 也要調整 */
    .container {
        max-width: 100% !important;
        padding: 12px 6px !important;
    }
    
    /* 外資項目內部 */
    .foreign-item {
        padding: 10px 6px !important;
        gap: 4px;
    }
}

@media (max-width: 420px) {
    .foreign-section,
    .limit-section-wrapper,
    .turnover-section,
    .commodities-section {
        padding: 12px 4px !important;
        margin-top: 16px !important;
    }
    
    .container {
        padding: 8px 4px !important;
    }
    
    .foreign-item {
        padding: 8px 4px !important;
        gap: 2px;
    }
}

/* ==================== 外資卡片手機版 padding 修正 ==================== */
@media (max-width: 768px) {
    .foreign-card {
        padding: 12px 6px !important;
        border-radius: 8px;
    }
    
    .foreign-card-title {
        font-size: 16px !important;
        margin-bottom: 10px !important;
    }
}

@media (max-width: 420px) {
    .foreign-card {
        padding: 10px 4px !important;
    }
    
    .foreign-card-title {
        font-size: 14px !important;
        margin-bottom: 8px !important;
    }
}

/* ==================== 精確修正限制寬度的元素 ==================== */
@media (max-width: 768px) {
    /* 週轉率區塊 - 移除 850px 限制 */
    .turnover-single-wrap {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* guide-panel-content - 移除 1400px 限制 */
    .guide-panel-content {
            z-index: 1;
        max-width: 100% !important;
        padding: 12px 6px !important;
    }
    
    /* legend-dot - 移除 600px 限制 */
    .legend-dot {
        max-width: 100% !important;
    }
}

@media (max-width: 420px) {
    .turnover-single-wrap,
    .guide-panel-content {
            z-index: 1;
        padding: 8px 4px !important;
    }
}

/* ==================== 外資產業詳細表格 - 手機版優化 ==================== */
@media (max-width: 768px) {
    /* 表格整體設定 */
    .industry-detail-table {
        font-size: 11px !important;
    }
    
    /* 表頭縮小 padding 和字體 */
    .industry-detail-table thead th {
        font-size: 11px !important;
        padding: 10px 4px !important;
    }
    
    /* tbody 縮小 padding 和字體 */
    .industry-detail-table tbody td {
        padding: 10px 4px !important;
        font-size: 11px !important;
    }
    
    /* 各欄位縮小字體 */
    .industry-detail-table .td-code {
        font-size: 11px !important;
    }
    
    .industry-detail-table .td-foreign {
        font-size: 11px !important;
    }
    
    .industry-detail-table .td-change {
        font-size: 11px !important;
    }
    
    /* 調整欄位寬度比例 */
    .industry-detail-table thead th:nth-child(1) { width: 13% !important; }
    .industry-detail-table thead th:nth-child(2) { width: 21% !important; }
    .industry-detail-table thead th:nth-child(3) { width: 32% !important; }
    .industry-detail-table thead th:nth-child(4) { width: 33% !important; }
}

@media (max-width: 420px) {
    .industry-detail-table {
        font-size: 10px !important;
    }
    
    .industry-detail-table thead th {
        font-size: 10px !important;
        padding: 8px 3px !important;
    }
    
    .industry-detail-table tbody td {
        padding: 8px 3px !important;
        font-size: 10px !important;
    }
    
    .industry-detail-table .td-code,
    .industry-detail-table .td-foreign,
    .industry-detail-table .td-change {
        font-size: 10px !important;
    }
}

/* ==================== 表頭文字換行修正 ==================== */
@media (max-width: 768px) {
    .industry-detail-table thead th {
        font-size: 10px !important;
        padding: 8px 3px !important;
        white-space: normal !important;
        word-break: keep-all !important;
        line-height: 1.4 !important;
        vertical-align: middle !important;
    }
}

/* ==================== 最終覆蓋 - 手機版極小 margin/padding ==================== */
@media (max-width: 768px) {
    /* 最優先級的容器設定 */
    body {
        margin: 0 !important;
        padding: 120px 0 0 0 !important;
    }
    
    .container {
        max-width: 100vw !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 8px 2px !important;
    }
    
    /* 所有卡片和區塊 */
    .metric-card,
    .chart-card,
    .foreign-section,
    .foreign-card,
    .limit-section-wrapper,
    .turnover-section,
    .commodities-section,
    .industry-block,
    .retail-chart-section {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

@media (max-width: 420px) {
    .container {
        padding: 6px 1px !important;
    }
}
.sort-icon {
    display: inline-block;
    width: 16px;
    text-align: center;
    font-size: 12px;
}

/* ───── 回檔買點雷達 ───── */
.pullback-radar {
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}
.pullback-radar .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}
.pullback-radar .section-title {
    font-size: 18px;
    font-weight: 700;
    color: #e6edf3;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.pullback-radar .section-title .badge {
    background: #1f6feb;
    color: #fff;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}
.pullback-radar .strategy-tag {
    background: rgba(88,166,255,0.12);
    color: #58a6ff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    border: 1px solid rgba(88,166,255,0.25);
    font-family: 'JetBrains Mono', monospace;
}
.pullback-radar .section-subtitle {
    color: #8b949e;
    font-size: 13px;
}
.pullback-radar .update-time {
    color: #484f58;
    font-size: 12px;
}

/* 大盤狀態列 */
.pullback-summary {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.pullback-summary .stat-pill {
    background: #161b22;
    border: 1px solid #30363d;
    color: #8b949e;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.pullback-summary .stat-pill strong {
    color: #e6edf3;
    font-size: 14px;
    font-weight: 700;
}
.pullback-summary .stat-pill.bullish strong { color: #f85149; }   /* 台股紅漲 */
.pullback-summary .stat-pill.bearish strong { color: #3fb950; }   /* 台股綠跌 */
.pullback-summary .stat-pill.signal strong  { color: #d29922; }

/* 表格 */
.pullback-table-wrap { overflow-x: auto; }
.pullback-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-family: 'JetBrains Mono', 'Noto Sans TC', monospace;
}
.pullback-table th {
    text-align: left;
    color: #8b949e;
    padding: 8px 10px;
    border-bottom: 1px solid #21262d;
    font-weight: 600;
    font-size: 12px;
    background: #0d1117;
    position: sticky;
    top: 0;
}
.pullback-table th.right { text-align: right; }
.pullback-table td {
    padding: 10px;
    border-bottom: 1px solid #161b22;
    color: #e6edf3;
    vertical-align: middle;
}
.pullback-table td.right { text-align: right; }
.pullback-table tr:hover { background: #161b22; }
.pullback-table .stock-code {
    color: #58a6ff;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}
.pullback-table .stock-code:hover { text-decoration: underline; cursor: pointer; }
.pullback-table .stock-name { color: #e6edf3; }
.pullback-table .price-col { color: #e6edf3; }

/* 漲跌色（台股紅漲綠跌）*/
.pullback-table .change-up    { color: #f85149; font-weight: 700; }
.pullback-table .change-down  { color: #3fb950; font-weight: 700; }
.pullback-table .change-flat  { color: #8b949e; }

/* MACD/K 數值 */
.pullback-table .indicator-val {
    font-family: 'JetBrains Mono', monospace;
    color: #8b949e;
    font-size: 12px;
}

.pullback-table th.center { text-align: center; }
.pullback-table td.center { text-align: center; }

/* D-tag（持續天數標籤） */
.pullback-d-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    min-width: 32px;
    text-align: center;
}
.pullback-d-tag.d-new {
    background: rgba(255,149,0,0.18);
    color: #ff9500;
    border: 1px solid rgba(255,149,0,0.4);
    /* 輕微脈動，提示是新的 */
    animation: pullback-d-pulse 2s ease-in-out infinite;
}
.pullback-d-tag.d-active {
    background: rgba(56,139,253,0.15);
    color: #58a6ff;
    border: 1px solid rgba(56,139,253,0.3);
}
.pullback-d-tag.d-mature {
    background: rgba(139,148,158,0.1);
    color: #8b949e;
    border: 1px solid rgba(139,148,158,0.25);
}

@keyframes pullback-d-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,149,0,0.4); }
    50%      { box-shadow: 0 0 0 4px rgba(255,149,0,0); }
}

/* 來源徽章群 */
.pullback-source-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.pullback-source-tag {
    display: inline-block;
    padding: 1px 6px;
    font-size: 10px;
    background: rgba(56,139,253,0.1);
    color: #58a6ff;
    border-radius: 4px;
    border: 1px solid rgba(56,139,253,0.2);
    font-weight: 500;
}

/* 空狀態 */
.pullback-empty {
    text-align: center;
    padding: 40px 20px;
    color: #484f58;
    font-size: 13px;
}
.pullback-empty .hint {
    display: block;
    margin-top: 8px;
    font-size: 11px;
    color: #484f58;
}

/* 警語列 */
.pullback-disclaimer {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(210,153,34,0.08);
    border: 1px solid rgba(210,153,34,0.2);
    border-radius: 8px;
    color: #d29922;
    font-size: 12px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.5;
}
.pullback-disclaimer-icon {
    flex-shrink: 0;
    font-size: 14px;
}

/* RWD */
@media (max-width: 768px) {
    .pullback-radar { padding: 14px; }
    .pullback-table .hide-mobile { display: none; }
    .pullback-table { font-size: 12px; }
    .pullback-table th,
    .pullback-table td { padding: 8px 6px; }
}

/* ── 題材輪動雷達 ── */
.theme-radar {
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    max-width: 100%;
    box-sizing: border-box;
}
.theme-radar .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}
.theme-radar .section-title {
    font-size: 18px;
    font-weight: 700;
    color: #e6edf3;
    display: flex;
    align-items: center;
    gap: 8px;
}
.theme-radar .section-title .badge {
    background: #1f6feb;
    color: #fff;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}
.theme-radar .section-subtitle { color: #8b949e; font-size: 13px; }
.theme-radar .update-time { color: #484f58; font-size: 12px; }

.theme-radar-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.theme-radar-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.theme-radar-table th {
    background: #161b22;
    color: #8b949e;
    padding: 8px 10px;
    text-align: center;
    font-weight: 600;
    border-bottom: 1px solid #21262d;
    white-space: nowrap;
}
.theme-radar-table th.left { text-align: left; }
.theme-radar-table th.right { text-align: right; }

.theme-radar-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #161b22;
    vertical-align: middle;
    white-space: nowrap;
}
.theme-radar-table tr.tr-row { cursor: pointer; transition: background 0.15s; }
.theme-radar-table tr.tr-row:hover td { background: #161b22; }
.theme-radar-table tr.tr-row.expanded td { background: #161b22; }

.theme-radar-table .rank-col { color: #484f58; font-size: 12px; text-align: center; width: 32px; }
.theme-radar-table .caret-col { width: 24px; text-align: center; }
.theme-radar-table .theme-col {
    color: #e6edf3;
    font-weight: 600;
    text-align: left;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tr-caret {
    display: inline-block;
    color: #484f58;
    font-size: 10px;
    transition: transform 0.2s;
}
.tr-row.expanded .tr-caret { transform: rotate(90deg); color: #58a6ff; }

/* 狀態徽章 (深色配色) */
.tr-status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.tr-status-main    { background: rgba(248,81,73,0.15);  color: #f85149; border: 1px solid rgba(248,81,73,0.3); }
.tr-status-warn    { background: rgba(210,153,34,0.15); color: #d29922; border: 1px solid rgba(210,153,34,0.3); }
.tr-status-catchup { background: rgba(255,140,40,0.15); color: #ff9947; border: 1px solid rgba(255,140,40,0.3); }
.tr-status-strong  { background: rgba(63,185,80,0.15);  color: #3fb950; border: 1px solid rgba(63,185,80,0.3); }
.tr-status-watch   { background: rgba(139,148,158,0.1); color: #8b949e; border: 1px solid rgba(139,148,158,0.25); }
.tr-status-fade    { background: rgba(56,139,253,0.12); color: #58a6ff; border: 1px solid rgba(56,139,253,0.3); }
.tr-status-hot     { background: rgba(218,54,51,0.20); color: #da3633; border: 1px solid rgba(218,54,51,0.55); }
.tr-status-flat    { background: rgba(163,113,247,0.12); color: #a371f7; border: 1px solid rgba(163,113,247,0.3); }

/* 漲跌幅顏色 (台股配色: 紅漲綠跌, 對齊主流股雷達 .change-up/.change-down) */
.tr-pct-strong-up   { color: #da3633; font-weight: 600; text-align: right; }  /* >=+5% 深紅 */
.tr-pct-up          { color: #f85149; text-align: right; }                     /* 0~+5% 標準紅 */
.tr-pct-down        { color: #3fb950; text-align: right; }                     /* -5~0% 標準綠 */
.tr-pct-strong-down { color: #2da44e; font-weight: 600; text-align: right; }   /* <=-5% 深綠 */
.tr-pct-flat        { color: #8b949e; text-align: right; }

.tr-breadth-cell {
    color: #8b949e;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.tr-foreign-cell {
    color: #8b949e;
    text-align: center;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
.tr-foreign-cell .has-double {
    color: #d29922;
    font-weight: 700;
}

/* 展開區塊 - 個股細節 */
tr.tr-detail-row { display: none; }
tr.tr-detail-row.show { display: table-row; }
tr.tr-detail-row td {
    background: #0a0d12 !important;
    padding: 8px 16px 14px !important;
    border-bottom: 1px solid #21262d;
}
.tr-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.tr-detail-table td {
    padding: 5px 6px !important;
    border: none !important;
    background: transparent !important;
    color: #8b949e;
}
.tr-detail-table tr:hover td { background: rgba(56,139,253,0.05) !important; }
.tr-detail-table .tr-arrow-up   { color: #f85149; }
.tr-detail-table .tr-arrow-down { color: #3fb950; }
.tr-detail-table .stock-code-link {
    color: #58a6ff;
    text-decoration: none;
    font-weight: 600;
}
.tr-detail-table .stock-code-link:hover { text-decoration: underline; color: #79c0ff; }
.tr-detail-table .stock-name-cell { color: #e6edf3; }

/* 雙買 / 法人徽章 */
.tr-buy-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 4px;
    vertical-align: middle;
}
.tr-buy-double  { background: rgba(210,153,34,0.2); color: #d29922; border: 1px solid rgba(210,153,34,0.3); }
.tr-buy-foreign { background: rgba(63,185,80,0.15); color: #3fb950; }
.tr-buy-trust   { background: rgba(56,139,253,0.15); color: #58a6ff; }
.tr-tier {
    display: inline-block;
    margin-right: 6px;
    font-size: 11px;
    font-weight: 600;
    vertical-align: middle;
    white-space: nowrap;
}
.tr-tier-leader    { color: #a371f7; text-shadow: 0 0 6px rgba(163,113,247,0.45); }
.tr-tier-main      { color: #39c5cf; }
.tr-tier-satellite { color: #7d8590; }

.tr-loading, .tr-error {
    text-align: center;
    color: #484f58;
    padding: 40px;
    font-size: 14px;
}
.tr-error { color: #f85149; }

@media (max-width: 768px) {
    .theme-radar { padding: 14px; }
    .theme-radar-table { font-size: 12px; }
    .theme-radar-table th,
    .theme-radar-table td { padding: 7px 6px; }
    .tr-status-pill { font-size: 10px; padding: 2px 7px; }
    /* 手機隱藏「加速」「寬度」, 保留最關鍵 */
    .theme-radar-table .tr-col-accel,
    .theme-radar-table .tr-col-breadth { display: none; }
}

/* ───── 新高雷達 ───── */
.new-high-radar {
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}
.new-high-radar .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}
.new-high-radar .section-title {
    font-size: 18px;
    font-weight: 700;
    color: #e6edf3;
    display: flex;
    align-items: center;
    gap: 8px;
}
.new-high-radar .section-title .badge {
    background: #1f6feb;
    color: #fff;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}
.new-high-radar .section-subtitle { color: #8b949e; font-size: 13px; }
.new-high-radar .update-time { color: #484f58; font-size: 12px; }

/* 摘要統計列 */
.new-high-summary {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.new-high-summary .stat-pill {
    background: #161b22;
    border: 1px solid #30363d;
    color: #8b949e;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.new-high-summary .stat-pill strong {
    color: #e6edf3;
    font-size: 15px;
    font-weight: 700;
}
.new-high-summary .stat-pill.gold strong { color: #d29922; }
.new-high-summary .stat-pill.fire strong { color: #f85149; }

/* 篩選控制列 */
.new-high-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    align-items: center;
}
.new-high-controls .ctrl-btn {
    background: #161b22;
    border: 1px solid #30363d;
    color: #8b949e;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.new-high-controls .ctrl-btn.active,
.new-high-controls .ctrl-btn:hover {
    border-color: #388bfd;
    color: #388bfd;
    background: #1c2d42;
}

/* 表格 */
.new-high-table-wrap { overflow-x: auto; }
.new-high-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.new-high-table th {
    background: #161b22;
    color: #8b949e;
    padding: 8px 10px;
    text-align: center;
    font-weight: 600;
    border-bottom: 1px solid #21262d;
    white-space: nowrap;
}
.new-high-table th:nth-child(1),
.new-high-table th:nth-child(2),
.new-high-table th:nth-child(3),
.new-high-table th:nth-child(4) { text-align: left; }
.new-high-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #161b22;
    vertical-align: middle;
    white-space: nowrap;
}
.new-high-table tr:hover td { background: #161b22; }
.new-high-table .rank-col { color: #484f58; font-size: 12px; text-align: center; width: 32px; }
.new-high-table .star-col { width: 32px; text-align: center; padding: 9px 4px; }
.new-high-table .stock-code-cell a {
    color: #58a6ff;
    font-weight: 600;
    text-decoration: none;
}
.new-high-table .stock-code-cell a:hover { text-decoration: underline; }
.new-high-table .stock-name-cell { color: #e6edf3; max-width: 100px; overflow: hidden; text-overflow: ellipsis; }
.new-high-table .price-col { color: #e6edf3; text-align: right; }
.new-high-table .amount-col { color: #d29922; text-align: right; }

/* 研究報告按鈕 — 沿用 ctrl-btn 風格 */
.research-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #161b22;
    border: 1px solid #30363d;
    color: #8b949e;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
    cursor: pointer;
    font-family: inherit;
}
.research-btn:hover,
.research-btn:focus {
    border-color: #388bfd;
    color: #388bfd;
    background: #1c2d42;
    text-decoration: none;
}
.research-btn-icon { font-size: 13px; line-height: 1; }
.research-btn-text { font-weight: 600; }

/* 模式徽章（daily=灰、detail=藍漸層） */
.research-btn-mode {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1.4;
}
.research-btn-mode.mode-daily {
    background: rgba(139,148,158,0.2);
    color: #8b949e;
}
.research-btn-mode.mode-detail {
    background: linear-gradient(135deg, #1f6feb, #388bfd);
    color: #fff;
}
.research-btn-mode.mode-stale {
    background: rgba(210,153,34,0.15);
    color: #d29922;
}

/* 強度星等 */
.nh-strength {
    color: #d29922;
    font-size: 13px;
    letter-spacing: -1px;
    text-align: center;
}
.nh-strength.s5 { color: #ff9500; text-shadow: 0 0 8px rgba(255,149,0,0.4); }
.nh-strength.s4 { color: #d29922; }
.nh-strength.s3 { color: #8b949e; }

/* 級別 cell（複用主流股的圓點風格） */
.nh-level-cell { text-align: center; min-width: 42px; }
.nh-level-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    font-size: 12px;
}
.nh-level-dot.pass { background: rgba(248,81,73,0.15); color: #f85149; font-weight: 700; }
.nh-level-dot.fail { background: rgba(139,148,158,0.06); color: #484f58; }

/* 歷史新高徽章 */
.nh-all-time {
    background: linear-gradient(135deg, #d29922, #ff9500);
    color: #fff;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* 量比 */
.nh-vol-ratio { color: #8b949e; text-align: right; font-variant-numeric: tabular-nums; }
.nh-vol-ratio.breakout {
    color: #f85149;
    font-weight: 700;
}
.nh-vol-breakout-tag {
    background: rgba(248,81,73,0.15);
    color: #f85149;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

/* 大週期突破徽章（1y/3y/5y/10y） */
.nh-lt-badge {
    display: inline-block;
    font-size: 10px;
    padding: 3px 7px;
    border-radius: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    line-height: 1.4;
}
.nh-lt-badge.nh-lt-1y {
    background: rgba(139,148,158,0.15);
    color: #8b949e;
}
.nh-lt-badge.nh-lt-3y {
    background: rgba(88,166,255,0.18);
    color: #58a6ff;
}
.nh-lt-badge.nh-lt-5y {
    background: linear-gradient(135deg, #1f6feb, #388bfd);
    color: #fff;
}
.nh-lt-badge.nh-lt-10y {
    background: linear-gradient(135deg, #d29922, #ff9500);
    color: #fff;
    box-shadow: 0 0 8px rgba(255,149,0,0.3);
}

/* 盤整天數欄 */
.nh-consol {
    color: #8b949e;
    font-variant-numeric: tabular-nums;
    font-size: 12px;
}
.nh-consol.mid {
    color: #d29922;
    font-weight: 600;
}
.nh-consol.long {
    color: #ff9500;
    font-weight: 700;
}

/* 星號收藏按鈕 */
.nh-star-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    line-height: 1;
    transition: transform 0.15s;
    color: #484f58;
}
.nh-star-btn:hover { transform: scale(1.25); }
.nh-star-btn.starred { color: #d29922; }
.nh-star-btn.starred:hover { color: #ff9500; }

/* empty state */
.new-high-empty {
    text-align: center;
    padding: 40px 20px;
    color: #484f58;
    font-size: 13px;
}

/* ── 新高觀察清單 ── */
.nh-watchlist {
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}
.nh-watchlist .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}
.nh-watchlist .section-title {
    font-size: 18px;
    font-weight: 700;
    color: #e6edf3;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nh-watchlist .section-title .badge {
    background: #d29922;
    color: #fff;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}
.nh-watchlist .section-subtitle { color: #8b949e; font-size: 13px; }
.nh-watchlist .update-time { color: #484f58; font-size: 12px; }

.nh-wl-table-wrap { overflow-x: auto; }
.nh-wl-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.nh-wl-table th {
    background: #161b22;
    color: #8b949e;
    padding: 8px 10px;
    text-align: center;
    font-weight: 600;
    border-bottom: 1px solid #21262d;
    white-space: nowrap;
}
.nh-wl-table th:nth-child(1),
.nh-wl-table th:nth-child(2) { text-align: left; }
.nh-wl-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #161b22;
    vertical-align: middle;
    white-space: nowrap;
}
.nh-wl-table tr:hover td { background: #161b22; }
.nh-wl-table .stock-code-cell a {
    color: #58a6ff;
    font-weight: 600;
    text-decoration: none;
}
.nh-wl-table .stock-code-cell a:hover { text-decoration: underline; }
.nh-wl-table .stock-name-cell { color: #e6edf3; }
.nh-wl-table .date-col { color: #8b949e; font-size: 12px; }
.nh-wl-table .price-col { color: #e6edf3; text-align: right; }

.nh-wl-pct-up   { color: #f85149; font-weight: 700; text-align: right; }
.nh-wl-pct-down { color: #3fb950; font-weight: 700; text-align: right; }
.nh-wl-pct-flat { color: #8b949e; text-align: right; }

.nh-wl-status-on  {
    background: rgba(210,153,34,0.15);
    color: #d29922;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}
.nh-wl-status-off {
    background: rgba(139,148,158,0.08);
    color: #8b949e;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.nh-wl-trigger {
    color: #8b949e;
    font-size: 11px;
    text-align: left;
}

.nh-wl-remove-btn {
    background: transparent;
    border: 1px solid #30363d;
    color: #8b949e;
    border-radius: 4px;
    padding: 3px 10px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.15s;
}
.nh-wl-remove-btn:hover {
    border-color: #f85149;
    color: #f85149;
    background: rgba(248,81,73,0.1);
}

.nh-wl-empty {
    text-align: center;
    padding: 40px 20px;
    color: #484f58;
    font-size: 13px;
}
.nh-wl-empty .hint {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    color: #484f58;
}

/* ───── ETF 池長期高點 ───── */
.etf-pool-section {
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}
.etf-pool-section .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}
.etf-pool-section .section-title {
    font-size: 18px;
    font-weight: 700;
    color: #e6edf3;
    display: flex;
    align-items: center;
    gap: 8px;
}
.etf-pool-section .section-title .badge {
    background: #1f6feb;
    color: #fff;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}
.etf-pool-section .section-subtitle { color: #8b949e; font-size: 13px; }
.etf-pool-section .update-time { color: #484f58; font-size: 12px; }

.etf-pool-summary {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.etf-pool-summary .stat-pill {
    background: #161b22;
    border: 1px solid #30363d;
    color: #8b949e;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.etf-pool-summary .stat-pill strong {
    color: #e6edf3;
    font-size: 15px;
    font-weight: 700;
}
.etf-pool-summary .stat-pill.gold strong { color: #d29922; }
.etf-pool-summary .stat-pill.core strong { color: #ff9500; }
.etf-pool-summary .stat-pill.rocket strong { color: #58a6ff; }

.etf-pool-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    align-items: center;
}
.etf-pool-controls .ctrl-btn {
    background: #161b22;
    border: 1px solid #30363d;
    color: #8b949e;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.etf-pool-controls .ctrl-btn.active,
.etf-pool-controls .ctrl-btn:hover {
    border-color: #388bfd;
    color: #388bfd;
    background: #1c2d42;
}

/* 子標題（核心鐵桿盤整中等） */
.etf-pool-subtitle {
    color: #8b949e;
    font-size: 13px;
    font-weight: 600;
    margin: 16px 0 8px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #21262d;
    display: flex;
    align-items: center;
    gap: 8px;
}
.etf-pool-subtitle .count {
    color: #484f58;
    font-size: 11px;
    font-weight: 400;
}

.etf-pool-table-wrap { overflow-x: auto; }
.etf-pool-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.etf-pool-table th {
    background: #161b22;
    color: #8b949e;
    padding: 8px 10px;
    text-align: center;
    font-weight: 600;
    border-bottom: 1px solid #21262d;
    white-space: nowrap;
}
.etf-pool-table th:nth-child(1),
.etf-pool-table th:nth-child(2) { text-align: left; }
.etf-pool-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #161b22;
    vertical-align: middle;
    white-space: nowrap;
}
.etf-pool-table tr:hover td { background: #161b22; }
.etf-pool-table .stock-code-cell a {
    color: #58a6ff;
    font-weight: 600;
    text-decoration: none;
}
.etf-pool-table .stock-code-cell a:hover { text-decoration: underline; }
.etf-pool-table .stock-name-cell { color: #e6edf3; max-width: 100px; overflow: hidden; text-overflow: ellipsis; }
.etf-pool-table .price-col { color: #e6edf3; text-align: right; }

/* 機構共識徽章 */
.inst-badge {
    display: inline-block;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
}
.inst-badge.tier-core {
    background: rgba(255,149,0,0.15);
    color: #ff9500;
    border: 1px solid rgba(255,149,0,0.3);
}
.inst-badge.tier-strong {
    background: rgba(210,153,34,0.15);
    color: #d29922;
    border: 1px solid rgba(210,153,34,0.3);
}
.inst-badge.tier-normal {
    background: rgba(139,148,158,0.1);
    color: #8b949e;
    border: 1px solid rgba(139,148,158,0.2);
}
.inst-badge.tier-none {
    color: #484f58;
}

/* 突破週期徽章 */
.lt-badge {
    display: inline-block;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
}
.lt-badge.b-10y {
    background: linear-gradient(135deg, #1f6feb, #388bfd);
    color: #fff;
}
.lt-badge.b-5y {
    background: rgba(31,111,235,0.15);
    color: #58a6ff;
    border: 1px solid rgba(88,166,255,0.4);
}
.lt-badge.b-3y {
    background: rgba(31,111,235,0.1);
    color: #58a6ff;
    border: 1px solid rgba(88,166,255,0.2);
}
.lt-badge.b-1y {
    color: #8b949e;
    border: 1px solid #30363d;
}
.lt-badge.b-none {
    color: #484f58;
}

/* 假突破警告 */
.lt-fake-alert {
    color: #f85149;
    font-size: 11px;
    margin-left: 4px;
}

.etf-pool-empty {
    text-align: center;
    padding: 40px 20px;
    color: #484f58;
    font-size: 13px;
}

/* Toast */
.nh-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f6feb;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.nh-toast.show { opacity: 1; }
.nh-toast.success { background: #238636; }
.nh-toast.error   { background: #da3633; }
.nh-toast.info    { background: #1f6feb; }

/* RWD */
@media (max-width: 768px) {
    .new-high-radar, .nh-watchlist { padding: 14px; }
    .new-high-table .hide-mobile,
    .nh-wl-table .hide-mobile { display: none; }
}

/* ── 主流股雷達 ── */
.mainstream-radar {
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}
.mainstream-radar .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}
.mainstream-radar .section-title {
    font-size: 18px;
    font-weight: 700;
    color: #e6edf3;
    display: flex;
    align-items: center;
    gap: 8px;
}
.mainstream-radar .section-title .badge {
    background: #1f6feb;
    color: #fff;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}
.mainstream-radar .section-subtitle { color: #8b949e; font-size: 13px; }
.mainstream-radar .update-time { color: #484f58; font-size: 12px; }
.mainstream-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    align-items: center;
}
.mainstream-controls .ctrl-btn {
    background: #161b22;
    border: 1px solid #30363d;
    color: #8b949e;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.mainstream-controls .ctrl-btn.active,
.mainstream-controls .ctrl-btn:hover {
    border-color: #388bfd;
    color: #388bfd;
    background: #1c2d42;
}
.mainstream-table-wrap { overflow-x: auto; }
.mainstream-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.mainstream-table th {
    background: #161b22;
    color: #8b949e;
    padding: 8px 10px;
    text-align: center;
    font-weight: 600;
    border-bottom: 1px solid #21262d;
    white-space: nowrap;
}
.mainstream-table th:nth-child(1),
.mainstream-table th:nth-child(2),
.mainstream-table th:nth-child(3) { text-align: left; }
.mainstream-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #161b22;
    vertical-align: middle;
    white-space: nowrap;
}
.mainstream-table tr:hover td { background: #161b22; }
.mainstream-table .rank-col { color: #484f58; font-size: 12px; text-align: center; width: 32px; }
.mainstream-table .stock-code { color: #58a6ff; font-weight: 600; }
.mainstream-table .stock-name { color: #e6edf3; max-width: 80px; overflow: hidden; text-overflow: ellipsis; }
.mainstream-table .price-col { color: #e6edf3; text-align: right; }
.mainstream-table .change-up   { color: #f85149; text-align: right; }
.mainstream-table .change-down { color: #3fb950; text-align: right; }
.mainstream-table .change-flat { color: #8b949e; text-align: right; }
.mainstream-table .amount-col  { color: #d29922; text-align: right; }
.cond-cell { text-align: center; min-width: 42px; }
.cond-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    border-radius: 50%;
    font-size: 14px;
    cursor: default;
}
.cond-dot.pass    { background: rgba(63,185,80,0.15);  color: #3fb950; }
.cond-dot.fail    { background: rgba(248,81,73,0.12);  color: #f85149; }
.cond-dot.unknown { background: rgba(139,148,158,0.1); color: #484f58; }
.cond-manual-btn {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 1.5px solid #30363d;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    color: #484f58;
}
.cond-manual-btn:hover { border-color: #58a6ff; }
.cond-manual-btn.marked-yes { background: rgba(63,185,80,0.2);  border-color: #3fb950; color: #3fb950; }
.cond-manual-btn.marked-no  { background: rgba(248,81,73,0.15); border-color: #f85149; color: #f85149; }
.score-bar-wrap { display: flex; align-items: center; gap: 6px; min-width: 80px; }
.score-num { font-weight: 700; font-size: 14px; min-width: 20px; text-align: right; }
.score-num.high { color: #3fb950; }
.score-num.mid  { color: #d29922; }
.score-num.low  { color: #8b949e; }
.score-bar { flex: 1; height: 6px; background: #21262d; border-radius: 3px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.score-bar-fill.high { background: #3fb950; }
.score-bar-fill.mid  { background: #d29922; }
.score-bar-fill.low  { background: #484f58; }
.mainstream-badge {
    background: linear-gradient(135deg, #1f6feb, #388bfd);
    color: #fff; font-size: 10px; padding: 2px 6px;
    border-radius: 4px; font-weight: 700;
}
.watching-badge {
    background: rgba(210,153,34,0.2); color: #d29922;
    font-size: 10px; padding: 2px 6px; border-radius: 4px;
    border: 1px solid rgba(210,153,34,0.3);
}
.note-input {
    background: transparent; border: none;
    border-bottom: 1px solid #21262d;
    color: #8b949e; font-size: 12px;
    width: 90px; padding: 2px 4px; outline: none;
}
.note-input:focus { border-bottom-color: #388bfd; color: #e6edf3; }
.cond-header { cursor: help; border-bottom: 1px dashed #30363d; }
.mainstream-empty { text-align: center; color: #484f58; padding: 40px; font-size: 14px; }
@media (max-width: 768px) {
    .mainstream-table .hide-mobile { display: none; }
    .mainstream-radar { padding: 14px; }
    .mainstream-table th, .mainstream-table td { padding: 7px 6px; }
}

/* ===== from dashboard.html <style> block #3 ===== */
/* 覆蓋排序圖標樣式 - 更明顯 */
.turnover-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
    position: relative;
    padding-right: 28px !important;
}

.turnover-table th.sortable:hover {
    background: rgba(0, 217, 255, 0.15);
    color: var(--accent-cyan);
}

.turnover-table th.sortable::after {
    content: '⇅';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.7;
    font-size: 14px;
    color: var(--accent-cyan);
    background: rgba(0, 217, 255, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
}

.turnover-table th.sortable:hover::after {
    opacity: 1;
    background: rgba(0, 217, 255, 0.25);
}

.turnover-table th.sortable.sort-asc::after {
    content: '▲';
    color: var(--accent-green);
    background: rgba(0, 255, 136, 0.15);
}

.turnover-table th.sortable.sort-desc::after {
    content: '▼';
    color: var(--accent-green);
    background: rgba(0, 255, 136, 0.15);
}


/* ==================== 外資買賣超排行 ==================== */
.foreign-section {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.foreign-title {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 30px;
    text-align: center;
}

.foreign-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.foreign-card {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 10px 10px;
}

.foreign-card.buy { border-top: 3px solid #ef4444; }
.foreign-card.sell { border-top: 3px solid #10b981; }

.foreign-card-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 15px;
}

.foreign-card.buy .foreign-card-title { color: #ef4444; }
.foreign-card.sell .foreign-card-title { color: #10b981; }

.foreign-item {
    display: flex;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    transition: all 0.2s;
}

.foreign-item:hover {
    background: rgba(255,255,255,0.08);
    transform: translateX(5px);
}

.foreign-rank {
    width: 30px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
}

.foreign-code {
    width: 80px;
    font-size: 14px;
    font-weight: 600;
    color: #48dbfb;
}

.foreign-name {
    flex: 1;
    font-size: 14px;
    color: rgba(255,255,255,0.9);
}

.foreign-amount {
    font-size: 14px;
    font-weight: 600;
    text-align: right;
    min-width: 100px;
}

.foreign-card.buy .foreign-amount { color: #ef4444; }
.foreign-card.sell .foreign-amount { color: #10b981; }

@media (max-width: 768px) {
    .foreign-grid { grid-template-columns: 1fr; }
}

    

/* ==================== 三大法人買賣金額統計 ==================== */
.institutional-money-section {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.institutional-money-title {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 30px;
    text-align: center;
}

.institutional-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;

}

.institutional-table th {
    background: rgba(255,255,255,0.08);
    padding: 15px;
    text-align: center;
    font-size: 14px;
    color: rgba(255,255,255,0.9);
    font-weight: 600;
}

.institutional-table td {
    padding: 15px;
    text-align: center;
    font-size: 14px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.institutional-table tbody tr:hover {
    background: rgba(255,255,255,0.05);
}

.inst-name { color: rgba(255,255,255,0.9); font-weight: 600; }
.inst-buy { color: #48dbfb; }
.inst-sell { color: #ff9ff3; }
.inst-diff-positive { color: #ef4444; font-weight: 600; }
.inst-diff-negative { color: #10b981; font-weight: 600; }
.inst-total-row { background: rgba(255,255,255,0.08) !important; font-weight: 700; }

.inst-ratio {
    margin-top: 20px;
    padding: 15px;
    background: rgba(72, 219, 251, 0.1);
    border-left: 3px solid #48dbfb;
    border-radius: 6px;
    font-size: 14px;
    color: rgba(255,255,255,0.9);
}

@media (max-width: 768px) {
    .institutional-table { font-size: 12px; }
    .institutional-table th, .institutional-table td { padding: 10px; }
}

    

.limit-section-wrapper {
    max-width: 1100px;
    margin: 40px auto;
    padding: 30px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 15px;
}
.limit-main-title { font-size: 28px; color: #fff; text-align: center; margin-bottom: 30px; }
.limit-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.limit-card { background: rgba(255,255,255,0.05); border-radius: 12px; padding: 10px 10px; }
.limit-card.up { border-top: 3px solid #ff4757; }
.limit-card.down { border-top: 3px solid #1dd1a1; }
.limit-card-title { font-size: 20px; font-weight: 600; margin-bottom: 15px; display: flex; justify-content: space-between; }
.limit-card.up .limit-card-title { color: #ff4757; }
.limit-card.down .limit-card-title { color: #1dd1a1; }
.limit-count { font-size: 16px; padding: 4px 12px; background: rgba(255,255,255,0.1); border-radius: 12px; }
.limit-item { display: flex; padding: 12px; margin-bottom: 8px; background: rgba(255,255,255,0.03); border-radius: 8px; }
.limit-code { width: 80px; font-size: 14px; font-weight: 700; color: #48dbfb; }
.limit-name { flex: 1; font-size: 14px; color: rgba(255,255,255,0.9); }
.limit-price { width: 80px; font-size: 14px; font-weight: 700; text-align: right; }
.limit-card.up .limit-price { color: #ff4757; }
.limit-card.down .limit-price { color: #1dd1a1; }


/* ==================== 產業熱圖 ==================== */
.industry-heatmap-section {
    max-width: 1200px;
    margin: 40px auto;
    padding: 30px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.heatmap-title {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    text-align: center;
    margin-bottom: 30px;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.industry-block {
    padding: 25px 15px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;

}



.industry-block:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.block-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.block-change {
    font-size: 28px;
    font-weight: 800;
    margin: 10px 0;
}

.block-stats {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 12px;
    font-size: 12px;
}

.block-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.block-stat-value {
    font-weight: 700;
    font-size: 14px;
}

/* 顏色 - 紅漲綠跌 */
.hm-strong-up { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); }
.hm-up { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.hm-slight-up { background: linear-gradient(135deg, #f87171 0%, #ef4444 100%); }
.hm-flat { background: linear-gradient(135deg, #4b5563 0%, #374151 100%); }
.hm-slight-down { background: linear-gradient(135deg, #34d399 0%, #10b981 100%); }
.hm-down { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.hm-strong-down { background: linear-gradient(135deg, #059669 0%, #047857 100%); }

@media (max-width: 768px) {
    .heatmap-grid { grid-template-columns: repeat(2, 1fr); }
}

    

/* 產業展開明細 */
.industry-block {
    cursor: pointer;
    position: relative;
}

.industry-block.expanded {
    grid-column: 1 / -1;
    background: rgba(51, 65, 85, 0.3) !important;
    border: 2px solid #475569;
    padding: 30px;
    max-height: none;
}

.industry-detail {
    display: none;
    margin-top: 25px;
}

.industry-block.expanded .industry-detail {
    display: block;
}

.detail-title {
    font-size: 18px;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #475569;
}

/* 摘要卡片 */
.detail-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.summary-card {
    background: rgba(30, 41, 59, 0.8);
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #475569;
}

.summary-card-label {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 8px;
}

.summary-card-value {
    font-size: 22px;
    font-weight: 700;
}

.summary-card-value.positive { color: #ef4444; }
.summary-card-value.negative { color: #10b981; }

/* 股票明細表格 */
.industry-detail-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 10px;

}

.industry-detail-table thead {
    background: rgba(71, 85, 105, 0.5);
}

.industry-detail-table thead th {
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 600;
    padding: 15px 12px;
    text-align: left;
    border-bottom: 2px solid #475569;
}

.industry-detail-table thead th:nth-child(1) { 
    width: 12%; 
    text-align: center;
}

.industry-detail-table thead th:nth-child(2) { 
    width: 28%;
}

.industry-detail-table thead th:nth-child(3) { 
    width: 30%; 
    text-align: right;
}

.industry-detail-table thead th:nth-child(4) { 
    width: 30%; 
    text-align: right;
}

.industry-detail-table tbody tr {
    border-bottom: 1px solid rgba(71, 85, 105, 0.3);
    transition: background 0.15s;
}

.industry-detail-table tbody tr:hover {
    background: rgba(71, 85, 105, 0.3);
}

.industry-detail-table tbody tr:last-child {
    border-bottom: none;
}

.industry-detail-table tbody td {
    padding: 14px 12px;
    font-size: 15px;
    color: #e2e8f0;
}

.industry-detail-table .td-code {
    text-align: center;
    color: #60a5fa;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    font-size: 15px;
}

.industry-detail-table .td-name {
    color: #f1f5f9;
    font-weight: 500;
}

.industry-detail-table .td-foreign {
    text-align: right;
    font-weight: 600;
    font-size: 15px;
}

.industry-detail-table .td-change {
    text-align: right;
    font-weight: 600;
    font-size: 15px;
}

.industry-detail-table .text-green { 
    color: #10b981 !important; 
}

.industry-detail-table .text-red { 
    color: #ef4444 !important; 
}

.industry-block.expanded::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

    
/* 散戶多空比說明彈窗 */
.retail-info-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.retail-info-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 16px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(100, 116, 139, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.retail-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(100, 116, 139, 0.3);
}

.retail-info-title {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}

.retail-info-close {
    font-size: 28px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    padding: 5px 10px;
}

.retail-info-close:hover {
    color: #ef4444;
    transform: rotate(90deg);
}

.retail-info-section {
    margin-bottom: 25px;
}

.retail-info-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #60a5fa;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.retail-info-content {
    color: #cbd5e1;
    font-size: 14px;
    line-height: 1.8;
}

.retail-info-content strong {
    color: #e2e8f0;
}

.retail-signal-box {
    background: rgba(100, 116, 139, 0.2);
    border-radius: 8px;
    padding: 12px 15px;
    margin: 8px 0;
    border-left: 3px solid;
}

.retail-signal-box.bullish {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.retail-signal-box.bearish {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.retail-signal-box.neutral {
    border-color: #64748b;
    background: rgba(100, 116, 139, 0.1);
}

.retail-formula {
    background: rgba(30, 41, 59, 0.8);
    padding: 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    color: #fbbf24;
    font-size: 13px;
    margin: 10px 0;
}


/* 股票代號連結樣式 */
.stock-link {
    color: #4A9EFF;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

/* 漲跌停、周轉率股票代號連結 */
.limit-code .stock-link,
.stock-code .stock-link {
    color: inherit;
    text-decoration: none;
    font-weight: inherit;
}

.limit-code .stock-link:hover,
.stock-code .stock-link:hover {
    color: #4A9EFF;
    text-decoration: underline;
}


.stock-link:hover {
    color: #6BB6FF;
    text-decoration: underline;
}

.foreign-code .stock-link {
    color: inherit;
}

.foreign-code .stock-link:hover {
    color: #4A9EFF;
}

/* 收合按鈕 */
.detail-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.collapse-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    font-weight: 500;
}

.collapse-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.collapse-btn:active {
    transform: translateY(0);
}

        /* ==================== 手機版響應式修正 ==================== */
        /* ==================== 手機版響應式修正 ==================== */
        
        /* 平板以下 (< 768px) */
        @media (max-width: 768px) {
            .container {
                max-width: 100%;
                padding: 12px 0px;
            }
        
            /* 頭部調整 — Phase 1 fixed,手機放開高度允許換行 */
            body { padding-top: 120px; }   /* 手機 header wrap 後較高,保守值 */
            .header {
                height: auto;
                min-height: 56px;
                flex-wrap: wrap;
                padding: 8px;
                gap: 8px;
            }

            .header .logo {
                display: none;
            }
        
            .status {
                flex-direction: row;
                gap: 12px;
                font-size: 10px;
                width: 100%;
                justify-content: space-between;
            }
        
            /* 指標卡片 - 改為單欄 */
            .metrics-grid {
                grid-template-columns: 1fr;
                gap: 16px;
                margin-bottom: 20px;
            }
        
            .metric-card {
                padding: 16px;
            }
        
            .metric-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 8px;
                margin-bottom: 16px;
            }
        
            .metric-title {
                font-size: 12px;
            }
        
            .metric-date {
                font-size: 10px;
                padding: 3px 8px;
            }
        
            /* 數值顯示 - 縮小 */
            .metric-value {
                font-size: 48px;
                letter-spacing: -1px;
            }
        
            .metric-unit {
                font-size: 24px;
            }
        
            .metric-value-container {
                margin-bottom: 16px;
            }
        
            /* 詳細資訊 - 保持兩欄但縮小間距 */
            .metric-details {
                gap: 8px;
            }
        
            .detail-item {
                padding: 10px;
            }
        
            .detail-label {
                font-size: 10px;
            }
        
            .detail-value {
                font-size: 14px;
            }
        
            /* 圖表區域 - 改為單欄 */
            .charts-grid {
                grid-template-columns: 1fr;
                gap: 16px;
            }
        
            .retail-chart-full {
                grid-column: 1;
            }
        
            /* 圖表卡片內部調整 */
            .chart-card {
                padding: 16px;
            }
        
            .chart-header {
                margin-bottom: 12px;
            }
        
            .chart-title {
                font-size: 12px;
            }
        
            .info-icon {
                width: 16px;
                height: 16px;
                font-size: 11px;
            }
        
            /* Canvas 容器 - 確保不超出 */
            .chart-container {
                position: relative;
                height: 250px;
                width: 100%;
            
            }
        
            /* 確保 canvas 不超出容器 */
            .chart-container canvas {
                max-width: 100% !important;
                height: auto !important;
            }
        }
        
        /* 小手機 (< 480px) */
        @media (max-width: 480px) {
            .container {
                padding: 8px;
            }
        
            .header {
                padding: 12px 0;
                margin-bottom: 16px;
            }
        
            .logo {
                font-size: 18px;
            }
        
            .logo .monitor {
                display: block;
                margin-left: 0;
                margin-top: 4px;
            }
        
            .status {
                font-size: 9px;
                gap: 8px;
            }
        
            .metrics-grid {
                gap: 12px;
            }
        
            .metric-card {
                padding: 12px;
            }
        
            .metric-value {
                font-size: 36px;
            }
        
            .metric-unit {
                font-size: 18px;
            }
        
            .metric-details {
                grid-template-columns: 1fr;
                gap: 6px;
            }
        
            .detail-item {
                padding: 8px;
            }
        
            .detail-value {
                font-size: 13px;
            }
        
            .charts-grid {
                gap: 12px;
            }
        
            .chart-card {
                padding: 12px;
            }
        
            .chart-container {
                height: 200px;
            }

            .research-btn-text { display: none; }
        }
        
        /* 通用修正 - 防止所有元素超出螢幕 */
        @media (max-width: 768px) {
            * {
                max-width: 100%;
            }
        
            img, canvas, video, iframe {
                max-width: 100%;
                height: auto;
            }
        
            /* 防止表格超出 */
            table {
                display: block;
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
            }
        
            /* 防止長文字撐開容器 */
            .metric-value, .detail-value, .chart-title {
                word-wrap: break-word;
                overflow-wrap: break-word;
            }
        }

/* 漲跌停區塊 - 手機版改為上下排列 */
@media (max-width: 768px) {
    .limit-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    
    .limit-card {
        width: 100%;
    }
}

/* 小手機進一步優化 */
@media (max-width: 480px) {
    .limit-grid {
        gap: 12px;
    }
    
    .limit-section-wrapper {
        padding: 12px;
    }
    
    .limit-main-title {
        font-size: 16px;
        margin-bottom: 12px;
    }
}

/* 國際商品期貨 - 手機版改為單欄 */
@media (max-width: 768px) {
    .commodities-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    
    .commodity-card {
        width: 100%;
    }
    
    .commodity-chart-container {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .commodities-grid {
        gap: 12px;
    }
    
    .commodities-section {
        padding: 12px;
    }
    
    .commodities-main-title {
        font-size: 16px;
    }
    
    .commodity-chart-container {
        height: 200px;
    }
    
    .commodity-price {
        font-size: 28px;
    }
}

/* ==================== 週轉率表格 - 手機版優化 ==================== */
@media (max-width: 768px) {
    /* 隱藏次要欄位: 產業(5), 標籤(8) */
    .turnover-table th:nth-child(5),
    .turnover-table th:nth-child(8),
    .turnover-table td:nth-child(5),
    .turnover-table td:nth-child(8) {
        display: none;
    }
    
    /* 縮小表格字體 */
    .turnover-table {
        font-size: 11px;
    }
    
    /* 調整欄位寬度 */
    .turnover-table th,
    .turnover-table td {
        padding: 8px 4px;
    }
    
    .turnover-table th:nth-child(1),
    .turnover-table td:nth-child(1) {
        width: 8%;  /* # */
    }
    
    .turnover-table th:nth-child(2),
    .turnover-table td:nth-child(2) {
        width: 20%;  /* 股票 */
        font-size: 10px;
    }
    
    .turnover-table th:nth-child(3),
    .turnover-table td:nth-child(3) {
        width: 18%;  /* 股價 */
    }
    
    .turnover-table th:nth-child(4),
    .turnover-table td:nth-child(4) {
        width: 18%;  /* 漲跌 */
    }
    
    .turnover-table th:nth-child(6),
    .turnover-table td:nth-child(6) {
        width: 18%;  /* 周轉率 */
    }
    
    .turnover-table th:nth-child(7),
    .turnover-table td:nth-child(7) {
        width: 18%;  /* 爆量分析 */
        font-size: 9px;
    }
    
    /* 標題區域優化 */
    .turnover-header {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }
    
    .turnover-title {
        font-size: 16px;
    }
    
    /* 統計區域改為 2x2 網格 */
    .turnover-stats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .turnover-stat-item {
        padding: 10px;
    }
    
    .turnover-stat-label {
        font-size: 10px;
    }
    
    .turnover-stat-value {
        font-size: 18px;
    }
}

/* 小手機進一步優化 */
@media (max-width: 480px) {
    /* 再隱藏爆量分析欄位 */
    .turnover-table th:nth-child(7),
    .turnover-table td:nth-child(7) {
        display: none;
    }
    
    /* 調整剩餘欄位寬度 */
    .turnover-table th:nth-child(2),
    .turnover-table td:nth-child(2) {
        width: 28%;  /* 股票 */
    }
    
    .turnover-table th:nth-child(3),
    .turnover-table td:nth-child(3) {
        width: 22%;  /* 股價 */
    }
    
    .turnover-table th:nth-child(4),
    .turnover-table td:nth-child(4) {
        width: 22%;  /* 漲跌 */
    }
    
    .turnover-table th:nth-child(6),
    .turnover-table td:nth-child(6) {
        width: 20%;  /* 周轉率 */
    }
    
    .turnover-table {
        font-size: 10px;
    }
    
    .turnover-table th,
    .turnover-table td {
        padding: 6px 2px;
    }
}

/* 手機版減少左右留白 */
@media (max-width: 768px) {
    .container {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
    
    body {
        padding: 120px 0 0 0 !important;
        margin: 0 !important;
    }
}

@media (max-width: 420px) {
    .container {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }
}

/* ==================== 修正所有 section 的手機版寬度 ==================== */
@media (max-width: 768px) {
    /* 移除 section 的最大寬度限制和過大 padding */
    .foreign-section,
    .limit-section-wrapper,
    .turnover-section,
    .commodities-section {
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 16px 8px !important;
        margin-top: 20px !important;
    }
    
    /* container 也要調整 */
    .container {
        max-width: 100% !important;
        padding: 12px 6px !important;
    }
    
    /* 外資項目內部 */
    .foreign-item {
        padding: 10px 6px !important;
        gap: 4px;
    }
}

@media (max-width: 420px) {
    .foreign-section,
    .limit-section-wrapper,
    .turnover-section,
    .commodities-section {
        padding: 12px 4px !important;
        margin-top: 16px !important;
    }
    
    .container {
        padding: 8px 4px !important;
    }
    
    .foreign-item {
        padding: 8px 4px !important;
        gap: 2px;
    }
}

/* ==================== 外資卡片手機版 padding 修正 ==================== */
@media (max-width: 768px) {
    .foreign-card {
        padding: 12px 6px !important;
        border-radius: 8px;
    }
    
    .foreign-card-title {
        font-size: 16px !important;
        margin-bottom: 10px !important;
    }
}

@media (max-width: 420px) {
    .foreign-card {
        padding: 10px 4px !important;
    }
    
    .foreign-card-title {
        font-size: 14px !important;
        margin-bottom: 8px !important;
    }
}

/* ==================== 精確修正限制寬度的元素 ==================== */
@media (max-width: 768px) {
    /* 週轉率區塊 - 移除 850px 限制 */
    .turnover-single-wrap {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* guide-panel-content - 移除 1400px 限制 */
    .guide-panel-content {
            z-index: 1;
        max-width: 100% !important;
        padding: 12px 6px !important;
    }
    
    /* legend-dot - 移除 600px 限制 */
    .legend-dot {
        max-width: 100% !important;
    }
}

@media (max-width: 420px) {
    .turnover-single-wrap,
    .guide-panel-content {
            z-index: 1;
        padding: 8px 4px !important;
    }
}

/* ==================== 外資產業詳細表格 - 手機版優化 ==================== */
@media (max-width: 768px) {
    /* 表格整體設定 */
    .industry-detail-table {
        font-size: 11px !important;
    }
    
    /* 表頭縮小 padding 和字體 */
    .industry-detail-table thead th {
        font-size: 11px !important;
        padding: 10px 4px !important;
    }
    
    /* tbody 縮小 padding 和字體 */
    .industry-detail-table tbody td {
        padding: 10px 4px !important;
        font-size: 11px !important;
    }
    
    /* 各欄位縮小字體 */
    .industry-detail-table .td-code {
        font-size: 11px !important;
    }
    
    .industry-detail-table .td-foreign {
        font-size: 11px !important;
    }
    
    .industry-detail-table .td-change {
        font-size: 11px !important;
    }
    
    /* 調整欄位寬度比例 */
    .industry-detail-table thead th:nth-child(1) { width: 13% !important; }
    .industry-detail-table thead th:nth-child(2) { width: 21% !important; }
    .industry-detail-table thead th:nth-child(3) { width: 32% !important; }
    .industry-detail-table thead th:nth-child(4) { width: 33% !important; }
}

@media (max-width: 420px) {
    .industry-detail-table {
        font-size: 10px !important;
    }
    
    .industry-detail-table thead th {
        font-size: 10px !important;
        padding: 8px 3px !important;
    }
    
    .industry-detail-table tbody td {
        padding: 8px 3px !important;
        font-size: 10px !important;
    }
    
    .industry-detail-table .td-code,
    .industry-detail-table .td-foreign,
    .industry-detail-table .td-change {
        font-size: 10px !important;
    }
}

/* ==================== 表頭文字換行修正 ==================== */
@media (max-width: 768px) {
    .industry-detail-table thead th {
        font-size: 10px !important;
        padding: 8px 3px !important;
        white-space: normal !important;
        word-break: keep-all !important;
        line-height: 1.4 !important;
        vertical-align: middle !important;
    }
}

/* ==================== 最終覆蓋 - 手機版極小 margin/padding ==================== */
@media (max-width: 768px) {
    /* 最優先級的容器設定 */
    body {
        margin: 0 !important;
        padding: 120px 0 0 0 !important;
    }
    
    .container {
        max-width: 100vw !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 8px 2px !important;
    }
    
    /* 所有卡片和區塊 */
    .metric-card,
    .chart-card,
    .foreign-section,
    .foreign-card,
    .limit-section-wrapper,
    .turnover-section,
    .commodities-section,
    .industry-block,
    .retail-chart-section {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

@media (max-width: 420px) {
    .container {
        padding: 6px 1px !important;
    }
}
.sort-icon {
    display: inline-block;
    width: 16px;
    text-align: center;
    font-size: 12px;
}

/* ========== MACD 訊號區塊 ========== */


/* MACD 說明彈窗 */
.macd-date-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 4px 0;
}
.macd-date-tab {
    padding: 4px 14px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.03);
    color: #888;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}
.macd-date-tab:hover {
    border-color: #e94560;
    color: #e94560;
}
.macd-date-tab.active {
    background: rgba(233,69,96,0.15);
    border-color: #e94560;
    color: #e94560;
    font-weight: 600;
}
.macd-info-btn {
    width: 28px;
    height: 28px;
    border-radius: 0;
    border: none;
    background: transparent;
    color: #aaa;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    margin-left: 8px;
}
.macd-info-btn:hover {
    border-color: #e94560;
    color: #e94560;
    background: rgba(233,69,96,0.1);
}
.macd-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.macd-modal-overlay.show {
    display: flex;
}
.macd-modal {
    background: #1a1a2e;
    border: 1px solid #e94560;
    border-radius: 12px;
    max-width: 580px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 28px;
    position: relative;
    box-shadow: 0 8px 32px rgba(233,69,96,0.3);
}
.macd-modal-close {
    position: absolute;
    top: 12px; right: 16px;
    background: none;
    border: none;
    color: #888;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}
.macd-modal-close:hover { color: #e94560; }
.macd-modal h3 {
    color: #e94560;
    font-size: 18px;
    margin: 0 0 18px 0;
}
.macd-modal-section {
    margin-bottom: 16px;
    padding: 12px 14px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    border-left: 3px solid #e94560;
}
.macd-modal-section.pass {
    border-left-color: #4ecdc4;
}
.macd-modal-section h4 {
    color: #fff;
    font-size: 14px;
    margin: 0 0 6px 0;
}
.macd-modal-section p {
    color: #aaa;
    font-size: 13px;
    margin: 0;
    line-height: 1.6;
}
.macd-modal-section .val {
    color: #ffc107;
    font-weight: bold;
}
.macd-modal-divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin: 16px 0;
}
.macd-modal-stars {
    margin-top: 6px;
}
.macd-modal-stars p {
    font-size: 12px;
    color: #888;
    margin: 3px 0;
}
.macd-modal-footer {
    font-size: 11px;
    color: #666;
    text-align: center;
    margin-top: 14px;
}
@media (max-width: 768px) {
    .macd-modal { padding: 20px; max-width: 95vw; }
    .macd-modal-section h4 { font-size: 13px; }
    .macd-modal-section p { font-size: 12px; }
}

/* MACD 過濾排序列 */
.macd-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    align-items: center;
}
.macd-filter-group {
    display: flex;
    align-items: center;
    gap: 4px;
}
.macd-filter-label {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
}
.macd-filter-btn {
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    color: #aaa;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.macd-filter-btn:hover {
    border-color: #e94560;
    color: #fff;
}
.macd-filter-btn.active {
    background: #e94560;
    border-color: #e94560;
    color: #fff;
}
.macd-sort-select {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    color: #ddd;
    cursor: pointer;
    outline: none;
}
.macd-sort-select option {
    background: #1a1a2e;
    color: #ddd;
}
.macd-divider {
    width: 1px;
    height: 20px;
    background: rgba(255,255,255,0.1);
    margin: 0 4px;
}
@media (max-width: 768px) {
    .macd-controls { gap: 6px; }
    .macd-filter-btn { padding: 4px 8px; font-size: 10px; }
    .macd-divider { display: none; }
}

.watchlist-section {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 12px;
}
.watchlist-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.watchlist-title {
    font-size: 14px;
    font-weight: 600;
    color: #e0e0e0;
}
.watchlist-hint {
    font-size: 11px;
    color: rgba(255,255,255,0.35);
}
.watchlist-body {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.watchlist-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.watchlist-tag {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(99,179,237,0.12);
    border: 1px solid rgba(99,179,237,0.3);
    border-radius: 20px;
    padding: 3px 10px 3px 12px;
    font-size: 12px;
    color: #90cdf4;
}
.watchlist-tag-remove {
    cursor: pointer;
    color: rgba(255,255,255,0.4);
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
}
.watchlist-tag-remove:hover { color: #fc8181; }
.watchlist-add {
    display: flex;
    gap: 6px;
    align-items: center;
}
.watchlist-add input {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: #e0e0e0;
    padding: 4px 10px;
    font-size: 12px;
    outline: none;
    width: 90px;
}
.watchlist-add input:focus { border-color: rgba(99,179,237,0.5); }
#watchlist-add-btn {
    background: rgba(99,179,237,0.15);
    border: 1px solid rgba(99,179,237,0.3);
    border-radius: 6px;
    color: #90cdf4;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
}
#watchlist-add-btn:hover { background: rgba(99,179,237,0.25); }
#watchlist-scan-btn { background: rgba(72,187,120,0.15); border: 1px solid rgba(72,187,120,0.3); border-radius: 6px; color: #9ae6b4; padding: 4px 12px; font-size: 12px; cursor: pointer; }
#watchlist-scan-btn:hover { background: rgba(72,187,120,0.25); }
#watchlist-scan-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.macd-signal-section {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #e94560;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.3);
}
.macd-signal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}
.macd-signal-title {
    font-size: 20px;
    font-weight: bold;
    color: #e94560;
    display: flex;
    align-items: center;
    gap: 8px;
}
.macd-signal-title .pulse-dot {
    width: 12px;
    height: 12px;
    background: #e94560;
    border-radius: 50%;
    animation: macd-pulse 2s infinite;
}
@keyframes macd-pulse {
    0% { box-shadow: 0 0 0 0 rgba(233, 69, 96, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(233, 69, 96, 0); }
    100% { box-shadow: 0 0 0 0 rgba(233, 69, 96, 0); }
}
.macd-signal-meta {
    font-size: 12px;
    color: #888;
    margin-bottom: 12px;
}
.macd-signal-count {
    background: #e94560;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
}
.macd-signal-empty {
    text-align: center;
    padding: 30px;
    color: #666;
    font-size: 14px;
}
.macd-signal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}
.macd-signal-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 14px;
    transition: all 0.2s;
    cursor: pointer;
}
.macd-signal-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #e94560;
    transform: translateY(-2px);
}
.macd-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}
.macd-card-code {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
}
.macd-card-code a { color: #fff; text-decoration: none; }
.macd-card-code a:hover { color: #e94560; text-decoration: underline; }
.macd-card-name {
    font-size: 13px;
    color: #aaa;
}
.macd-card-price {
    font-size: 18px;
    font-weight: bold;
    color: #4ecdc4;
}
.macd-card-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.macd-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
}
.macd-badge-cross {
    background: rgba(233, 69, 96, 0.2);
    color: #e94560;
    border: 1px solid rgba(233, 69, 96, 0.4);
}
.macd-badge-type-long {
    background: rgba(78, 205, 196, 0.2);
    color: #4ecdc4;
    border: 1px solid rgba(78, 205, 196, 0.4);
}
.macd-badge-type-short {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.4);
}
.macd-badge-source {
    background: rgba(100, 100, 255, 0.2);
    color: #aab;
    border: 1px solid rgba(100, 100, 255, 0.3);
}
.macd-card-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
}
.macd-metric { text-align: center; }
.macd-metric-label { font-size: 10px; color: #666; margin-bottom: 2px; }
.macd-metric-value { font-size: 13px; color: #ddd; font-weight: bold; }
.macd-card-stars { color: #ffc107; font-size: 14px; letter-spacing: 1px; }
@media (max-width: 768px) {
    .watchlist-section {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 12px;
}
.watchlist-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.watchlist-title {
    font-size: 14px;
    font-weight: 600;
    color: #e0e0e0;
}
.watchlist-hint {
    font-size: 11px;
    color: rgba(255,255,255,0.35);
}
.watchlist-body {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.watchlist-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.watchlist-tag {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(99,179,237,0.12);
    border: 1px solid rgba(99,179,237,0.3);
    border-radius: 20px;
    padding: 3px 10px 3px 12px;
    font-size: 12px;
    color: #90cdf4;
}
.watchlist-tag-remove {
    cursor: pointer;
    color: rgba(255,255,255,0.4);
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
}
.watchlist-tag-remove:hover { color: #fc8181; }
.watchlist-add {
    display: flex;
    gap: 6px;
    align-items: center;
}
.watchlist-add input {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: #e0e0e0;
    padding: 4px 10px;
    font-size: 12px;
    outline: none;
    width: 90px;
}
.watchlist-add input:focus { border-color: rgba(99,179,237,0.5); }
#watchlist-add-btn {
    background: rgba(99,179,237,0.15);
    border: 1px solid rgba(99,179,237,0.3);
    border-radius: 6px;
    color: #90cdf4;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
}
#watchlist-add-btn:hover { background: rgba(99,179,237,0.25); }
#watchlist-scan-btn { background: rgba(72,187,120,0.15); border: 1px solid rgba(72,187,120,0.3); border-radius: 6px; color: #9ae6b4; padding: 4px 12px; font-size: 12px; cursor: pointer; }
#watchlist-scan-btn:hover { background: rgba(72,187,120,0.25); }
#watchlist-scan-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.macd-signal-section { padding: 14px; margin: 12px 0; }
    .macd-signal-grid { grid-template-columns: 1fr; }
    .macd-signal-title { font-size: 16px; }
}


/* === 概念股標籤篩選 === */
.macd-signal-card.notion-hidden { display: none !important; }
.concept-filter-bar { display:flex; flex-wrap:wrap; gap:6px; padding:8px 0; margin-bottom:8px; border-bottom:1px solid rgba(255,255,255,0.06); }
.concept-filter-btn { display:inline-flex; align-items:center; gap:4px; padding:4px 10px; border-radius:14px; border:1px solid rgba(255,255,255,0.15); background:rgba(255,255,255,0.04); color:#9CA3AF; font-size:12px; cursor:pointer; transition:all 0.2s; white-space:nowrap; }
.concept-filter-btn:hover { background:rgba(255,255,255,0.08); color:#D1D5DB; }
.concept-filter-btn.active { border-color:var(--concept-color,#6B7280); background:color-mix(in srgb,var(--concept-color,#6B7280) 20%,transparent); color:#F3F4F6; }
.concept-filter-btn .dot { width:6px; height:6px; border-radius:50%; background:var(--concept-color,#6B7280); }
.concept-filter-btn .count { font-size:10px; opacity:0.7; margin-left:2px; }
.signal-concepts { display:flex; flex-wrap:wrap; gap:3px; margin-top:4px; }
.concept-tag { display:inline-block; padding:1px 6px; border-radius:8px; font-size:10px; line-height:16px; background:color-mix(in srgb,var(--tag-color,#6B7280) 15%,transparent); color:var(--tag-color,#9CA3AF); border:1px solid color-mix(in srgb,var(--tag-color,#6B7280) 30%,transparent); white-space:nowrap; }
.macd-signal-card.concept-hidden { display:none !important; }


/* 處置股 Yahoo 連結 */
.disposal-item a.item-id, .alert-chip a.chip-id {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: opacity 0.15s;
}
.disposal-item a.item-id:hover, .alert-chip a.chip-id:hover {
    opacity: 0.7;
    text-decoration: underline;
}

/* 處置股表格行樣式 */
.disposal-row {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 0.82em;
    transition: background 0.15s;
    gap: 0;
}
.disposal-row:last-child { border-bottom: none; }
.disposal-row:hover { background: rgba(255,255,255,0.05); }
.row-num {
    width: 28px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85em;
    flex-shrink: 0;
}
.row-id {
    width: 60px;
    text-align: center;
    font-weight: 700;
    color: var(--accent-cyan);
    text-decoration: none;
    flex-shrink: 0;
}
.row-id:hover { opacity: 0.7; text-decoration: underline; }
.row-name {
    flex: 1;
    color: var(--text-primary);
    padding-left: 10px;
}
.row-tags {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
}
/* ==================== 處置股監控區塊 ==================== */
.disposal-section {
    margin: 0 0 30px 0;
    padding: 0;
}
.disposal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 8px;
}
.disposal-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.disposal-icon { font-size: 1.2em; }
.disposal-title {
    margin: 0;
    font-size: 1.1em;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 1px;
}
.disposal-badge {
    background: var(--accent-red);
    color: #fff;
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 0.75em;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}
.disposal-badge.zero { background: var(--accent-green); }
.disposal-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.disposal-updated {
    font-size: 0.7em;
    color: var(--text-secondary);
}
.disposal-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--accent-red), #cc2952);
    color: #fff !important;
    text-decoration: none !important;
    font-size: 0.78em;
    font-weight: 600;
    transition: all 0.2s;
    border: 1px solid rgba(255,51,102,0.3);
}
.disposal-link-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255,51,102,0.3);
}
/* 警示橫幅 */
.disposal-alerts { margin-bottom: 12px; }
.alert-banner {
    background: rgba(255,149,0,0.1);
    border: 1px solid rgba(255,149,0,0.4);
    border-radius: 8px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.alert-icon { font-size: 1.1em; }
.alert-text {
    font-size: 0.82em;
    font-weight: 600;
    color: var(--accent-orange);
}
.alert-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.alert-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 6px;
    background: rgba(255,149,0,0.08);
    border: 1px solid rgba(255,149,0,0.3);
    font-size: 0.8em;
}
.alert-chip .chip-id {
    font-weight: 700;
    color: var(--accent-orange);
}
.alert-chip .chip-name { color: var(--text-primary); }
.chip-status {
    font-size: 0.72em;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
}
.chip-status.disposal { background: var(--accent-red); color: #fff; }
.chip-status.notice { background: var(--accent-orange); color: #fff; }
/* 卡片 grid */
.disposal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}
@media (max-width: 768px) {
    .disposal-grid { grid-template-columns: 1fr; }
}
.disposal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    min-height: 100px;
}
.disposal-card-release {
    border-left: 3px solid var(--accent-green);
}
.disposal-card-active {
    border-left: 3px solid var(--accent-red);
}
.card-label {
    font-size: 0.82em;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}
.disposal-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 220px;
    overflow-y: auto;
}
.disposal-list::-webkit-scrollbar { width: 4px; }
.disposal-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }
.disposal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    border-radius: 5px;
    background: rgba(255,255,255,0.03);
    font-size: 0.8em;
    transition: background 0.15s;
}
.disposal-item:hover { background: rgba(255,255,255,0.07); }
.disposal-item .item-left {
    display: flex;
    align-items: center;
    gap: 6px;
}
.disposal-item .item-id {
    font-weight: 700;
    color: var(--accent-cyan);
    min-width: 42px;
}
.disposal-item .item-name { color: var(--text-secondary); }
.disposal-item .item-right {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
}
.item-freq {
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.82em;
}
.freq-5 { background: rgba(255,51,102,0.2); color: var(--accent-red); border: 1px solid rgba(255,51,102,0.3); }
.freq-20 { background: rgba(255,149,0,0.2); color: var(--accent-orange); border: 1px solid rgba(255,149,0,0.3); }
.freq-45, .freq-60 { background: rgba(160,100,255,0.2); color: #c084fc; border: 1px solid rgba(160,100,255,0.3); }
.freq-other { background: rgba(125,139,167,0.2); color: var(--text-secondary); border: 1px solid var(--border-color); }
.item-days { font-weight: 600; color: var(--accent-green); }
.item-days.urgent { color: var(--accent-red); animation: disposal-pulse 1.5s infinite; }
@keyframes disposal-pulse { 0%,100%{opacity:1;} 50%{opacity:0.4;} }
.item-period { color: var(--text-secondary); font-size: 0.9em; }
.disposal-empty {
    text-align: center;
    padding: 16px;
    color: var(--text-secondary);
    font-size: 0.82em;
}
.loading-placeholder {
    text-align: center;
    padding: 16px;
    color: var(--text-secondary);
    font-size: 0.82em;
}
/* 快速連結 */
.disposal-quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.dqlink {
    padding: 4px 12px;
    border-radius: 5px;
    font-size: 0.72em;
    font-weight: 500;
    text-decoration: none !important;
    transition: all 0.2s;
    border: 1px solid;
}
.dqlink-risk { color: var(--accent-red); border-color: rgba(255,51,102,0.3); background: rgba(255,51,102,0.05); }
.dqlink-risk:hover { background: rgba(255,51,102,0.15); }
.dqlink-twse { color: var(--accent-cyan); border-color: rgba(0,217,255,0.3); background: rgba(0,217,255,0.05); }
.dqlink-twse:hover { background: rgba(0,217,255,0.15); }
.dqlink-tpex { color: #c084fc; border-color: rgba(160,100,255,0.3); background: rgba(160,100,255,0.05); }
.dqlink-tpex:hover { background: rgba(160,100,255,0.15); }
.dqlink-notice { color: var(--accent-orange); border-color: rgba(255,149,0,0.3); background: rgba(255,149,0,0.05); }
.dqlink-notice:hover { background: rgba(255,149,0,0.15); }


/* === AI Market Summary === */
.ai-summary-card {
    background: linear-gradient(135deg, #1a2235 0%, #1f2940 100%);
    border: 1px solid rgba(99, 179, 237, 0.3);
    border-radius: 12px;
    padding: 20px 24px;
    margin: 20px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.ai-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.ai-summary-title {
    font-size: 16px;
    font-weight: 700;
    color: #63b3ed;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ai-summary-meta {
    font-size: 12px;
    color: #8896a6;
    font-family: 'JetBrains Mono', monospace;
}
.ai-summary-content {
    color: #d6dde6;
    font-size: 14px;
    line-height: 1.75;
}
.ai-summary-content strong {
    color: #ffd166;
    font-weight: 600;
}
.ai-summary-content p {
    margin: 8px 0;
}
.ai-summary-content p:first-child {
    margin-top: 0;
}
.ai-summary-loading {
    color: #8896a6;
    font-style: italic;
    text-align: center;
    padding: 20px;
}
.ai-summary-error {
    color: #f85149;
    font-size: 13px;
    text-align: center;
    padding: 12px;
}

/* ===== from dashboard.html <style> block #4 ===== */
.notes-board .section-header { display:flex; align-items:center; justify-content:space-between;
        margin-bottom:16px; flex-wrap:wrap; gap:8px; }
    .notes-board .section-title { font-size:18px; font-weight:700; color:#e6edf3;
        display:flex; align-items:center; gap:8px; }
    .notes-board .section-title .badge { background:#d29922; color:#fff; font-size:12px;
        padding:2px 8px; border-radius:12px; font-weight:600; }
    .notes-board .section-subtitle { color:#8b949e; font-size:13px; }
    .notes-board .update-time { color:#484f58; font-size:12px; }
    .notes-add { display:flex; gap:8px; margin-bottom:14px; }
    .notes-add input { flex:1; background:#0d1117; border:1px solid #30363d; color:#e6edf3;
        border-radius:6px; padding:8px 12px; font-size:14px; }
    .notes-add button { background:#238636; color:#fff; border:none; border-radius:6px;
        padding:8px 16px; cursor:pointer; font-size:14px; font-weight:600; white-space:nowrap; }
    .notes-add button:hover { background:#2ea043; }
    .notes-list { display:flex; flex-direction:column; gap:8px; }
    .note-item { display:flex; align-items:flex-start; gap:10px; background:#0d1117;
        border:1px solid #21262d; border-left:3px solid #d29922; border-radius:6px; padding:10px 12px; }
    .note-item .note-text { flex:1; color:#e6edf3; font-size:14px; white-space:pre-wrap; word-break:break-word; }
    .note-item .note-date { color:#6e7681; font-size:11px; white-space:nowrap; margin-top:2px; }
    .note-item .note-del { background:none; border:none; color:#6e7681; cursor:pointer;
        font-size:14px; padding:0 4px; line-height:1.4; }
    .note-item .note-del:hover { color:#f85149; }
    .notes-empty { color:#6e7681; text-align:center; padding:16px; font-size:13px; }

/* ===== from dashboard.html <style> block #5 ===== */
/* header 置左,對齊回檔買點雷達(.pullback-radar 那套) */
            #breakout-pullback-section .section-header {
                display:flex; align-items:center; justify-content:space-between;
                margin-bottom:16px; flex-wrap:wrap; gap:8px;
            }
            #breakout-pullback-section .section-title {
                font-size:18px; font-weight:700; color:#e6edf3;
                display:flex; align-items:center; gap:8px; flex-wrap:wrap;
            }
            #breakout-pullback-section .section-subtitle { color:#8b949e; font-size:13px; text-align:left; }
            #breakout-pullback-section .update-time { color:#484f58; font-size:12px; }
            #breakout-pullback-section .strategy-tag {
                background:rgba(88,166,255,0.12); color:#58a6ff; font-size:10px;
                padding:2px 6px; border-radius:4px; font-weight:600;
                border:1px solid rgba(88,166,255,0.25); font-family:'JetBrains Mono', monospace;
            }
            #breakout-pullback-section .bp-cards { display:flex; flex-direction:column; gap:10px; }
            #breakout-pullback-section .bp-card {
                background:#0d1117; border:1px solid #30363d; border-radius:8px;
                padding:12px 14px;
            }
            #breakout-pullback-section .bp-card-head {
                display:flex; flex-wrap:wrap; align-items:baseline; gap:8px; margin-bottom:8px;
            }
            #breakout-pullback-section .bp-badge { font-size:14px; }
            #breakout-pullback-section .bp-code { color:#58a6ff; font-weight:700; text-decoration:none; }
            #breakout-pullback-section .bp-name { color:#e6edf3; font-weight:600; }
            #breakout-pullback-section .bp-meta { color:#8b949e; font-size:12px; }
            #breakout-pullback-section .bp-theme { font-size:12px; margin-left:auto; color:#e6edf3; }
            #breakout-pullback-section .bp-levels {
                display:flex; flex-wrap:wrap; gap:8px; margin-bottom:6px;
            }
            #breakout-pullback-section .bp-pill {
                font-size:12px; padding:3px 8px; border-radius:6px;
                background:#161b22; border:1px solid #30363d; color:#e6edf3;
            }
            #breakout-pullback-section .bp-pill.entry {
                background:rgba(88,166,255,0.12); border-color:#1f6feb; color:#58a6ff; font-weight:600;
            }
            #breakout-pullback-section .bp-pill.gap { color:#d29922; border-color:#d29922; }
            #breakout-pullback-section .bp-path { color:#8b949e; font-size:12px; line-height:1.6; }
            #breakout-pullback-section .bp-path .dn { color:#3fb950; }
            #breakout-pullback-section .bp-suggest {
                margin-top:6px; font-size:12px; color:#d29922;
            }
            #breakout-pullback-section .bp-empty {
                padding:18px; text-align:center; color:#8b949e; font-size:13px;
            }
            #breakout-pullback-section .bp-rejected {
                margin-top:12px; padding:10px 14px; background:#0d1117;
                border:1px dashed #30363d; border-radius:8px; font-size:12px; color:#8b949e;
            }
            #breakout-pullback-section .bp-rejected .rj-title { color:#d29922; font-weight:600; margin-bottom:6px; }
            #breakout-pullback-section .bp-rejected .rj-row { padding:2px 0; }

/* ===== from dashboard.html <style> block #6 ===== */
#trLegend table { width:100%; border-collapse:collapse; }
                #trLegend th { color:#8b949e; padding:4px 8px 6px; text-align:left; border-bottom:1px solid #30363d; font-weight:normal; }
                #trLegend td { padding:4px 8px; vertical-align:middle; }
                #trLegend th.stat, #trLegend td.stat { width:120px; }
                #trLegend td.cond { color:#8b949e; white-space:nowrap; }

/* ===== from dashboard.html <style> block #7 ===== */
/* header 比照 .nh-watchlist（否則掉回通用大字預設） */
        .dip-watchlist .section-header { display:flex; align-items:center; justify-content:space-between;
            margin-bottom:16px; flex-wrap:wrap; gap:8px; }
        .dip-watchlist .section-title { font-size:18px; font-weight:700; color:#e6edf3;
            display:flex; align-items:center; gap:8px; }
        .dip-watchlist .section-title .badge { background:#d29922; color:#fff; font-size:12px;
            padding:2px 8px; border-radius:12px; font-weight:600; }
        .dip-watchlist .section-subtitle { color:#8b949e; font-size:13px; }
        .dip-watchlist .update-time { color:#484f58; font-size:12px; }
        .dip-vix-banner { display:flex; align-items:center; gap:12px; flex-wrap:wrap;
            padding:10px 14px; border-radius:8px; margin:4px 0 14px; font-size:13px;
            border:1px solid #30363d; background:#161b22; color:#e6edf3; }
        .dip-vix-banner .dip-vix-val { font-size:15px; font-weight:700; }
        .dip-vix-banner .dip-vix-label { font-weight:700; padding:2px 10px; border-radius:12px; color:#0d1117; }
        .dip-vix-banner .dip-vix-action { color:#8b949e; }
        .dip-wl-table-wrap { overflow-x:auto; }
        .dip-wl-table { width:100%; border-collapse:collapse; font-size:13px; }
        .dip-wl-table th, .dip-wl-table td { padding:8px 10px; border-bottom:1px solid #21262d; text-align:left; white-space:nowrap; }
        .dip-wl-table th { color:#8b949e; font-weight:600; position:sticky; top:0; background:#0d1117; }
        .dip-wl-table td.dip-thesis { white-space:normal; min-width:240px; color:#adbac7; font-size:12px; }
        .dip-wl-table td.dip-sector { color:#58a6ff; }
        .dip-wl-table a { color:#58a6ff; text-decoration:none; }
        .dip-pull { font-weight:600; text-align:right; }
        .dip-pull-deep { color:#d29922; }
        .dip-pull-mid  { color:#adbac7; }
        .dip-pull-flat { color:#6e7681; }
        .dip-kd-k { color:#d29922; font-weight:600; }
        .dip-kd-d { color:#58a6ff; }
        .dip-kd-box { width:150px; height:46px; }
        .dip-kd-box canvas { width:150px !important; height:46px !important; }
        .dip-hint { font-weight:700; }
        .dip-hint-buy   { color:#f85149; }
        .dip-hint-watch { color:#d29922; }
        .dip-hint-idle  { color:#6e7681; }
        .dip-hint-safe  { color:#3fb950; }
        .dip-vix-override { color:#d29922; font-weight:700; }
        .dip-wl-empty { text-align:center; color:#6e7681; padding:20px; }
        .dip-wl-remove-btn { background:#21262d; color:#8b949e; border:1px solid #30363d;
            border-radius:6px; padding:3px 10px; cursor:pointer; font-size:12px; }
        .dip-wl-remove-btn:hover { color:#f85149; border-color:#f85149; }
        .dip-wl-add { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-top:14px;
            padding-top:12px; border-top:1px solid #21262d; }
        .dip-wl-add input { background:#0d1117; border:1px solid #30363d; color:#e6edf3;
            border-radius:6px; padding:6px 10px; font-size:13px; width:130px; }
        .dip-wl-add button { background:#238636; color:#fff; border:none; border-radius:6px;
            padding:6px 14px; cursor:pointer; font-size:13px; font-weight:600; }
        .dip-wl-add button:hover { background:#2ea043; }
        .dip-add-hint { color:#6e7681; font-size:11px; }
