/**
 * v24.0: Financial Statement Panel 樣式
 * 使用 brand-system.css 設計變數，自動適配暗色主題
 */

/* ============================================================================
   Container
   ============================================================================ */

.fsp-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    font-size: 13px;
    overflow: hidden;
}

.fsp-active {
    overflow: hidden;
}

/* ============================================================================
   Header
   ============================================================================ */

.fsp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border-default);
    flex-shrink: 0;
    gap: 8px;
}

.fsp-header-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.fsp-badge-code {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: var(--color-accent);
    color: var(--color-text-on-accent);
    border-radius: 4px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.fsp-badge-name {
    font-weight: 600;
    color: var(--color-text-primary);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fsp-badge-market {
    font-size: 11px;
    color: var(--color-text-tertiary);
    padding: 1px 5px;
    border: 1px solid var(--color-border-default);
    border-radius: 4px;
}

.fsp-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.fsp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border: 1px solid var(--color-border-default);
    border-radius: 4px;
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s ease;
}

.fsp-btn:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-primary);
    border-color: var(--color-border-strong);
}

.fsp-btn-close:hover {
    background: var(--color-danger-subtle);
    color: var(--color-danger);
    border-color: var(--color-danger);
}

/* ============================================================================
   Tabs
   ============================================================================ */

.fsp-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--color-border-default);
    flex-shrink: 0;
    padding: 0 12px;
    overflow-x: auto;
}

.fsp-tab {
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: var(--color-text-tertiary);
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.fsp-tab:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-hover);
}

.fsp-tab-active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
    font-weight: 600;
}

/* ============================================================================
   Content Area
   ============================================================================ */

.fsp-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    min-height: 0;
}

.fsp-content::-webkit-scrollbar {
    width: 0;
    display: none;
}

/* ============================================================================
   KPI Cards
   ============================================================================ */

.fsp-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
    flex-shrink: 0;
}

.fsp-kpi-card {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    transition: box-shadow 0.15s ease;
}

.fsp-kpi-card:hover {
    box-shadow: var(--shadow-sm);
}

.fsp-kpi-label {
    font-size: 11px;
    color: var(--color-text-tertiary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.fsp-kpi-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text-primary);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.fsp-kpi-change {
    font-size: 11px;
    font-weight: 600;
}

.fsp-kpi-spark {
    margin-top: 2px;
    line-height: 0;
}

/* ============================================================================
   Statement Table
   ============================================================================ */

.fsp-table-wrapper {
    flex: 1;
    min-height: 120px;
    overflow: auto;
    border: 1px solid var(--color-border-default);
    border-radius: 6px;
    margin-bottom: 12px;
}

.fsp-table-wrapper::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.fsp-table-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.fsp-table-wrapper::-webkit-scrollbar-thumb {
    background: var(--color-scrollbar-thumb);
    border-radius: 4px;
}

.fsp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    table-layout: auto;
}

.fsp-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.fsp-table th {
    padding: 7px 10px;
    text-align: right;
    font-weight: 600;
    font-size: 11.5px;
    color: var(--color-text-secondary);
    background: var(--color-bg-tertiary);
    border-bottom: 1px solid var(--color-border-default);
    white-space: nowrap;
}

.fsp-th-indicator {
    text-align: left !important;
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--color-bg-tertiary) !important;
    min-width: 90px;
}

.fsp-th-trend {
    position: sticky;
    right: 0;
    z-index: 3;
    background: var(--color-bg-tertiary) !important;
    text-align: center !important;
    min-width: 70px;
}

.fsp-th-latest {
    color: var(--color-accent);
}

.fsp-table td {
    padding: 6px 10px;
    text-align: right;
    border-bottom: 1px solid var(--color-border-subtle);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    min-width: 58px;
}

.fsp-table tbody tr:hover {
    background: var(--color-bg-hover);
}

.fsp-td-indicator {
    text-align: left !important;
    font-weight: 500;
    color: var(--color-text-primary);
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--color-bg-secondary);
}

.fsp-table tbody tr:hover .fsp-td-indicator {
    background: var(--color-bg-hover);
}

.fsp-td-latest {
    background: var(--color-accent-muted) !important;
    font-weight: 600;
}

.fsp-td-trend {
    position: sticky;
    right: 0;
    z-index: 1;
    background: var(--color-bg-secondary);
    text-align: center !important;
}

.fsp-table tbody tr:hover .fsp-td-trend {
    background: var(--color-bg-hover);
}

/* ============================================================================
   Colors — positive / negative
   ============================================================================ */

.fsp-positive {
    color: var(--color-market-up, #DC2626);
}

.fsp-negative {
    color: var(--color-market-down, #16A34A);
}

/* ============================================================================
   Audit Info Bar
   ============================================================================ */

.fsp-audit-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    font-size: 12px;
    color: var(--color-text-secondary);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.fsp-audit-icon {
    font-size: 14px;
}

.fsp-audit-sep {
    color: var(--color-border-strong);
}

/* ============================================================================
   Empty / Error States
   ============================================================================ */

.fsp-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    gap: 8px;
    height: 100%;
}

.fsp-empty-icon {
    font-size: 32px;
    opacity: 0.6;
}

.fsp-empty-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.fsp-empty-desc {
    font-size: 13px;
    color: var(--color-text-tertiary);
    max-width: 300px;
}

.fsp-empty {
    text-align: center;
    padding: 24px;
    color: var(--color-text-tertiary);
}

/* ============================================================================
   Skeleton Loading
   ============================================================================ */

.fsp-skeleton {
    background: linear-gradient(
        90deg,
        var(--color-bg-tertiary) 25%,
        var(--color-bg-hover) 50%,
        var(--color-bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: fsp-shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes fsp-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.fsp-skeleton-badge {
    width: 200px;
    height: 28px;
}

.fsp-skeleton-actions {
    width: 80px;
    height: 28px;
    margin-left: auto;
}

.fsp-skeleton-tab {
    width: 70px;
    height: 30px;
}

.fsp-skeleton-kpi {
    height: 80px;
    border-radius: 8px;
}

.fsp-skeleton-row {
    height: 28px;
    margin-bottom: 6px;
}

.fsp-loading .fsp-header,
.fsp-loading .fsp-tabs,
.fsp-loading .fsp-kpi-grid,
.fsp-loading .fsp-table-skeleton {
    padding: 10px 12px;
    display: flex;
    gap: 8px;
}

.fsp-loading .fsp-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.fsp-loading .fsp-table-skeleton {
    flex-direction: column;
}

/* ============================================================================
   Sparkline
   ============================================================================ */

.fsp-sparkline {
    display: inline-block;
    vertical-align: middle;
}

/* ============================================================================
   Responsive (2x2 KPI on narrow panels)
   ============================================================================ */

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

/* ============================================================================
   v24.1: Interactive Rows — Metric Trend Chart
   ============================================================================ */

.fsp-table tbody tr[data-key] {
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.fsp-table tbody tr[data-key]:hover {
    background: var(--color-bg-hover);
}

.fsp-row-selected {
    background: var(--color-accent-muted) !important;
    box-shadow: inset 3px 0 0 var(--color-accent);
}

.fsp-row-selected .fsp-td-indicator {
    color: var(--color-accent) !important;
    font-weight: 700 !important;
    background: var(--color-accent-muted) !important;
}

.fsp-row-selected .fsp-td-trend {
    background: var(--color-accent-muted) !important;
}

.fsp-table tbody tr[data-key]:hover .fsp-td-indicator,
.fsp-table tbody tr[data-key]:hover .fsp-td-trend {
    background: var(--color-bg-hover) !important;
}

.fsp-row-selected:hover .fsp-td-indicator,
.fsp-row-selected:hover .fsp-td-trend {
    background: var(--color-accent-muted) !important;
}

/* Period Expand/Collapse Toggle */
.fsp-period-toggle {
    display: block;
    width: 100%;
    padding: 6px 0;
    margin-top: 2px;
    background: none;
    border: none;
    border-top: 1px dashed var(--color-border-default);
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s;
    text-align: center;
}

.fsp-period-toggle:hover {
    color: var(--color-accent);
}

/* KPI Card Interactive */
.fsp-kpi-card[data-key] {
    cursor: pointer;
    transition: all 0.15s ease;
}

.fsp-kpi-card[data-key]:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.fsp-kpi-card[data-key]:active {
    transform: scale(0.98);
}

.fsp-kpi-selected {
    border-color: var(--color-accent) !important;
    box-shadow: 0 0 0 2px var(--color-accent-muted), var(--shadow-sm) !important;
}

/* Back to K-line Button */
.fsp-back-kline-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border: 1px solid var(--color-border-default);
    border-radius: 4px;
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
    font-size: 11.5px;
    cursor: pointer;
    transition: all 0.15s ease;
    animation: fsp-header-fadein 0.2s ease;
    white-space: nowrap;
}

.fsp-back-kline-btn:hover {
    background: var(--color-bg-hover);
    color: var(--color-accent);
    border-color: var(--color-accent);
}

.fsp-metric-stock-info {
    font-size: 12px;
    color: var(--color-text-tertiary);
    margin-right: 8px;
    white-space: nowrap;
}

.fsp-metric-icon {
    font-size: 14px;
    margin-right: 2px;
}

.fsp-metric-unit {
    font-size: 12px !important;
    color: var(--color-text-tertiary) !important;
    font-weight: 400 !important;
}

/* Metric Chart Empty State */
.fsp-metric-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 8px;
    color: var(--color-text-tertiary);
}

/* Header transition animation */
@keyframes fsp-header-fadein {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   v25.0: Comparison Mode
   ============================================================================ */

/* Comparison Header */
.fsp-compare-header .fsp-header-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.fsp-compare-industry-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fsp-compare-stock-tags {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.fsp-compare-stock-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border: 2px solid;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-primary);
    background: var(--color-bg-tertiary);
    position: relative;
}

.fsp-compare-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.fsp-compare-vs-text {
    font-size: 11px;
    color: var(--color-text-tertiary);
    font-weight: 400;
}

/* Swap Button (Industry Mode) */
.fsp-swap-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11px;
    padding: 0 2px;
    opacity: 0.5;
    transition: opacity 0.15s ease;
}

.fsp-swap-btn:hover {
    opacity: 1;
}

.fsp-swap-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-default);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    max-height: 200px;
    overflow-y: auto;
    min-width: 160px;
    margin-top: 4px;
}

.fsp-swap-option {
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    color: var(--color-text-primary);
    transition: background 0.1s ease;
}

.fsp-swap-option:hover {
    background: var(--color-bg-hover);
}

/* Comparison Table */
.fsp-compare-table .fsp-th-stock {
    text-align: center !important;
    padding: 6px 8px;
    min-width: 80px;
}

.fsp-compare-code {
    font-weight: 700;
    font-size: 12px;
    display: block;
}

.fsp-compare-name {
    font-size: 10px;
    color: var(--color-text-tertiary);
    font-weight: 400;
    display: block;
}

.fsp-td-stock-0,
.fsp-td-stock-1,
.fsp-td-stock-2,
.fsp-td-stock-3,
.fsp-td-stock-4 {
    text-align: center !important;
}

.fsp-th-diff {
    text-align: center !important;
    min-width: 65px;
    font-size: 11px;
    color: var(--color-text-tertiary);
}

.fsp-td-diff {
    text-align: center !important;
    font-weight: 600;
    font-size: 11.5px;
}

/* Comparison KPI Section */
.fsp-compare-kpi-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 14px;
    flex-shrink: 0;
}

.fsp-compare-kpi-card {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.fsp-compare-kpi-card:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.fsp-compare-kpi-card.fsp-kpi-selected {
    border-color: var(--color-accent) !important;
    box-shadow: 0 0 0 2px var(--color-accent-muted), var(--shadow-sm) !important;
}

.fsp-compare-kpi-title {
    font-size: 11px;
    color: var(--color-text-tertiary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

.fsp-compare-kpi-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
}

.fsp-compare-kpi-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.fsp-compare-kpi-code {
    font-size: 11px;
    color: var(--color-text-tertiary);
    min-width: 36px;
}

.fsp-compare-kpi-val {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text-primary);
    flex: 1;
}

.fsp-compare-kpi-qoq {
    font-size: 10.5px;
    font-weight: 600;
}

/* ============================================================================
   v25.2: Audit Tab — Opinion Badges, Nature Tags, History Table
   ============================================================================ */

/* 意見類型膠囊 */
.fsp-audit-opinion-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.fsp-opinion-clean {
    background: rgba(22, 163, 74, 0.12);
    color: var(--color-success);
}

.fsp-opinion-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #D97706;
}

.fsp-opinion-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--color-danger);
}

.fsp-opinion-critical {
    background: rgba(55, 48, 48, 0.15);
    color: var(--color-text-secondary);
}

.fsp-opinion-unknown {
    background: var(--color-bg-tertiary);
    color: var(--color-text-tertiary);
}

/* 核閱/查核標籤 */
.fsp-audit-nature-tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 600;
    white-space: nowrap;
}

.fsp-nature-audit {
    background: rgba(59, 130, 246, 0.12);
    color: #2563EB;
}

.fsp-nature-review {
    background: rgba(107, 114, 128, 0.12);
    color: var(--color-text-secondary);
}

/* Audit 歷史表格 */
.fsp-audit-history-table {
    overflow-x: auto;
}

.fsp-audit-history-table .fsp-table td {
    padding: 6px 10px;
    font-size: 12px;
    vertical-align: middle;
}

.fsp-audit-history-table .fsp-table th {
    padding: 6px 10px;
    font-size: 11px;
    text-align: left;
}

/* 事務所變更提示 */
.fsp-audit-firm-change {
    position: relative;
}

.fsp-audit-firm-change-icon {
    cursor: help;
}

/* 比較模式 audit 期別備註 */
.fsp-audit-period-note {
    margin-top: 8px;
    font-size: 11px;
    color: var(--color-text-tertiary);
    text-align: right;
    padding-right: 10px;
}

/* Narrow panel: horizontal scroll — handled by .fsp-table-wrapper overflow: auto */

/* ============================================================================
   v26.0: Forecast Styles
   ============================================================================ */

/* Forecast column header */
.fsp-th-forecast {
    border-left: 2px dashed #3B82F6 !important;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 3px,
        rgba(59, 130, 246, 0.04) 3px,
        rgba(59, 130, 246, 0.04) 6px
    );
    position: relative;
}

/* AI badge in header */
.fsp-forecast-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    background: #3B82F6;
    color: white;
    border-radius: 4px;
    padding: 0 3px;
    margin-left: 3px;
    vertical-align: super;
    line-height: 1.4;
    letter-spacing: 0.5px;
}

/* Forecast cell */
.fsp-td-forecast {
    background: rgba(59, 130, 246, 0.03);
    font-style: italic;
    border-left: 2px dashed rgba(59, 130, 246, 0.3);
    position: relative;
}

/* Confidence dot */
.fsp-confidence-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-left: 3px;
    vertical-align: middle;
}

.fsp-confidence-high .fsp-confidence-dot { background: #10B981; }
.fsp-confidence-medium .fsp-confidence-dot { background: #F59E0B; }
.fsp-confidence-low .fsp-confidence-dot { background: #EF4444; }

/* Header forecast controls */
.fsp-forecast-mode-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(59, 130, 246, 0.1);
    color: #3B82F6;
    border-radius: 4px;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.fsp-btn-forecast-toggle {
    padding: 2px 8px;
    font-size: 11px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.fsp-btn-forecast-toggle:hover {
    background: rgba(59, 130, 246, 0.15);
}

.fsp-forecast-loading-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    font-size: 10px;
    color: #3B82F6;
    animation: fsp-pulse 1.5s ease-in-out infinite;
}

@keyframes fsp-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* KPI forecast arrow */
.fsp-kpi-forecast-arrow {
    font-size: 11px;
    color: #3B82F6;
    font-style: italic;
    white-space: nowrap;
}

/* Forecast analysis section */
.fsp-forecast-analysis {
    margin: 8px 10px;
    padding: 10px 12px;
    background: rgba(59, 130, 246, 0.03);
    border: 1px solid rgba(59, 130, 246, 0.12);
    border-radius: 6px;
    font-size: 12px;
}

.fsp-forecast-analysis-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.fsp-forecast-analysis-title {
    font-weight: 600;
    font-size: 13px;
}

.fsp-forecast-outlook {
    font-weight: 600;
    font-size: 12px;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.04);
}

.fsp-forecast-assumptions {
    margin-bottom: 6px;
    line-height: 1.6;
}

.fsp-forecast-assumption-chip {
    display: inline-block;
    padding: 1px 6px;
    margin: 2px 3px;
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.12);
    border-radius: 4px;
    font-size: 11px;
}

.fsp-forecast-reasoning-details {
    margin-top: 6px;
}

.fsp-forecast-reasoning-details summary {
    cursor: pointer;
    color: #3B82F6;
    font-size: 11px;
    user-select: none;
}

.fsp-forecast-reasoning {
    margin-top: 6px;
    padding: 8px;
    background: var(--color-bg-primary);
    border-radius: 4px;
    line-height: 1.5;
    max-height: 200px;
    overflow-y: auto;
    font-size: 11px;
    color: var(--color-text-secondary);
}

.fsp-forecast-disclaimer {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid var(--color-border-default);
    font-size: 10px;
    color: var(--color-text-tertiary);
    text-align: center;
}

/* ============================================================================
   Sprint 3: Tab fade-in transition
   ============================================================================ */
.fsp-content {
    animation: fsp-fade-in 0.2s ease-out;
}

@keyframes fsp-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   Sprint 3: Skeleton shimmer for loading states
   ============================================================================ */
.fsp-empty {
    position: relative;
    overflow: hidden;
}

.fsp-empty::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; right: -100%; bottom: 0;
    background: linear-gradient(90deg, transparent 30%, var(--color-accent-muted) 50%, transparent 70%);
    animation: fsp-shimmer-slide 1.8s ease-in-out infinite;
}

@keyframes fsp-shimmer-slide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ============================================================================
   Sprint 3: Chart fade-in when metric changes
   ============================================================================ */
#fsp-metric-chart {
    animation: fsp-fade-in 0.25s ease-out;
}

/* ============================================================================
   v27.0: Financial Browse Mode — FSP Navigation Bar
   ============================================================================ */

.fsp-browse-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 4px;
}

.fsp-btn-back {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--color-border-default);
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.fsp-btn-back:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-primary);
}

.fsp-btn-nav {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--color-border-default);
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.15s ease;
    padding: 0;
}

.fsp-btn-nav:hover:not(:disabled) {
    background: var(--color-bg-hover);
    color: var(--color-text-primary);
}

.fsp-btn-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ============================================================================
   v27.0: Financial Browse Mode — Inline Preview Row
   ============================================================================ */

.fbm-inline-preview-row td {
    padding: 0 !important;
    border-top: none !important;
}

.fbm-preview-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out, padding 0.25s ease-out;
    padding: 0 16px;
    background: var(--color-bg-secondary, #f9fafb);
    border-top: 1px solid var(--color-border-subtle, #e5e7eb);
}

[data-theme="dark"] .fbm-preview-container {
    background: var(--color-bg-tertiary, #1e1e2e);
}

.fbm-preview-container.expanded {
    max-height: 140px;
    padding: 12px 16px;
}

.fbm-preview-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.fbm-preview-kpi {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 2px 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--color-bg-page, #ffffff);
    border: 1px solid var(--color-border-subtle, #e5e7eb);
    cursor: pointer;
    transition: all 0.15s ease;
}

[data-theme="dark"] .fbm-preview-kpi {
    background: var(--color-bg-secondary, #262640);
    border-color: var(--color-border-default, #333);
}

.fbm-preview-kpi:hover {
    border-color: var(--color-accent, #3B82F6);
    box-shadow: 0 0 0 1px var(--color-accent, #3B82F6);
}

.fbm-preview-kpi-label {
    font-size: 10px;
    color: var(--color-text-tertiary);
    font-weight: 500;
}

.fbm-preview-kpi-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text-primary);
    font-variant-numeric: tabular-nums;
}

.fbm-preview-kpi-change {
    font-size: 11px;
    font-weight: 500;
}

.fbm-preview-kpi-change.fbm-positive { color: var(--color-success, #10B981); }
.fbm-preview-kpi-change.fbm-negative { color: var(--color-danger, #EF4444); }

.fbm-preview-kpi-label  { grid-column: 1; grid-row: 1; }
.fbm-preview-kpi-value  { grid-column: 1; grid-row: 2; }
.fbm-preview-kpi-change { grid-column: 1; grid-row: 3; }
.fbm-preview-kpi-spark  { grid-column: 2; grid-row: 1 / -1; align-self: center; margin-top: 0; }

.fbm-preview-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    justify-content: flex-end;
}

.fbm-preview-btn {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--color-border-default);
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.fbm-preview-btn:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-primary);
}

.fbm-preview-btn.fbm-preview-detail {
    background: var(--color-accent, #3B82F6);
    color: #fff;
    border-color: var(--color-accent, #3B82F6);
}

.fbm-preview-btn.fbm-preview-detail:hover {
    opacity: 0.9;
}

.fbm-preview-btn.pinned {
    background: var(--color-warning-subtle, #FEF3C7);
    border-color: var(--color-warning, #F59E0B);
    color: var(--color-warning, #F59E0B);
}

.fbm-preview-loading,
.fbm-preview-empty {
    padding: 16px;
    text-align: center;
    font-size: 12px;
    color: var(--color-text-tertiary);
}

/* ============================================================================
   v27.0: Financial Browse Mode — Pin Compare Bar
   ============================================================================ */

.fbm-pin-compare-bar {
    position: sticky;
    bottom: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    backdrop-filter: blur(8px);
    background: var(--color-bg-secondary, rgba(249, 250, 251, 0.92));
    border-top: 1px solid var(--color-border-default);
}

[data-theme="dark"] .fbm-pin-compare-bar {
    background: rgba(30, 30, 46, 0.92);
}

.fbm-pin-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    flex: 1;
}

.fbm-pin-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--color-accent-subtle, #DBEAFE);
    color: var(--color-accent, #3B82F6);
    font-size: 11px;
    font-weight: 500;
}

[data-theme="dark"] .fbm-pin-tag {
    background: rgba(59, 130, 246, 0.2);
}

.fbm-pin-tag-remove {
    cursor: pointer;
    opacity: 0.6;
    font-size: 10px;
}

.fbm-pin-tag-remove:hover {
    opacity: 1;
}

.fbm-pin-compare-btn {
    font-size: 12px;
    padding: 5px 14px;
    border-radius: 6px;
    border: none;
    background: var(--color-accent, #3B82F6);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: opacity 0.15s;
}

.fbm-pin-compare-btn:hover {
    opacity: 0.9;
}

.fbm-pin-clear-btn {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--color-border-default);
    background: transparent;
    color: var(--color-text-tertiary);
    cursor: pointer;
    white-space: nowrap;
}

.fbm-pin-clear-btn:hover {
    color: var(--color-danger);
    border-color: var(--color-danger);
}
