/**
 * AI 解析結果儀表板樣式
 * ==========================================
 * 金融終端機風格設計
 * 支援打字機動畫效果
 *
 * 版本: 1.0.0
 * 日期: 2026-01-26
 */

/* ==================== 動畫定義 ==================== */

/* 區塊淡入動畫 */
@keyframes arp-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 信心度進度條動畫 */
@keyframes arp-confidence-fill {
    from { width: 0%; }
    to { width: var(--arp-confidence, 0%); }
}

/* 表格行滑入動畫 */
@keyframes arp-slide-in {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 脈動效果（成功狀態） */
@keyframes arp-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(16, 185, 129, 0);
    }
}

/* ==================== 主容器 ==================== */

.ai-parse-result-dashboard {
    background: linear-gradient(135deg, var(--color-bg-elevated) 0%, var(--color-bg-tertiary) 100%);
    border-radius: var(--brand-radius-lg, 20px);
    border: 1px solid var(--color-border-subtle);
    box-shadow:
        var(--shadow-md),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    overflow: hidden;
    font-family: var(--brand-font-family, 'Noto Sans TC', sans-serif);
}

/* ==================== 白話摘要 ==================== */

.friendly-summary {
    padding: 16px 20px;
}

.friendly-summary-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.friendly-summary-text {
    font-size: 15.5px;
    color: var(--color-text-primary);
    line-height: 1.6;
}

.friendly-summary-text strong {
    color: var(--color-accent);
    font-weight: 700;
}

.friendly-details-with-edit {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 20px;
}

.friendly-details-with-edit .friendly-details {
    flex: 1;
    margin-top: 0;
    padding-left: 0;
}

.friendly-details-with-edit .arp-edit-btn {
    flex-shrink: 0;
    margin-top: 2px;
}

.friendly-details {
    margin-top: 6px;
    padding-left: 4px;
}

.friendly-detail-line {
    font-size: 0.85em;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.friendly-explain {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-top: 8px;
    line-height: 1.6;
}

/* Dark theme */
[data-theme="dark"] .friendly-summary-text {
    color: #E0E0E0;
}

[data-theme="dark"] .friendly-summary-text strong {
    color: #FB923C;
}

[data-theme="dark"] .friendly-detail-line {
    color: #9CA3AF;
}

[data-theme="dark"] .friendly-explain {
    color: #A0A0A0;
}

/* 進階設定收合區塊 */
.arp-advanced-settings .arp-collapsible-content {
    padding: 0;
}

/* ⭐ v9.6.0: 主標題視覺強化 */
.arp-advanced-settings > .arp-collapsible-header {
    background: var(--color-secondary-muted);
    font-weight: 700;
    padding: 14px 20px;
}

.arp-advanced-settings .arp-collapsible-content .arp-collapsible {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* 子區塊（輸出欄位/走勢圖）視覺分區 */
.arp-sub-section {
    margin-top: 0;
}

.arp-sub-section .arp-collapsible-header {
    padding: 8px 16px;
    font-size: 12.5px;
    border-radius: 0;
    margin: 0;
    transition: background 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

.arp-sub-section .arp-collapsible-header:hover {
    background: var(--color-secondary-muted);
}

.arp-sub-section .arp-collapsible-header:active {
    transform: scale(0.995);
}

.arp-section-icon-sm {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: var(--color-secondary);
    opacity: 0.85;
    background: var(--color-secondary-muted);
    border-radius: 4px;
}

/* ⭐ v9.6.0: 走勢圖 CSS Grid 佈局（取代 inline-flex hack） */
.cle-grid-layout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px 8px;
}

.cle-grid-layout .cle-category-header {
    grid-column: 1 / -1;
}

.cle-grid-layout .cle-row {
    display: flex;
    width: auto;
}

@media (max-width: 480px) {
    .cle-grid-layout {
        grid-template-columns: 1fr;
    }
}

/* 參數列：badge + 編輯按鈕 flex 佈局 */
.arp-params-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.arp-params-row .arp-params-inline {
    flex: 1;
    min-width: 0;
}

/* 進階設定內的編輯按鈕 */
.arp-edit-params-inline {
    flex-shrink: 0;
    font-size: 12px;
    padding: 5px 12px;
    gap: 5px;
    white-space: nowrap;
}

.arp-advanced-inner {
    padding: 12px 16px;
}

/* Responsive */
@media (max-width: 480px) {
    .friendly-summary {
        padding: 12px 16px;
    }

    .friendly-summary-text {
        font-size: 14px;
    }
}

/* ==================== 狀態列 ==================== */

.arp-status-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(90deg, #F0FDF4 0%, #FEFCE8 100%);
    border-bottom: 1px solid rgba(16, 185, 129, 0.15);
    opacity: 0;
    animation: arp-fade-in 0.3s ease forwards;
}

.arp-status-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-success);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    animation: arp-pulse 2s ease infinite;
}

.arp-status-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-success);
}

.arp-engine-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-hover) 100%);
    color: white;
    border-radius: var(--brand-radius-full, 9999px);
    font-size: 12px;
    font-weight: 600;
    box-shadow: var(--shadow-accent);
}

.arp-confidence-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.arp-confidence-track {
    flex: 1;
    max-width: 120px;
    height: 6px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.arp-confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-success) 0%, #34D399 100%);
    border-radius: 3px;
    width: 0%;
    animation: arp-confidence-fill 0.8s ease forwards;
    animation-delay: 0.3s;
}

.arp-confidence-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-success);
    min-width: 40px;
    text-align: right;
}

/* ==================== 分隔線 ==================== */

.arp-divider {
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--color-border-default) 20%,
        var(--color-border-default) 80%,
        transparent 100%);
    margin: 0;
    opacity: 0;
    animation: arp-fade-in 0.2s ease forwards;
}

/* ==================== 區塊容器 ==================== */

.arp-section {
    padding: 16px 20px;
    opacity: 0;
    animation: arp-fade-in 0.3s ease forwards;
}

.arp-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 12px;
}

.arp-section-icon {
    font-size: 16px;
}

/* ==================== 2x2 資料格線 ==================== */

.arp-data-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: var(--color-secondary-subtle);
    border-radius: var(--brand-radius-md, 12px);
    overflow: hidden;
    border: 1px solid var(--color-border-subtle);
}

.arp-data-cell {
    background: var(--color-bg-elevated);
    padding: 12px 14px;
}

.arp-data-label {
    font-size: 12px;
    color: var(--color-text-tertiary);
    margin-bottom: 4px;
}

.arp-data-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
}

/* ==================== 條列式資料列表 ==================== */

.arp-data-list {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--color-bg-elevated);
    border-radius: var(--brand-radius-md, 12px);
    border: 1px solid var(--color-secondary-subtle);
    overflow: hidden;
}

.arp-data-item {
    display: flex;
    align-items: baseline;
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border-subtle);
}

.arp-data-item:last-child {
    border-bottom: none;
}

.arp-data-item .arp-data-label {
    flex-shrink: 0;
    width: 80px;
    font-size: 13px;
    color: var(--color-text-tertiary);
    margin-bottom: 0;
}

.arp-data-item .arp-data-value {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-primary);
}

/* ==================== 查詢條件主焦點區 (v2.0 重設計) ==================== */

.arp-query-highlight {
    background: linear-gradient(135deg, var(--color-bg-hover) 0%, var(--color-bg-secondary) 100%);
    border-left: 4px solid var(--color-accent);
    border-radius: var(--brand-radius-md, 12px);
    padding: 16px 20px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: var(--shadow-sm);
}

.arp-query-highlight .arp-query-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-primary);
    flex: 1;
    line-height: 1.4;
}

.arp-query-highlight .arp-query-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: var(--color-bg-hover);
    border: 1px solid var(--color-border-default);
    border-radius: var(--brand-radius-sm, 6px);
    cursor: pointer;
    color: var(--color-secondary);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.arp-query-highlight .arp-query-edit:hover {
    background: var(--color-bg-active);
    border-color: var(--color-secondary-hover);
    transform: scale(1.05);
    box-shadow: var(--shadow-sm);
}

.arp-query-highlight .arp-query-edit:active {
    transform: scale(0.98);
}

.arp-query-highlight .arp-query-edit svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

/* ==================== 參數標籤橫排 (v2.0 重設計) ==================== */

.arp-params-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.arp-param-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #F5F5F4;
    border-radius: var(--brand-radius-full, 9999px);
    padding: 6px 14px;
    font-size: 13px;
    border: 1px solid #E7E5E4;
    transition: all 0.2s ease;
}

.arp-param-badge:hover {
    background: #EEEEEC;
    border-color: #D6D3D1;
}

.arp-param-badge .arp-param-label {
    color: var(--color-text-secondary);
    font-weight: 500;
}

.arp-param-badge .arp-param-value {
    color: var(--color-text-primary);
    font-weight: 700;
}

/* ==================== 輸出欄位表格 ==================== */

.arp-fields-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--brand-radius-md, 12px);
    overflow: hidden;
    border: 1px solid var(--color-border-subtle);
}

.arp-fields-table thead {
    background: linear-gradient(135deg, var(--color-bg-hover) 0%, var(--color-bg-secondary) 100%);
}

.arp-fields-table th {
    padding: 8px 14px;  /* 從 10px 減少到 8px - 更緊湊 */
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-align: left;
    border-bottom: 1px solid var(--color-border-subtle);
}

.arp-fields-table td {
    padding: 8px 14px;  /* 從 10px 減少到 8px - 更緊湊 */
    font-size: 13px;
    color: var(--color-text-primary);
    background: var(--color-bg-elevated);
    border-bottom: 1px solid var(--color-border-subtle);
}

.arp-fields-table tbody tr {
    opacity: 0;
    animation: arp-slide-in 0.3s ease forwards;
}

.arp-fields-table tbody tr:nth-child(1) { animation-delay: 0.1s; }
.arp-fields-table tbody tr:nth-child(2) { animation-delay: 0.2s; }
.arp-fields-table tbody tr:nth-child(3) { animation-delay: 0.3s; }
.arp-fields-table tbody tr:nth-child(4) { animation-delay: 0.4s; }
.arp-fields-table tbody tr:nth-child(5) { animation-delay: 0.5s; }

.arp-fields-table tbody tr:last-child td {
    border-bottom: none;
}

.arp-sort-icon {
    font-size: 12px;
    margin-right: 4px;
}

/* ==================== 指標卡片 ==================== */

.arp-indicator-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: linear-gradient(135deg, var(--color-bg-secondary) 0%, var(--color-bg-elevated) 100%);
    border-radius: var(--brand-radius-md, 12px);
    border: 1px solid var(--color-border-subtle);
    margin-bottom: 12px;
}

.arp-indicator-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--brand-radius-sm, 6px);
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-hover) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: var(--shadow-accent);
}

.arp-indicator-content {
    flex: 1;
}

.arp-indicator-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 4px;
}

.arp-indicator-desc {
    font-size: 13px;
    color: var(--color-text-tertiary);
    line-height: 1.5;
}

/* ==================== 條件項目 ==================== */

.arp-condition-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: var(--color-bg-elevated);
    border-left: 3px solid var(--color-accent);
    border-radius: 0 var(--brand-radius-sm, 6px) var(--brand-radius-sm, 6px) 0;
    margin-top: 10px;
    box-shadow: var(--shadow-sm);
}

.arp-condition-marker {
    color: var(--color-accent);
    font-size: 16px;
    flex-shrink: 0;
}

.arp-condition-content {
    flex: 1;
}

.arp-condition-text {
    font-size: 14px;
    font-weight: 600;  /* 從 500 調整為 600 - 更加粗 */
    color: var(--color-text-primary);
    margin-bottom: 4px;
}

.arp-condition-explain {
    font-size: 13px;
    color: var(--color-text-muted);  /* 更淡的顏色，從 #78716C 調整 */
}

/* ==================== 底部摘要 ==================== */

.arp-summary-footer {
    padding: 14px 20px;
    background: linear-gradient(90deg, #F0FDF4 0%, #ECFDF5 100%);
    border-top: 1px solid rgba(16, 185, 129, 0.15);
    opacity: 0;
    animation: arp-fade-in 0.3s ease forwards;
}

.arp-summary-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-success);
    font-weight: 500;
}

.arp-summary-icon {
    font-size: 14px;
}

/* ==================== 動畫延遲類別 ==================== */

.arp-delay-1 { animation-delay: 0ms !important; }
.arp-delay-2 { animation-delay: 200ms !important; }
.arp-delay-3 { animation-delay: 300ms !important; }
.arp-delay-4 { animation-delay: 500ms !important; }
.arp-delay-5 { animation-delay: 700ms !important; }
.arp-delay-6 { animation-delay: 900ms !important; }
.arp-delay-7 { animation-delay: 1100ms !important; }
.arp-delay-8 { animation-delay: 1300ms !important; }

/* ==================== 打字機效果輔助 ==================== */

.arp-animate-in {
    animation: arp-fade-in 0.3s ease forwards !important;
}

.arp-typewriter {
    overflow: hidden;
    border-right: 2px solid var(--color-accent);
    animation: arp-blink 0.7s step-end infinite;
}

@keyframes arp-blink {
    50% { border-color: transparent; }
}

/* ==================== 深色模式支援（預留） ==================== */

@media (prefers-color-scheme: dark) {
    /* 未來可擴展深色模式樣式 */
}

/* ==============================================================================
   Admin Debug Dashboard - 管理者詳細除錯面板
   ============================================================================== */

/* 主容器 */
.admin-debug-dashboard {
    margin-top: 20px;
    background: #1a1b2e;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    overflow: hidden;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Header */
.admin-debug-header {
    background: linear-gradient(90deg, #2d2f4a 0%, #1e2040 100%);
    color: #e2e8f0;
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
    user-select: none;
    transition: background 0.2s ease;
    border-bottom: 2px solid rgba(249, 115, 22, 0.5);
}

.admin-debug-header:hover {
    background: linear-gradient(90deg, #363860 0%, #262850 100%);
}

.admin-debug-icon {
    font-size: 18px;
}

.admin-debug-title {
    flex: 1;
    font-family: 'Noto Sans TC', sans-serif;
}

.admin-debug-toggle {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.admin-debug-dashboard.expanded .admin-debug-toggle {
    transform: rotate(180deg);
}

/* Content 區塊 */
.admin-debug-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    background: #1a1b2e;
}

.admin-debug-dashboard.expanded .admin-debug-content {
    max-height: 5000px;
}

/* ==================== Debug Section ==================== */

.debug-section {
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.debug-section:last-child {
    border-bottom: none;
}

.debug-section-header {
    background: rgba(255, 255, 255, 0.03);
    color: #cbd5e1;
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-family: 'Noto Sans TC', sans-serif;
    transition: background 0.2s ease;
    user-select: none;
}

.debug-section-header:hover {
    background: rgba(255, 255, 255, 0.06);
}

.debug-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.debug-section-icon {
    font-size: 16px;
}

.section-toggle {
    font-size: 10px;
    color: #64748b;
    transition: transform 0.3s ease;
}

.debug-section.expanded .section-toggle {
    transform: rotate(180deg);
}

.debug-section-content {
    padding: 0 16px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.debug-section.expanded .debug-section-content {
    padding: 16px;
    max-height: 2000px;
}

/* ==================== Pipeline Steps (v6.9.0) ==================== */

.debug-pipeline {
    padding: 0;
}

.debug-pipeline-step {
    display: flex;
    gap: 0;
}

.debug-step-connector {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 40px;
    min-width: 40px;
    padding-top: 14px;
}

.debug-step-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f97316;
    color: white;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.debug-step-line {
    width: 2px;
    flex: 1;
    background: rgba(249, 115, 22, 0.25);
    margin-top: 4px;
}

.debug-pipeline-step:last-child .debug-step-line {
    display: none;
}

.debug-step-body {
    flex: 1;
    min-width: 0;
}

.debug-step-body > .debug-section {
    border-bottom: none;
    border-left: none;
}

/* ==================== Confidence Breakdown (4D) ==================== */

.confidence-breakdown {
    padding: 8px 0;
}

.confidence-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.confidence-bar-label {
    color: #94a3b8;
    font-size: 11px;
    width: 32px;
    text-align: right;
    flex-shrink: 0;
}

.confidence-bar-track {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.confidence-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #f97316, #10b981);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.confidence-bar-value {
    color: #94a3b8;
    font-size: 11px;
    width: 36px;
    text-align: left;
    flex-shrink: 0;
}

/* ==================== Module Tags ==================== */

.module-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.module-tag {
    display: inline-block;
    background: rgba(96, 165, 250, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(96, 165, 250, 0.25);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-family: 'Consolas', monospace;
}

/* ==================== Layer Cards ==================== */

.layer-card {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 10px;
    transition: background 0.2s ease;
    border: 1px solid rgba(148, 163, 184, 0.08);
}

.layer-card:hover {
    background: rgba(255, 255, 255, 0.07);
}

.layer-card:last-child {
    margin-bottom: 0;
}

.layer-card.success {
    border-left: 4px solid #34d399;
}

.layer-card.failed {
    border-left: 4px solid #f87171;
}

.layer-card.skipped {
    border-left: 4px solid #64748b;
}

.layer-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.layer-name {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    font-family: 'Noto Sans TC', sans-serif;
}

.layer-status {
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.layer-status.success {
    background: rgba(52, 211, 153, 0.2);
    color: #34d399;
}

.layer-status.failed {
    background: rgba(248, 113, 113, 0.2);
    color: #f87171;
}

.layer-status.skipped {
    background: rgba(100, 116, 139, 0.25);
    color: #94a3b8;
}

.layer-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.layer-metric {
    text-align: center;
}

.layer-metric-value {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.layer-metric-label {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

.layer-metric-value.highlight {
    color: #34d399;
}

.layer-metric-value.warning {
    color: #fbbf24;
}

.layer-metric-value.error {
    color: #f87171;
}

/* ==================== Code Block ==================== */

.debug-code-block {
    background: #0f1019;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 8px;
    padding: 14px;
    margin: 10px 0;
    overflow-x: auto;
    position: relative;
}

.debug-code-block pre {
    margin: 0;
    color: #c9d1d9;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

.debug-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(249, 115, 22, 0.8);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: background 0.2s ease;
    z-index: 10;
}

.debug-copy-btn:hover {
    background: rgba(249, 115, 22, 1);
}

.debug-copy-btn.copied {
    background: #34d399;
}

/* JSON 語法高亮 */
.json-key {
    color: #7dd3fc;
}

.json-string {
    color: #86efac;
}

.json-number {
    color: #fbbf24;
}

.json-boolean {
    color: #f472b6;
}

.json-null {
    color: var(--color-text-secondary);
}

/* DSL 語法高亮 */
.dsl-keyword {
    color: #c792ea;
    font-weight: 600;
}

.dsl-variable {
    color: #82aaff;
}

.dsl-function {
    color: #ffcb6b;
}

.dsl-operator {
    color: #89ddff;
}

.dsl-number {
    color: #f78c6c;
}

.dsl-string {
    color: #c3e88d;
}

.dsl-comment {
    color: #676e95;
    font-style: italic;
}

/* ==================== Few-shot Card ==================== */

.fewshot-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 12px;
}

.fewshot-card:last-child {
    margin-bottom: 0;
}

.fewshot-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.fewshot-similarity {
    display: inline-flex;
    align-items: center;
    background: #3b82f6;
    color: white;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.fewshot-confidence {
    display: inline-flex;
    align-items: center;
    background: #10b981;
    color: white;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.fewshot-query {
    color: #86efac;
    font-style: italic;
    font-size: 13px;
    padding: 8px 12px;
    background: rgba(134, 239, 172, 0.1);
    border-radius: 4px;
    border-left: 3px solid #86efac;
}

/* ==================== Summary Stats ==================== */

.debug-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.debug-stat {
    background: rgba(255, 255, 255, 0.06);
    padding: 14px 12px;
    border-radius: 8px;
    text-align: center;
    transition: background 0.2s ease;
    border: 1px solid rgba(148, 163, 184, 0.08);
}

.debug-stat:hover {
    background: rgba(255, 255, 255, 0.10);
}

.debug-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #e2e8f0;
}

.debug-stat-label {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
    font-family: 'Noto Sans TC', sans-serif;
}

.debug-stat-value.success {
    color: #34d399;
}

.debug-stat-value.warning {
    color: #fbbf24;
}

.debug-stat-value.info {
    color: #60a5fa;
}

/* ==================== Prompt Preview ==================== */

.prompt-preview {
    position: relative;
}

.prompt-preview-content {
    max-height: 150px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.prompt-preview.expanded .prompt-preview-content {
    max-height: 2000px;
}

.prompt-expand-btn {
    display: block;
    width: 100%;
    padding: 8px;
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 4px;
    color: #60a5fa;
    font-size: 12px;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s ease;
}

.prompt-expand-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ==================== Learning Status ==================== */

.learning-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
}

.learning-status-icon {
    font-size: 24px;
}

.learning-status-content {
    flex: 1;
}

.learning-status-title {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    font-family: 'Noto Sans TC', sans-serif;
}

.learning-status-detail {
    color: #94a3b8;
    font-size: 12px;
}

.learning-status.saved {
    border-left: 4px solid #34d399;
}

.learning-status.not-saved {
    border-left: 4px solid #64748b;
}

/* ==================== Indicator Mapping ==================== */

.indicator-mapping {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.indicator-mapping-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    font-size: 12px;
}

.indicator-alias {
    color: #f472b6;
}

.indicator-arrow {
    color: #64748b;
}

.indicator-standard {
    color: #86efac;
    font-weight: 600;
}

/* ==================== Token Usage ==================== */

.token-usage {
    display: flex;
    gap: 16px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    margin-top: 10px;
}

.token-item {
    text-align: center;
    flex: 1;
}

.token-value {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.token-label {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 2px;
}

/* ==================== Empty State ==================== */

.debug-empty {
    text-align: center;
    padding: 20px;
    color: #64748b;
    font-size: 13px;
    font-style: italic;
}

/* ==============================================================================
   Output Field Editor (OFE) - 輸出欄位互動式編輯器
   ============================================================================== */

/* 容器提示文字 */
.ofe-hint {
    font-size: 12px;
    font-weight: 400;
    color: var(--color-text-tertiary);
    margin-left: 8px;
}

/* 表格行 */
.ofe-row {
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.ofe-row:hover {
    background-color: var(--color-secondary-muted);
}

.ofe-row-disabled {
    opacity: 0.5;
}

.ofe-row-disabled .ofe-label-text {
    text-decoration: line-through;
    color: var(--color-text-tertiary);
}

/* 欄位名稱儲存格 */
.ofe-field-name {
    width: 60%;
}

/* 勾選框包裝器 */
.ofe-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

/* 隱藏原生勾選框 */
.ofe-show-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* 自訂勾選框樣式 */
.ofe-checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #D6D3D1;
    border-radius: 4px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

/* 勾選狀態 */
.ofe-show-checkbox:checked + .ofe-checkbox-custom {
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-hover) 100%);
    border-color: var(--color-accent);
}

.ofe-show-checkbox:checked + .ofe-checkbox-custom::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

/* Hover 效果 */
.ofe-checkbox-wrapper:hover .ofe-checkbox-custom {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-muted);
}

/* Focus 效果 */
.ofe-show-checkbox:focus + .ofe-checkbox-custom {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-subtle);
}

/* 標籤文字 */
.ofe-label-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-primary);
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

/* 排序儲存格 */
.ofe-sort-cell {
    width: 40%;
    text-align: center;
}

/* ==============================================================================
   排序切換按鈕 v2.0 - 單一切換按鈕設計
   點擊循環：━(不排序) → ▲(升序) → ▼(降序) → ━
   ============================================================================== */

/* 排序切換按鈕基礎樣式 */
.ofe-sort-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 36px;
    padding: 0;
    background: #F5F5F4;
    border: 1px solid #E7E5E4;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--color-text-muted);
}

.ofe-sort-toggle:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ofe-sort-toggle:active:not(:disabled) {
    transform: scale(0.98);
}

/* 排序切換按鈕 - 不排序狀態 (data-sort="0") */
.ofe-sort-toggle[data-sort="0"] {
    background: #F5F5F4;
    border-color: #E7E5E4;
    color: var(--color-text-muted);
}

.ofe-sort-toggle[data-sort="0"]:hover:not(:disabled) {
    background: #EEEEEC;
    border-color: #D6D3D1;
    color: var(--color-text-tertiary);
}

/* 排序切換按鈕 - 升序狀態 (data-sort="-1") */
.ofe-sort-toggle[data-sort="-1"] {
    background: #ECFDF5;
    border-color: #A7F3D0;
    color: #059669;
}

.ofe-sort-toggle[data-sort="-1"]:hover:not(:disabled) {
    background: #D1FAE5;
    border-color: #6EE7B7;
    color: #047857;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.2);
}

/* 排序切換按鈕 - 降序狀態 (data-sort="1") */
.ofe-sort-toggle[data-sort="1"] {
    background: #FEF2F2;
    border-color: #FECACA;
    color: #DC2626;
}

.ofe-sort-toggle[data-sort="1"]:hover:not(:disabled) {
    background: #FEE2E2;
    border-color: #FCA5A5;
    color: #B91C1C;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.2);
}

/* 排序切換按鈕 - Disabled 狀態 */
.ofe-sort-toggle:disabled {
    background: var(--quote-panel-bg, #FAF9F6) !important;
    border-color: var(--quote-table-border, #E8E5E0) !important;
    color: var(--color-border-strong) !important;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    opacity: 0.6;
}

/* 排序圖示 - 增大尺寸到 20px */
.ofe-sort-toggle .ofe-sort-icon {
    font-size: 20px;
    line-height: 1;
    font-weight: 600;
}

/* 響應式調整 */
@media (max-width: 480px) {
    .ofe-field-name {
        width: 55%;
    }

    .ofe-sort-cell {
        width: 45%;
    }

    .ofe-sort-toggle {
        width: 36px;
        height: 32px;
    }

    .ofe-sort-toggle .ofe-sort-icon {
        font-size: 18px;
    }

    .ofe-hint {
        display: none;
    }
}

/* ==============================================================================
   Chart Line Editor (CLE) - 走勢圖設定編輯器
   v13.0.0
   ============================================================================== */

.cle-container {
    padding: 8px 16px 12px;
}

.cle-category-header {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 0 4px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    margin-bottom: 2px;
}

.cle-category-header:first-child {
    padding-top: 0;
}

.cle-row {
    padding: 5px 4px;
    border-radius: 6px;
    transition: background-color 0.15s ease;
}

.cle-row:hover {
    background-color: var(--color-secondary-muted);
}

.cle-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

/* 隱藏原生勾選框 */
.cle-show-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* 自訂勾選框 — 複用 OFE 樣式 */
.cle-checkbox-custom {
    width: 16px;
    height: 16px;
    border: 2px solid #D6D3D1;
    border-radius: 3px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.cle-show-checkbox:checked + .cle-checkbox-custom {
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-hover) 100%);
    border-color: var(--color-accent);
}

.cle-show-checkbox:checked + .cle-checkbox-custom::after {
    content: '';
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.cle-checkbox-wrapper:hover .cle-checkbox-custom {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent-subtle);
}

/* 色塊 */
.cle-color-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.1);
}

/* 標籤文字 */
.cle-label-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-primary);
}

/* 手機版 */
@media (max-width: 768px) {
    .cle-container {
        padding: 6px 12px 10px;
    }
    .cle-row {
        padding: 4px 2px;
    }
    .cle-label-text {
        font-size: 12px;
    }
}

/* ==============================================================================
   Inline Parameter Editor (IPE) - 篩選條件參數子面板
   v9.4.0
   ============================================================================== */

.ipe-container {
    padding: 8px 16px 12px;
}

.ipe-category-header {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 0 4px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    margin-bottom: 2px;
}

.ipe-category-header:first-child {
    padding-top: 0;
}

.ipe-row {
    display: flex;
    align-items: center;
    padding: 6px 4px;
    gap: 12px;
    border-radius: 6px;
    transition: background-color 0.15s ease;
}

.ipe-row:hover {
    background-color: var(--color-secondary-muted);
}

.ipe-row.ipe-changed {
    background-color: var(--color-secondary-muted);
}

.ipe-label {
    flex: 0 0 72px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-primary);
}

.ipe-value-static {
    font-size: 13px;
    color: var(--color-text-tertiary);
}

.ipe-select {
    flex: 1;
    max-width: 160px;
    padding: 4px 8px;
    font-size: 13px;
    border: 1px solid #E7E5E4;
    border-radius: 6px;
    background: white;
    color: var(--color-text-primary);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2378716C' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

.ipe-select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent-subtle);
}

.ipe-select:hover {
    border-color: var(--color-text-muted);
}

/* 指標參數行 */
.ipe-indicator-row {
    flex-wrap: wrap;
}

.ipe-param-fields {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    flex-wrap: wrap;
}

.ipe-param-field {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ipe-param-label {
    font-size: 12px;
    color: var(--color-text-tertiary);
    white-space: nowrap;
}

.ipe-input {
    width: 64px;
    padding: 4px 8px;
    font-size: 13px;
    border: 1px solid #E7E5E4;
    border-radius: 6px;
    background: white;
    color: var(--color-text-primary);
    text-align: center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ipe-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent-subtle);
}

.ipe-input:hover {
    border-color: var(--color-text-muted);
}

/* 套用按鈕行 */
.ipe-apply-row {
    display: none;
    justify-content: flex-end;
    padding: 10px 4px 4px;
    border-top: 1px solid rgba(0,0,0,0.06);
    margin-top: 8px;
}

.ipe-apply-btn {
    padding: 6px 20px;
    font-size: 13px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-hover) 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ipe-apply-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-accent);
}

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

.ipe-apply-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 手機版 */
@media (max-width: 768px) {
    .ipe-container {
        padding: 6px 12px 10px;
    }
    .ipe-row {
        padding: 5px 2px;
        gap: 8px;
    }
    .ipe-label {
        flex: 0 0 60px;
        font-size: 12px;
    }
    .ipe-select, .ipe-input {
        font-size: 12px;
    }
    .ipe-param-fields {
        gap: 8px;
    }
}

/* ==============================================================================
   Indicator Params Editor - 指標參數編輯器（舊 Modal 版 — 保留向後兼容）
   ============================================================================== */

/* 編輯按鈕（在查詢條件旁） */
.arp-edit-params-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-left: 8px;
    padding: 0;
    background: var(--color-bg-hover);
    border: 1px solid var(--color-border-default);
    border-radius: var(--brand-radius-sm, 6px);
    cursor: pointer;
    color: var(--color-secondary);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.arp-edit-params-btn:hover {
    background: var(--color-bg-active);
    border-color: var(--color-secondary-hover);
    transform: scale(1.05);
    box-shadow: var(--shadow-sm);
}

.arp-edit-params-btn:active {
    transform: scale(0.98);
}

.arp-edit-params-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

/* Modal 容器 */
.indicator-params-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
}

.indicator-params-modal.showing {
    display: flex !important;
}

.indicator-params-modal.hiding {
    display: flex;
    opacity: 0;
}

/* Modal 背景遮罩 */
.indicator-params-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

/* Modal 內容區 */
.indicator-params-content {
    position: relative;
    width: 90%;
    max-width: 480px;
    max-height: 80vh;
    background: var(--color-bg-elevated);
    border-radius: var(--brand-radius-lg, 20px);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.15),
        0 8px 24px var(--color-secondary-subtle);
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s ease;
}

.indicator-params-modal.showing .indicator-params-content {
    transform: translateY(0) scale(1);
}

.indicator-params-modal.hiding .indicator-params-content {
    transform: translateY(20px) scale(0.95);
}

/* Modal Header */
.indicator-params-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--color-bg-hover) 0%, var(--color-bg-secondary) 100%);
    border-bottom: 1px solid var(--color-border-default);
}

.indicator-params-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.indicator-params-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.indicator-params-close:hover {
    background: var(--color-secondary-subtle);
    color: var(--color-secondary-hover);
}

/* Modal Body */
.indicator-params-body {
    padding: 20px;
    max-height: calc(80vh - 140px);
    overflow-y: auto;
}

/* 指標表單組 */
.indicator-form-group {
    padding: 16px;
    background: var(--color-bg-secondary);
    border-radius: var(--brand-radius-md, 12px);
    margin-bottom: 16px;
}

.indicator-form-group:last-child {
    margin-bottom: 0;
}

.indicator-form-title {
    margin-bottom: 12px;
}

.indicator-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-hover) 100%);
    color: white;
    border-radius: var(--brand-radius-full, 9999px);
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-accent);
}

/* 參數輸入區域 */
.indicator-params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.indicator-param-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.indicator-param-field label {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-tertiary);
}

.indicator-param-input {
    width: 100%;
    padding: 8px 12px;
    background: white;
    border: 1px solid #E7E5E4;
    border-radius: var(--brand-radius-sm, 6px);
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-primary);
    text-align: center;
    transition: all 0.2s ease;
}

.indicator-param-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-subtle);
}

.indicator-param-input::-webkit-inner-spin-button,
.indicator-param-input::-webkit-outer-spin-button {
    opacity: 1;
}

/* Modal Footer */
.indicator-params-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    background: var(--color-bg-secondary);
    border-top: 1px solid #E7E5E4;
}

.indicator-params-cancel-btn {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid #E7E5E4;
    border-radius: var(--brand-radius-md, 12px);
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.indicator-params-cancel-btn:hover {
    background: #F5F5F4;
    border-color: #D6D3D1;
}

.indicator-params-apply-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-hover) 100%);
    border: none;
    border-radius: var(--brand-radius-md, 12px);
    font-size: 14px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    box-shadow: var(--shadow-accent);
    transition: all 0.2s ease;
}

.indicator-params-apply-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--color-accent-subtle);
}

.indicator-params-apply-btn:active:not(:disabled) {
    transform: translateY(0);
}

.indicator-params-apply-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.indicator-params-apply-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

/* Spinner 動畫 */
.indicator-params-apply-btn .spinner {
    animation: arp-spin 1s linear infinite;
}

@keyframes arp-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 響應式調整 */
@media (max-width: 480px) {
    .indicator-params-content {
        width: 95%;
        max-height: 90vh;
        border-radius: var(--brand-radius-md, 12px);
    }

    .indicator-params-body {
        max-height: calc(90vh - 140px);
    }

    .indicator-params-grid {
        grid-template-columns: 1fr 1fr;
    }

    .indicator-params-footer {
        flex-direction: column;
    }

    .indicator-params-cancel-btn,
    .indicator-params-apply-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ==================== 簡化版解析結果 - Claude.ai 風格 ==================== */

/* === 簡潔摘要行 (已遷移至 completion-indicator.css) === */

.arp-edit-btn {
    padding: 6px 12px;
    background: var(--color-secondary-subtle);
    border: 1px solid var(--color-border-default);
    border-radius: 6px;
    color: var(--color-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.arp-edit-btn:hover {
    background: var(--color-secondary-subtle);
    border-color: var(--color-secondary);
}

/* === 可摺疊區塊 === */
.arp-collapsible {
    border-bottom: 1px solid var(--color-border-subtle);
}

.arp-collapsible:last-of-type {
    border-bottom: none;
}

.arp-collapsible-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: var(--color-text-tertiary);
    transition: background 0.25s ease, color 0.25s ease;
    border-radius: 8px;
    margin: 0 4px;
}

.arp-collapsible-header:hover {
    background: var(--color-secondary-muted);
    color: var(--color-text-primary);
}

.arp-chevron {
    font-size: 12px;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: var(--color-text-muted);
}

.arp-collapsible[data-expanded="true"] > .arp-collapsible-header .arp-chevron {
    transform: rotate(90deg);
    color: var(--color-accent);
}

.arp-collapsible-title {
    flex: 1;
    font-weight: 600;
}

.arp-collapsible-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    /* JS 全權控制 max-height/opacity transition — 動態時長 */
}

.arp-collapsible[data-expanded="true"] > .arp-collapsible-content {
    /* max-height + opacity 由 JS inline style 控制，避免 none → 0 無法 transition */
    overflow-y: auto;
    padding: 0 20px 16px;
}

.arp-badge {
    background: var(--color-secondary-subtle);
    color: var(--color-secondary);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    margin-left: auto;
    transition: transform 0.3s ease;
}

/* ⭐ v9.6.0: Badge 脈動動畫（勾選變更時觸發） */
@keyframes arp-badge-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.arp-badge.arp-badge-pulse {
    animation: arp-badge-pulse 0.3s ease;
}

/* === 參數標籤行（內嵌在可摺疊內容中） === */
.arp-params-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.arp-params-inline .arp-param-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--color-secondary-muted);
    border-radius: 6px;
    font-size: 12px;
}

.arp-params-inline .arp-param-label {
    color: var(--color-text-muted);
}

.arp-params-inline .arp-param-value {
    color: var(--color-text-primary);
    font-weight: 600;
}

/* === 條件說明行（內嵌在可摺疊內容中） === */
.arp-conditions-inline {
    margin-top: 8px;
}

.arp-conditions-inline .arp-condition-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 0;
}

.arp-conditions-inline .arp-condition-marker {
    color: var(--color-accent);
    font-weight: 600;
    flex-shrink: 0;
}

.arp-conditions-inline .arp-condition-content {
    flex: 1;
}

.arp-conditions-inline .arp-condition-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-primary);
}

.arp-conditions-inline .arp-condition-explain {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* === 緊湊頁腳 === */
.arp-compact-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--color-bg-secondary);
    font-size: 13px;
    color: var(--color-text-tertiary);
    border-top: 1px solid var(--color-border-subtle);
}

.arp-compact-footer .arp-summary-icon {
    font-size: 14px;
}

/* === 深色主題支援 === */
[data-theme="dark"] .arp-summary-line {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(234, 179, 8, 0.1) 100%);
    border-bottom-color: rgba(16, 185, 129, 0.2);
}

[data-theme="dark"] .arp-success-icon {
    background: var(--brand-success-dark, #059669);
}

[data-theme="dark"] .arp-summary-text {
    color: var(--color-text-primary);
}

[data-theme="dark"] .arp-edit-btn {
    background: var(--color-secondary-subtle);
    border-color: var(--color-secondary);
}

[data-theme="dark"] .arp-collapsible {
    border-bottom-color: var(--color-border-subtle);
}

[data-theme="dark"] .arp-collapsible-header {
    color: var(--color-text-muted);
}

[data-theme="dark"] .arp-collapsible-header:hover {
    background: var(--color-secondary-muted);
}

[data-theme="dark"] .arp-collapsible-content {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .arp-params-inline .arp-param-badge {
    background: var(--color-secondary-subtle);
}

[data-theme="dark"] .arp-params-inline .arp-param-value {
    color: var(--color-text-primary);
}

[data-theme="dark"] .arp-conditions-inline .arp-condition-text {
    color: var(--color-text-primary);
}

[data-theme="dark"] .arp-compact-footer {
    background: rgba(0, 0, 0, 0.2);
    border-top-color: var(--color-border-subtle);
}

/* ⭐ v9.6.0: 子面板 Dark Theme 補充 */
[data-theme="dark"] .arp-advanced-settings > .arp-collapsible-header {
    background: var(--color-secondary-muted);
}

[data-theme="dark"] .arp-section-icon-sm {
    background: var(--color-secondary-subtle);
}

[data-theme="dark"] .ipe-select {
    background: rgba(30, 30, 30, 0.8);
    color: #E0E0E0;
    border-color: var(--color-secondary-subtle);
}

[data-theme="dark"] .ipe-input {
    background: rgba(30, 30, 30, 0.8);
    color: #E0E0E0;
    border-color: var(--color-secondary-subtle);
}

[data-theme="dark"] .ofe-checkbox-custom {
    background: rgba(40, 40, 40, 0.8);
    border-color: var(--color-secondary-subtle);
}

[data-theme="dark"] .ofe-show-checkbox:checked + .ofe-checkbox-custom {
    background: var(--color-accent);
}

[data-theme="dark"] .cle-checkbox-custom {
    background: rgba(40, 40, 40, 0.8);
    border-color: var(--color-secondary-subtle);
}

[data-theme="dark"] .cle-show-checkbox:checked + .cle-checkbox-custom {
    background: var(--color-accent);
}

[data-theme="dark"] .cle-category-header {
    color: var(--color-text-muted);
    border-bottom-color: var(--color-border-subtle);
}

[data-theme="dark"] .cle-label-text {
    color: #D4D4D4;
}

/* === 響應式設計 === */
@media (max-width: 768px) {
    .arp-summary-line {
        padding: 12px 16px;
        gap: 10px;
    }

    .arp-summary-text {
        font-size: 14px;
    }

    .arp-collapsible-header {
        padding: 10px 16px;
    }

    .arp-collapsible[data-expanded="true"] > .arp-collapsible-content {
        padding: 0 16px 12px;
    }

    .arp-compact-footer {
        padding: 10px 16px;
        font-size: 12px;
    }

    .arp-params-inline {
        flex-direction: column;
        gap: 6px;
    }
}

/* ==================== v7.5.0: Admin Debug Panel v3 ==================== */

/* 2×4 統計卡片 */
.debug-stats-2row {
    grid-template-columns: repeat(4, 1fr);
}

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

/* Feature Flags 列 */
.debug-feature-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(0, 0, 0, 0.15);
}

.debug-flag-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.debug-flag-badge.on {
    background: rgba(52, 211, 153, 0.18);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.25);
}

.debug-flag-badge.off {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Multi-pass 提示框 */
.multipass-info {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 12px;
    background: rgba(167, 139, 250, 0.12);
    border-left: 4px solid #a78bfa;
}

/* 模組化回退提示 */
.modular-fallback-info {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 12px;
    background: rgba(251, 191, 36, 0.12);
    border-left: 4px solid #fbbf24;
}

/* 反例標籤 */
.neg-example-tag {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    display: inline-block;
    margin-left: 4px;
}

/* 靜態 Few-shot 標籤 */
.static-fewshot-badge {
    background: rgba(251, 146, 60, 0.2);
    color: #fb923c;
    border: 1px solid rgba(251, 146, 60, 0.3);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    margin-left: 6px;
}

/* 推理過程區塊 */
.reasoning-block {
    border-color: rgba(167, 139, 250, 0.3) !important;
}

.reasoning-block pre {
    color: #c4b5fd;
}

/* 信心度紅色 */
.debug-stat-value.error {
    color: #f87171;
}

/* ===== v8.1.0: 模型概覽 + Admin AI Models ===== */

/* Debug Panel 模型概覽容器 */
.debug-models-overview {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.debug-model-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.debug-model-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 4px;
    font-size: 11px;
    color: #c4b5fd;
}

.debug-model-badge strong {
    color: #e0d4ff;
}

.debug-model-provider {
    color: #a78bfa;
    margin-left: 3px;
    font-size: 10px;
}

/* Admin AI Models 表格（淺色主題） */
#aiModelsContainer {
    overflow-x: auto;
}

.ai-models-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e5e5e5;
}

.ai-models-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: 0.3px;
}

.ai-models-actions {
    display: flex;
    gap: 10px;
}

.ai-models-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.ai-models-table th,
.ai-models-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    white-space: nowrap;
}

.ai-models-table th {
    font-size: 12px;
    color: #555;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f0efeb;
    position: sticky;
    top: 0;
}

.ai-models-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.03);
}

.ai-stage-name {
    font-weight: 700;
    font-size: 14px;
    color: #1a1a1a;
}

.ai-stage-provider,
.ai-stage-model {
    background: var(--color-bg-elevated);
    color: var(--color-text-primary);
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 13px;
    min-width: 100px;
    max-width: 160px;
    font-weight: 500;
    cursor: pointer;
}

.ai-stage-provider:focus,
.ai-stage-model:focus {
    border-color: #e94560;
    outline: none;
    box-shadow: 0 0 0 2px rgba(233, 69, 96, 0.2);
}

.ai-stage-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.ai-stage-badge.default {
    background: #e8f9ee;
    color: #16a34a;
}

.ai-stage-badge.custom {
    background: #fef3cd;
    color: #b45309;
}

.ai-stage-badge.online {
    background: #e8f9ee;
    color: #16a34a;
}

.ai-stage-badge.offline {
    background: #fee2e2;
    color: #dc2626;
}

.ai-stage-badge.unknown,
.ai-stage-badge.checking {
    background: #f0f0f0;
    color: #6b7280;
}

/* ==================== v27.0.0: AI 模型配置 — 分組 + 參數 ==================== */

.ai-stage-group-header td {
    background: linear-gradient(135deg, #f8f7f4 0%, #f0efeb 100%);
    font-weight: 800;
    font-size: 13px;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 10px 12px !important;
    border-bottom: 2px solid #d4d3cf;
    border-top: 1px solid #d4d3cf;
}

.ai-stage-group-header:first-child td {
    border-top: none;
}

.ai-stage-desc {
    font-size: 12px;
    color: #888;
    font-weight: 400;
    margin-top: 2px;
    white-space: normal;
    line-height: 1.4;
}

.ai-stage-param {
    background: var(--color-bg-elevated);
    color: var(--color-text-primary);
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 5px 6px;
    font-size: 13px;
    width: 76px;
    font-weight: 500;
    text-align: center;
    -moz-appearance: textfield;
}

.ai-stage-param::-webkit-outer-spin-button,
.ai-stage-param::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ai-stage-param:focus {
    border-color: #e94560;
    outline: none;
    box-shadow: 0 0 0 2px rgba(233, 69, 96, 0.2);
}

.ai-models-table th {
    font-size: 11px;
}

/* ==================== v9.2.0: AI 口語摘要打字動畫 ==================== */

.ai-summary-typing {
    font-size: 15px;
    line-height: 1.7;
    color: var(--color-text-primary);
    padding: 12px 16px;
    position: relative;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 打字中的閃爍游標 */
.ai-summary-typing::after {
    content: '▊';
    animation: arp-cursor-blink 0.8s step-end infinite;
    color: var(--color-accent);
    font-size: 14px;
    margin-left: 2px;
}

@keyframes arp-cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* 打字完成 — 游標消失，平滑過渡 */
.ai-summary-typing.typing-done::after {
    display: none;
}

.typing-done {
    font-size: 15px;
    line-height: 1.7;
    color: var(--color-text-primary);
    padding: 12px 16px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ⭐ v9.2.1: 重點文字高亮 */
.summary-highlight {
    color: var(--color-accent);
    font-weight: 600;
}

/* Dark mode */
[data-theme="dark"] .ai-summary-typing,
[data-theme="dark"] .typing-done {
    color: #E5E7EB;
}

[data-theme="dark"] .summary-highlight {
    color: #FB923C;
}

/* ==================== v10.1.0: AI 比較分析樣式 ==================== */

.ai-analysis-typing {
    font-size: 15px;
    line-height: 1.7;
    color: var(--color-text-primary);
    padding: 12px 16px;
    position: relative;
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-analysis-typing::after {
    content: '▊';
    animation: arp-cursor-blink 0.8s step-end infinite;
    color: var(--color-accent);
    font-size: 14px;
    margin-left: 2px;
}

.ai-analysis-typing.typing-done::after {
    display: none;
}

/* 分析內容容器 */
.analysis-content {
    font-size: 15px;
    line-height: 1.7;
    color: var(--color-text-primary);
    padding: 8px 0;
    white-space: normal;
    word-break: break-word;
}

.analysis-content p,
.analysis-p {
    margin: 8px 0;
}

/* 標題 */
.analysis-h2 { font-size: 18px; font-weight: 700; margin: 16px 0 8px; color: var(--color-text-primary); }
.analysis-h3 { font-size: 16px; font-weight: 700; margin: 14px 0 6px; color: var(--color-text-primary); }
.analysis-h4 { font-size: 15px; font-weight: 600; margin: 12px 0 4px; color: var(--color-accent); }
.analysis-h5 { font-size: 14px; font-weight: 600; margin: 10px 0 4px; color: var(--color-text-secondary); }

.analysis-bold {
    color: var(--color-accent);
    font-weight: 600;
}

/* 比較表格 */
.analysis-table-wrapper {
    overflow-x: auto;
    margin: 12px 0;
    border-radius: 8px;
    border: 1px solid var(--color-border, #E5E7EB);
}

.analysis-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    line-height: 1.5;
}

.analysis-table-header {
    background: var(--color-accent, #F97316);
    color: #fff;
}

.analysis-table-header .analysis-table-cell {
    font-weight: 600;
    padding: 8px 12px;
    white-space: nowrap;
    border-bottom: 2px solid var(--color-accent, #F97316);
}

.analysis-table tr:nth-child(even) {
    background: rgba(249, 115, 22, 0.04);
}

.analysis-table tr:hover {
    background: rgba(249, 115, 22, 0.08);
}

.analysis-table-cell {
    padding: 6px 12px;
    border-bottom: 1px solid var(--color-border, #E5E7EB);
    white-space: nowrap;
}

/* 列表 */
.analysis-list {
    margin: 8px 0;
    padding-left: 20px;
}

.analysis-list-item {
    margin: 4px 0;
    line-height: 1.6;
}

/* Dark mode */
[data-theme="dark"] .ai-analysis-typing,
[data-theme="dark"] .analysis-content {
    color: #E5E7EB;
}

[data-theme="dark"] .analysis-bold,
[data-theme="dark"] .analysis-h4 {
    color: #FB923C;
}

[data-theme="dark"] .analysis-table-wrapper {
    border-color: #374151;
}

[data-theme="dark"] .analysis-table-header {
    background: #9A3412;
}

[data-theme="dark"] .analysis-table-header .analysis-table-cell {
    border-bottom-color: #9A3412;
}

[data-theme="dark"] .analysis-table tr:nth-child(even) {
    background: rgba(251, 146, 60, 0.06);
}

[data-theme="dark"] .analysis-table tr:hover {
    background: rgba(251, 146, 60, 0.12);
}

[data-theme="dark"] .analysis-table-cell {
    border-bottom-color: #374151;
}

/* =============================================================================
   股票新聞搜尋結果樣式
   ============================================================================= */

/* 新聞結果容器 */
.news-results-content {
    padding: 16px 20px;
}
.news-results-content .analysis-h4 {
    border-bottom: 1px solid var(--color-border-subtle);
    padding: 12px 0 8px 12px;
    border-left: 3px solid var(--color-accent);
    margin-top: 20px;
}
.news-results-content .analysis-h4:first-child {
    margin-top: 8px;
}
.news-results-content .analysis-list-item {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    padding: 10px 14px;
    margin: 6px 0;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.news-results-content .analysis-list-item:hover {
    border-color: var(--color-accent);
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.1);
}
.news-results-content .analysis-list {
    list-style: none;
    padding-left: 0;
}

/* 來源連結 */
.analysis-link {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
}
.analysis-link:hover {
    text-decoration: underline;
}

/* 新聞搜尋 header */
.news-header-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--color-bg-elevated), var(--color-bg-tertiary));
    border-bottom: 1px solid var(--color-border-subtle);
    border-radius: 12px 12px 0 0;
}
.news-header-icon { font-size: 20px; }
.news-header-title { font-size: 15px; font-weight: 600; color: var(--color-text-primary); }
.news-header-badge {
    background: var(--color-accent-subtle);
    color: var(--color-accent);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
}

/* Dark mode */
[data-theme="dark"] .news-results-content .analysis-list-item {
    background: var(--color-bg-secondary);
    border-color: var(--color-border);
}
[data-theme="dark"] .news-results-content .analysis-list-item:hover {
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.15);
}
[data-theme="dark"] .news-header-bar {
    background: linear-gradient(135deg, var(--color-bg-secondary), var(--color-bg-tertiary));
}

/* 免責聲明 */
.news-disclaimer {
    margin-top: 16px;
    padding: 10px 14px;
    background: rgba(249, 115, 22, 0.05);
    border-radius: 8px;
    font-size: 12px;
    color: var(--color-text-tertiary);
}

/* Mobile */
@media (max-width: 480px) {
    .news-header-bar { padding: 10px 14px; }
    .news-results-content { padding: 12px 14px; }
    .news-results-content .analysis-list-item { padding: 8px 10px; }
}


