/* 銷售分析設定中台 + 業績戰情室共用樣式 */
.sa-config-shell { max-width: 100%; }
.sa-config-tabs { display: flex; gap: 0.5rem; border-bottom: 1px solid #e2e8f0; padding-bottom: 0.5rem; margin-bottom: 1rem; }
.sa-config-tab { padding: 0.45rem 1rem; font-size: 13px; border-radius: 0.5rem 0.5rem 0 0; border: 1px solid transparent; background: #f1f5f9; cursor: pointer; }
.sa-config-tab.active { background: #4f46e5; color: #fff; border-color: #4338ca; }

.sa-target-layout { display: grid; grid-template-columns: minmax(200px, 25%) 1fr; gap: 1rem; min-height: 420px; }
@media (max-width: 900px) { .sa-target-layout { grid-template-columns: 1fr; } }
.sa-year-list { border: 1px solid #e2e8f0; border-radius: 0.75rem; padding: 0.75rem; background: #fafafa; max-height: 520px; overflow-y: auto; }
.sa-year-card { display: block; width: 100%; text-align: left; border: 1px solid #e2e8f0; border-radius: 0.5rem; padding: 0.65rem 0.75rem; margin-bottom: 0.5rem; background: #fff; cursor: pointer; font-size: 13px; }
.sa-year-card.active { border-color: #6366f1; box-shadow: 0 0 0 2px rgba(99,102,241,0.2); }
.sa-year-card .amt { font-weight: 700; color: #1e293b; margin-top: 0.25rem; }
.sa-target-detail { border: 1px solid #e2e8f0; border-radius: 0.75rem; padding: 1rem; background: #fff; }
.sa-target-annual-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; padding: 12px 14px; background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%); border-radius: 0.65rem; border: 1px solid #e0e7ff; }
.sa-target-annual-row label { font-size: 13px; font-weight: 600; color: #334155; margin: 0; }
.sa-target-annual-row input { margin-left: 8px; padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 0.4rem; font-size: 14px; font-weight: 700; min-width: 11rem; }
.sa-weight-workspace { display: grid; gap: 12px; }
@media (max-width: 960px) { .sa-weight-workspace { grid-template-columns: 1fr; } }
.sa-weight-q-block { border: 1px solid #e2e8f0; border-radius: 0.65rem; padding: 10px 12px; background: #fafafa; margin-bottom: 10px; }
.sa-weight-q-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px dashed #e2e8f0; }
.sa-weight-q-head .q-label { font-weight: 700; font-size: 13px; color: #4338ca; min-width: 2rem; }
.sa-weight-q-head input { width: 4.5rem; padding: 4px 6px; border: 1px solid #cbd5e1; border-radius: 0.35rem; font-size: 12px; }
.sa-weight-q-meta { font-size: 11px; color: #64748b; }
.sa-weight-q-meta strong { color: #0f172a; font-weight: 600; }
.sa-weight-months { display: grid; gap: 8px; }
@media (max-width: 700px) { .sa-weight-months { grid-template-columns: 1fr; } }
.sa-weight-m-cell { background: #fff; border: 1px solid #e2e8f0; border-radius: 0.45rem; padding: 8px; font-size: 11px; display: flex; align-items: center; gap: 1em; }
.sa-weight-m-cell .m-label { font-weight: 600; color: #475569; margin-bottom: 4px; }
.sa-weight-m-cell input { padding: 3px 6px; border: 1px solid #cbd5e1; border-radius: 0.3rem; font-size: 12px; margin: 4px 0; }
.sa-weight-m-pct { color: #6366f1; font-size: 10px; }
.sa-weight-m-quota { color: #334155; font-size: 10px; font-weight: 600; margin-top: 2px; }
.sa-target-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 0.75rem; }
@media (max-width: 1100px) { .sa-target-split { grid-template-columns: 1fr; } }

.sa-pivot-workspace { display: grid; grid-template-columns: 220px 1fr; gap: 1rem; }
@media (max-width: 1100px) { .sa-pivot-workspace { grid-template-columns: 1fr; } }
.sa-field-pool { border: 1px solid #e2e8f0; border-radius: 0.75rem; padding: 0.75rem; background: #f8fafc; max-height: 560px; overflow-y: auto; }
.sa-field-chip { display: inline-block; padding: 0.25rem 0.5rem; margin: 0.2rem; font-size: 11px; border-radius: 9999px; background: #e0e7ff; color: #3730a3; cursor: grab; user-select: none; }
.sa-field-chip.metric { background: #dcfce7; color: #166534; }
.sa-field-chip.time { background: #fef3c7; color: #92400e; }
.sa-pivot-matrix { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; gap: 0.75rem; }
.sa-pivot-zone { border: 2px dashed #cbd5e1; border-radius: 0.75rem; padding: 0.65rem; min-height: 120px; background: #fff; }
.sa-pivot-zone.drag-over { border-color: #6366f1; background: #eef2ff; }
.sa-pivot-zone h5 { font-size: 12px; font-weight: 600; color: #64748b; margin: 0 0 0.5rem; }
.sa-pivot-field-card { display: flex; align-items: center; justify-content: space-between; gap: 0.35rem; padding: 0.35rem 0.5rem; margin-bottom: 0.35rem; border: 1px solid #e2e8f0; border-radius: 0.5rem; background: #f8fafc; font-size: 12px; }
.sa-pivot-field-card .acts { display: flex; gap: 0.15rem; flex-shrink: 0; }
.sa-pivot-field-card .acts button { border: none; background: #e2e8f0; border-radius: 0.25rem; padding: 0.1rem 0.35rem; font-size: 11px; cursor: pointer; }
.sa-pivot-field-card .acts button:hover { background: #cbd5e1; }

.sa-drawer-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,0.35); z-index: 1200; display: none; }
.sa-drawer-backdrop.open { display: block; }
.sa-drawer { position: fixed; top: 0; right: 0; width: min(420px, 92vw); height: 100vh; background: #fff; z-index: 1201; box-shadow: -4px 0 24px rgba(0,0,0,0.12); transform: translateX(100%); transition: transform 0.25s ease; overflow-y: auto; padding: 1rem; }
.sa-drawer.open { transform: translateX(0); }

.sa-modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,0.45); z-index: 1180; display: none; }
.sa-modal-backdrop.open { display: block; }
.sa-modal { position: fixed; z-index: 1181; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.96); width: min(960px, 94vw); max-height: 90vh; background: #fff; border-radius: 0.75rem; box-shadow: 0 24px 48px rgba(15,23,42,0.18); display: none; flex-direction: column; opacity: 0; transition: opacity 0.2s ease, transform 0.2s ease; }
.sa-modal.open { display: flex; opacity: 1; transform: translate(-50%, -50%) scale(1); }
.sa-modal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 14px 18px; border-bottom: 1px solid #e2e8f0; flex-shrink: 0; }
.sa-modal-header h4 { margin: 0; font-size: 16px; color: #0f172a; }
.sa-modal-subtitle { font-size: 12px; color: #64748b; margin-top: 4px; }
.sa-modal-body { padding: 14px 18px; overflow-y: auto; flex: 1; }
.sa-modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid #e2e8f0; flex-shrink: 0; background: #f8fafc; border-radius: 0 0 0.75rem 0.75rem; }
.sa-report-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.sa-report-form-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; align-items: end; }
.sa-report-form-row .field label { display: block; font-size: 12px; color: #64748b; margin-bottom: 4px; }
.sa-report-form-row .field input, .sa-report-form-row .field select { min-width: 12rem; }
tr.sa-row-editing td { background: #eef2ff; }

/* 工具端 Excel 式篩選 */
.sa-excel-filter { position: relative; min-width: 10rem; }
.sa-excel-filter-btn { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; min-width: 10rem; padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 0.5rem; background: #fff; font-size: 12px; color: #334155; cursor: pointer; }
.sa-excel-filter-btn:hover { border-color: #94a3b8; background: #f8fafc; }
.sa-excel-filter-btn .lbl { font-weight: 600; color: #475569; }
.sa-excel-filter-btn .val { color: #64748b; font-size: 11px; max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-excel-filter-panel { position: absolute; top: calc(100% + 4px); left: 0; z-index: 40; width: min(280px, 88vw); max-height: 320px; background: #fff; border: 1px solid #e2e8f0; border-radius: 0.5rem; box-shadow: 0 12px 28px rgba(15,23,42,0.12); display: flex; flex-direction: column; }
.sa-excel-filter-panel.hidden { display: none; }
.sa-excel-filter-q { margin: 8px; padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 0.35rem; font-size: 12px; }
.sa-excel-filter-actions { display: flex; gap: 6px; padding: 0 8px 6px; font-size: 11px; }
.sa-excel-filter-actions button { border: none; background: #eef2ff; color: #4338ca; padding: 3px 8px; border-radius: 0.3rem; cursor: pointer; }
.sa-excel-filter-list { overflow-y: auto; padding: 0 8px 8px; flex: 1; }
.sa-excel-filter-list label { display: flex; align-items: center; gap: 6px; padding: 4px 2px; font-size: 12px; color: #334155; cursor: pointer; }
.sa-excel-filter-list label:hover { background: #f8fafc; }
.sa-excel-filter-foot { padding: 6px 8px; border-top: 1px solid #e2e8f0; text-align: right; }
.sa-excel-filter-foot button { font-size: 11px; padding: 4px 10px; border-radius: 0.35rem; border: none; background: #4f46e5; color: #fff; cursor: pointer; }

/* 管理端抽屜內多選篩選 */
.sa-admin-filter-picker { margin: 8px 0; }
.sa-admin-filter-q { width: 100%; padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 0.35rem; font-size: 12px; margin-bottom: 6px; }
.sa-admin-filter-list { max-height: 220px; overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 0.4rem; padding: 6px 8px; background: #fafafa; }
.sa-admin-filter-list label { display: flex; align-items: center; gap: 6px; padding: 4px 2px; font-size: 12px; cursor: pointer; }
.sa-admin-filter-list label:hover { background: #f1f5f9; }
.sa-admin-filter-actions { display: flex; gap: 6px; margin: 6px 0; font-size: 11px; }
.sa-admin-filter-actions button { border: none; background: #eef2ff; color: #4338ca; padding: 3px 8px; border-radius: 0.3rem; cursor: pointer; }

/* 工具端戰情室 */
.sa-app-tabs { display: flex; gap: 0.35rem; overflow-x: auto; border-bottom: 1px solid #e2e8f0; padding-bottom: 0.5rem; }
.sa-app-tab { flex-shrink: 0; padding: 0.4rem 0.85rem; font-size: 0.75rem; border-radius: 0.5rem; background: #f1f5f9; color: #475569; }
.sa-app-tab.active { background: #4f46e5; color: #fff; }
.sa-group-toggle { display: flex; flex-wrap: wrap; gap: 0.35rem; font-size: 0.7rem; }
.sa-group-toggle label { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.25rem 0.5rem; border: 1px solid #e2e8f0; border-radius: 9999px; cursor: pointer; }
.sa-group-toggle input:checked + span { font-weight: 600; color: #4338ca; }
.sa-q-current { background: rgba(251, 191, 36, 0.25) !important; }
.sa-q-past-down { background: rgba(254, 226, 226, 0.45) !important; }
.sa-warroom-mobile { display: none; }
@media (max-width: 1023px) {
    .sa-warroom-desktop { display: none !important; }
    .sa-warroom-mobile { display: block; }
}
.sa-detail-drawer { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.sa-detail-drawer.open { pointer-events: auto; }
.sa-detail-mask { position: absolute; inset: 0; background: rgba(15,23,42,0.4); opacity: 0; transition: opacity 0.2s; }
.sa-detail-drawer.open .sa-detail-mask { opacity: 1; }
.sa-detail-sheet { position: absolute; bottom: 0; left: 0; right: 0; max-height: 85vh; background: rgba(255,255,255,0.95); backdrop-filter: blur(12px); border-radius: 1rem 1rem 0 0; transform: translateY(100%); transition: transform 0.25s; overflow-y: auto; padding: 1rem; }
@media (min-width: 1024px) {
    .sa-detail-sheet { top: 0; bottom: 0; left: auto; right: 0; width: 50%; max-height: none; border-radius: 0; transform: translateX(100%); }
    .sa-detail-drawer.open .sa-detail-sheet { transform: translateX(0); }
}
.sa-detail-drawer.open .sa-detail-sheet { transform: translateY(0); }
@media (min-width: 1024px) {
    .sa-detail-drawer.open .sa-detail-sheet { transform: translateX(0); }
}

/* 客戶風險評估看板 */
.sa-risk-filter label { display: block; font-size: 0.78rem; color: #64748b; }
.sa-risk-filter select { margin-top: 0.25rem; width: 100%; border: 1px solid #e2e8f0; border-radius: 0.45rem; padding: 0.4rem 0.5rem; font-size: 0.82rem; background: #fff; }
.sa-risk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 0.85rem; }
@media (min-width: 1280px) {
    .sa-risk-grid { grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr)); gap: 1rem; }
}
.sa-risk-card {
    border: 1px solid #e2e8f0; border-radius: 0.85rem; background: #fff; padding: 1rem 1.05rem;
    cursor: pointer; transition: box-shadow 0.15s, border-color 0.15s;
}
.sa-risk-card:hover { border-color: #a5b4fc; box-shadow: 0 4px 14px rgba(79, 70, 229, 0.08); }
.sa-risk-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.65rem; }
.sa-risk-card-head-main { min-width: 0; flex: 1; }
.sa-risk-card-head-meta { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; padding-top: 0.05rem; }
.sa-risk-dormant { font-size: 0.88rem; font-weight: 700; color: #334155; white-space: nowrap; line-height: 1.2; }
.sa-risk-dormant-none { color: #94a3b8; font-weight: 600; font-size: 0.78rem; }
.sa-risk-new-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.15rem; height: 1.15rem; padding: 0 0.25rem;
    border-radius: 0.3rem; background: #dbeafe; color: #1d4ed8;
    font-size: 0.68rem; font-weight: 800; line-height: 1; flex-shrink: 0;
}
.sa-srd-light {
    width: 0.72rem; height: 0.72rem; border-radius: 9999px; flex-shrink: 0;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(15, 23, 42, 0.12);
}
.sa-srd-light-red { background: #ef4444; }
.sa-srd-light-orange { background: #f97316; }
.sa-srd-light-yellow { background: #eab308; }
.sa-srd-light-green { background: #22c55e; }
.sa-srd-light-gray { background: #94a3b8; }
.sa-risk-card-title { font-size: 1rem; font-weight: 700; color: #1e293b; line-height: 1.35; }
.sa-risk-card-sub { font-size: 0.78rem; color: #94a3b8; margin-top: 0.15rem; }
.sa-risk-bars { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.55rem; }
.sa-risk-bar-row { display: grid; grid-template-columns: 3.5rem minmax(3.25rem, auto) 1fr; gap: 0.35rem 0.45rem; align-items: center; }
.sa-risk-bar-label { font-size: 0.76rem; color: #475569; line-height: 1.25; font-weight: 500; }
.sa-risk-bar-val { font-size: 0.72rem; font-weight: 700; text-align: right; white-space: nowrap; line-height: 1.2; }
.sa-risk-bar-val-muted { color: #94a3b8; font-weight: 600; }
.sa-risk-bar-val-below_low { color: #dc2626; }
.sa-risk-bar-val-low_to_avg { color: #ea580c; }
.sa-risk-bar-val-avg_to_high { color: #ca8a04; }
.sa-risk-bar-val-above_high { color: #16a34a; }
.sa-risk-bar-val-no_data { color: #94a3b8; }
.sa-risk-bar-track {
    position: relative; height: 0.58rem; border-radius: 9999px;
    background: linear-gradient(90deg, #fecaca 0%, #fef08a 48%, #bbf7d0 100%);
}
.sa-risk-bar-track.no-data { background: #e2e8f0; }
.sa-risk-bar-track.flat-bench { background: #bfdbfe; }
.sa-risk-bar-marker {
    position: absolute; top: 50%; width: 0.72rem; height: 0.72rem; border-radius: 9999px;
    border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.2);
    transform: translate(-50%, -50%);
}
.sa-risk-bar-marker-below_low { background: #dc2626; }
.sa-risk-bar-marker-low_to_avg { background: #ea580c; }
.sa-risk-bar-marker-avg_to_high { background: #ca8a04; }
.sa-risk-bar-marker-above_high { background: #16a34a; }
.sa-risk-bar-marker-no_data { background: #64748b; }
.sa-risk-zone-tag {
    display: inline-block; padding: 0.12rem 0.45rem; border-radius: 9999px; font-size: 0.72rem; font-weight: 600;
}
.sa-risk-zone-below_low { background: #fca5a5; color: #7f1d1d; }
.sa-risk-zone-low_to_avg { background: #fdba74; color: #7c2d12; }
.sa-risk-zone-avg_to_high { background: #fde047; color: #713f12; }
.sa-risk-zone-above_high { background: #86efac; color: #14532d; }
.sa-risk-zone-no_data { background: #cbd5e1; color: #475569; }
.sa-risk-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.sa-risk-summary-item { border: 1px solid #e2e8f0; border-radius: 0.55rem; padding: 0.6rem 0.75rem; background: #f8fafc; }
.sa-risk-summary-item .lbl { font-size: 0.72rem; color: #64748b; }
.sa-risk-summary-item .val { font-size: 0.95rem; font-weight: 700; color: #1e293b; margin-top: 0.12rem; }
.sa-risk-detail-top { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 0.25rem; }
.sa-risk-dormant-block {
    border: 1px solid #e2e8f0; border-radius: 0.65rem; background: #f8fafc;
    padding: 0.75rem 0.9rem; text-align: center;
}
.sa-risk-dormant-block .lbl { font-size: 0.75rem; color: #64748b; }
.sa-risk-dormant-block .val { font-size: 1.35rem; font-weight: 800; color: #1e293b; margin-top: 0.15rem; line-height: 1.2; }
.sa-risk-info-blocks { display: grid; grid-template-columns: 1fr 1fr minmax(6.5rem, 0.75fr); gap: 0.55rem; }
@media (max-width: 640px) {
    .sa-risk-info-blocks { grid-template-columns: 1fr; }
}
.sa-risk-info-block {
    border: 1px solid #e2e8f0; border-radius: 0.65rem; background: #fff; padding: 0.65rem 0.75rem;
}
.sa-risk-info-block-title { font-size: 0.72rem; font-weight: 700; color: #475569; margin-bottom: 0.45rem; }
.sa-risk-info-rows { display: grid; gap: 0.3rem; font-size: 0.74rem; }
.sa-risk-info-rows .k { color: #94a3b8; margin-right: 0.35rem; }
.sa-risk-info-rows .v { color: #1e293b; font-weight: 600; word-break: break-all; }
.sa-risk-info-block-compact { display: flex; flex-direction: column; justify-content: center; }
.sa-risk-info-compact-val { font-size: 0.82rem; font-weight: 700; color: #1e293b; line-height: 1.35; word-break: break-all; }
.sa-risk-qtable-wrap { border: 1px solid #e2e8f0; border-radius: 0.65rem; background: #fff; padding: 0.65rem 0.75rem; }
.sa-risk-qtable-title { font-size: 0.72rem; font-weight: 700; color: #475569; margin-bottom: 0.45rem; }
.sa-risk-qtable { width: 100%; border-collapse: collapse; font-size: 0.72rem; }
.sa-risk-qtable th, .sa-risk-qtable td { padding: 0.35rem 0.45rem; border-bottom: 1px solid #f1f5f9; }
.sa-risk-qtable thead th { background: #f8fafc; color: #64748b; font-weight: 600; }
.sa-risk-qtable tbody th { color: #475569; font-weight: 700; background: #fff; }
.sa-risk-qtable tbody td { color: #1e293b; font-weight: 600; }
.sa-risk-modal-bar { margin-top: 0.85rem; border: 1px solid #e2e8f0; border-radius: 0.65rem; padding: 0.85rem 0.9rem; background: #fff; }
.sa-risk-modal-bar-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.65rem; margin-bottom: 0.55rem; }
.sa-risk-modal-bar-title {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 0.55rem;
    font-size: 0.9rem; font-weight: 700; color: #334155; line-height: 1.35; min-width: 0;
}
.sa-risk-modal-name { color: #1e293b; }
.sa-risk-modal-fall { font-weight: 700; }
.sa-risk-modal-fall-below_low { color: #dc2626; }
.sa-risk-modal-fall-low_to_avg { color: #ea580c; }
.sa-risk-modal-fall-avg_to_high { color: #ca8a04; }
.sa-risk-modal-fall-above_high { color: #16a34a; }
.sa-risk-modal-fall-no_data { color: #64748b; }
.sa-risk-modal-track { height: 0.65rem; }
.sa-risk-modal-track-wrap { margin-top: 0.15rem; }
.sa-risk-bench-tick {
    position: absolute; top: 50%; transform: translate(-50%, -50%);
    font-size: 0.7rem; font-weight: 700; color: #475569; line-height: 1;
    pointer-events: none; z-index: 1;
}
.sa-risk-modal-scale-labels {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 0.35rem; margin-top: 0.3rem;
    font-size: 0.75rem; font-weight: 600; color: #dc2626; line-height: 1.2;
}
.sa-risk-modal-scale-labels span { flex: 0 1 auto; }
.sa-risk-modal-scale-labels span:nth-child(2) { text-align: center; }
.sa-risk-modal-scale-labels span:last-child { text-align: right; }
.sa-risk-modal-scale-flat { color: #64748b; font-weight: 600; font-size: 0.75rem; margin-top: 0.35rem; }
.sa-risk-modal-note { margin-top: 0.45rem; font-size: 0.72rem; color: #94a3b8; line-height: 1.35; }
.sa-risk-modal-algo {
    margin-top: 0.55rem; padding-top: 0.5rem; border-top: 1px dashed #e2e8f0;
    font-size: 0.68rem; color: #94a3b8; line-height: 1.45;
}
.sa-risk-modal-algo-title {
    font-size: 0.72rem; font-weight: 700; color: #64748b; margin-bottom: 0.35rem; line-height: 1.4;
}
.sa-risk-qtable-total { font-weight: 700; color: #1e293b; background: #f8fafc; }
.sa-risk-modal-bar-inactive .sa-risk-modal-bar-title { font-size: 0.88rem; }
.sa-risk-empty { border: 1px dashed #cbd5e1; border-radius: 0.75rem; padding: 2rem 1rem; text-align: center; color: #94a3b8; font-size: 0.9rem; }

/* YOY 儲存格 */
.sa-table { font-size: 0.75rem; }
.sa-table th, .sa-table td { padding: 0.35rem 0.5rem; border-bottom: 1px solid #e2e8f0; vertical-align: top; }
.yoy-cell-amt { font-weight: 700; color: #1e293b; line-height: 1.3; }
.yoy-cell-sub { display: flex; align-items: center; justify-content: flex-end; gap: 0.35rem; margin-top: 0.15rem; flex-wrap: wrap; }
.yoy-diff-down { color: #dc2626; font-size: 0.65rem; font-weight: 500; }
.yoy-diff-up { color: #16a34a; font-size: 0.65rem; font-weight: 500; }
.yoy-pill { display: inline-block; padding: 0.1rem 0.4rem; border-radius: 9999px; font-size: 0.65rem; font-weight: 600; line-height: 1.2; }
.yoy-pill-down { background: #fecaca; color: #991b1b; }
.yoy-pill-up { background: #bbf7d0; color: #166534; }
.yoy-pill-flat { background: #e2e8f0; color: #64748b; }

.sa-ach-pill { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 9999px; font-size: 0.7rem; font-weight: 600; line-height: 1.25; white-space: nowrap; }
.sa-ach-pill-high { background: #bbf7d0; color: #166534; }
.sa-ach-pill-mid { background: #fef08a; color: #854d0e; }
.sa-ach-pill-low { background: #fecaca; color: #991b1b; }
.sa-ach-pill-na { background: #e2e8f0; color: #64748b; }

.sa-table .sa-sticky-col { position: sticky; left: 0; z-index: 2; background: #fff; box-shadow: 1px 0 0 #e2e8f0; }
.sa-table .sa-sticky-col-2 { position: sticky; left: 2.25rem; z-index: 2; background: #fff; box-shadow: 1px 0 0 #e2e8f0; }
.sa-table.sa-table-sticky-head thead th.sa-sticky-col,
.sa-table.sa-table-sticky-head thead th.sa-sticky-col-2 { z-index: 6; background-color: #e3e6ec; }
.sa-table tbody tr:hover .sa-sticky-col,
.sa-table tbody tr:hover .sa-sticky-col-2 { background: #f8fafc; }
.sa-table .yoy-row-grand-total .sa-sticky-col,
.sa-table .yoy-row-grand-total .sa-sticky-col-2 { background: #f1f5f9; }
.sa-table tbody tr.yoy-row-grand-total:hover .sa-sticky-col,
.sa-table tbody tr.yoy-row-grand-total:hover .sa-sticky-col-2 { background: #f1f5f9; }
.sa-target-table .sa-sticky-col { min-width: 3.5rem; }
.sa-table .yoy-col-item.sa-sticky-col-2 { min-width: 10rem; }
#wr-table .sa-sticky-col { min-width: 12rem; }
.yoy-tree-toggle { cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 0.25rem; }
.yoy-tree-toggle .chev { display: inline-block; width: 0.9rem; color: #64748b; font-size: 0.7rem; }
.yoy-col-seq {
    width: 2.25rem;
    min-width: 2.25rem;
    max-width: 2.25rem;
    padding: 0.35rem 0.25rem !important;
    font-size: 0.7rem;
    color: #94a3b8;
    vertical-align: middle;
}
thead .yoy-col-seq { font-weight: 600; color: #64748b; }
.yoy-row-parent .yoy-col-seq { font-weight: 600; color: #64748b; }
.yoy-row-child .yoy-col-item { padding-left: 1.75rem; color: #475569; }
.yoy-row-parent .yoy-col-item { font-weight: 600; }
.sa-metric-check {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #f8fafc;
    font-size: 0.75rem;
    color: #475569;
    cursor: pointer;
    user-select: none;
}
.sa-metric-check input { margin: 0; accent-color: #4f46e5; }
.sa-totals-settings {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 1rem;
    margin: 0 0 0.85rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.65rem;
    background: #f8fafc;
    font-size: 12px;
}
.sa-val-hidden-tag {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 500;
    margin-left: 0.2rem;
}
.sa-totals-opt { display: inline-flex; align-items: center; gap: 0.3rem; color: #475569; cursor: pointer; user-select: none; }
.sa-totals-opt input { margin: 0; accent-color: #4f46e5; }
.sa-total-check {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #f8fafc;
    font-size: 0.75rem;
    color: #475569;
    cursor: pointer;
    user-select: none;
}
.sa-total-check input { margin: 0; accent-color: #4f46e5; }
.yoy-row-grand-total td { background: #f1f5f9; border-top: 2px solid #cbd5e1; }
.yoy-row-grand-total .yoy-col-item { font-weight: 700; color: #334155; }
.yoy-cell-stack { display: flex; flex-direction: column; align-items: flex-end; gap: 0.15rem; }
.yoy-cell-line { display: flex; align-items: baseline; justify-content: flex-end; gap: 0.25rem; line-height: 1.3; }
.yoy-cell-line + .yoy-cell-line { padding-top: 0.15rem; border-top: 1px dashed #e2e8f0; }
.yoy-metric-lbl { font-size: 0.6rem; color: #94a3b8; white-space: nowrap; }
.yoy-cell-val { font-size: 0.75rem; font-weight: 600; color: #334155; }
.sa-table-scroll { max-height: min(87vh, calc(100vh - 4rem)); overflow: auto; -webkit-overflow-scrolling: touch; }
.sa-table-sticky-head thead th { position: sticky; top: 0; z-index: 4; background-color: #e3e6ec; box-shadow: 0 1px 0 #d4cfc7; }
.sa-metric-btn.active { background: #4f46e5; color: #fff; }
.sa-customer-picker { position: relative; min-width: 14rem; }
.sa-customer-dd { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; max-height: 12rem; overflow-y: auto; background: #fff; border: 1px solid #cbd5e1; border-radius: 0.5rem; box-shadow: 0 4px 12px rgba(15,23,42,0.12); }
.sa-customer-dd button { display: block; width: 100%; text-align: left; padding: 0.4rem 0.6rem; font-size: 0.75rem; border: none; background: transparent; cursor: pointer; }
.sa-customer-dd button:hover { background: #f1f5f9; }
.wr-q-cell { cursor: pointer; }
.wr-q-cell:hover { outline: 1px solid #6366f1; }
