/* Luma Quant — factor-rank styles (loaded in order from web/index.html) */
/* ============================================================
       Factor Rank (factor engine UI)
       ============================================================ */
    .fr-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
    button.fr-btn {
      width: auto; height: auto; margin: 0; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 650;
      background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); box-shadow: none;
    }
    button.fr-btn.primary { background: linear-gradient(180deg, #4d8dff 0%, #3b73e0 100%); border-color: transparent; color: #fff; }
    button.fr-btn.small { padding: 3px 9px; font-size: 11.5px; }
    button.fr-btn:hover { filter: brightness(1.12); }
    .fr-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 9px 12px; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--muted); font-size: 12.5px; }
    .fr-status strong { color: var(--ink); }
    .fr-sep { color: #3a4560; }
    .fr-warn { color: #fbbf24; }
    .fr-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; background: #fbbf24; }
    .fr-dot.ok { background: #26c281; }
    .fr-dot.bad { background: #ff5470; }
    .fr-dot.wait { animation: frPulse 1.2s ease-in-out infinite; }
    @keyframes frPulse { 50% { opacity: .35; } }
    .fr-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 16px; align-items: start; }
    .fr-main, .fr-side, .fr-box { min-width: 0; }
    #factorView .pulse-toolbar > div:first-child { min-width: 0; }
    .fr-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; }
    .fr-box { background: linear-gradient(180deg, #131a2a 0%, #111726 100%); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
    .fr-box h4 { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; display: flex; justify-content: space-between; }
    .fr-count { color: var(--accent); text-transform: none; letter-spacing: 0; }
    .fr-label { display: block; margin: 9px 0 4px; font-size: 12px; color: var(--muted); font-weight: 650; }
    .fr-box select, .fr-box input[type=date], .fr-box input[type=number], .fr-box input[type=search] { height: 34px; font-size: 13px; }
    .fr-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .fr-check { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 0; font-size: 12px; color: var(--muted); font-weight: 500; }
    .fr-check input { width: auto; height: auto; margin-top: 2px; }
    .fr-hint { color: var(--muted); font-size: 11.5px; margin: 6px 0; }
    .fr-factor-list { display: flex; flex-direction: column; gap: 2px; }
    .fr-group-title { margin: 10px 0 4px; font-size: 11px; color: var(--accent); font-weight: 750; text-transform: uppercase; letter-spacing: .4px; }
    .fr-factor { display: grid; grid-template-columns: minmax(0, 1fr) 16px 18px 58px; align-items: center; gap: 6px; padding: 3px 4px; border-radius: 6px; }
    .fr-factor.on { background: rgba(77,141,255,0.10); }
    .fr-factor label { display: flex; align-items: center; gap: 7px; margin: 0; font-weight: 500; font-size: 12.5px; min-width: 0; cursor: pointer; }
    .fr-factor label input { width: auto; height: auto; margin: 0; flex: 0 0 auto; }
    .fr-fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .fr-dir { font-size: 12px; text-align: center; color: var(--muted); }
    .fr-dir.high { color: #34d399; }
    .fr-dir.low { color: #f87171; }
    a.fr-info { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid rgba(148,163,184,0.6); color: #93c5fd; font-size: 10px; font-weight: 700; text-decoration: none; font-style: italic; }
    a.fr-info:hover { background: rgba(59,130,246,0.22); }
    input.fr-w { height: 26px !important; padding: 0 6px; font-size: 12px !important; text-align: right; }
    .fr-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
    .fr-stale { margin: 0 0 10px; padding: 7px 11px; border-radius: 8px; background: rgba(251,191,36,0.10); border: 1px solid rgba(251,191,36,0.35); color: #fbbf24; font-size: 12.5px; }
    .fr-error { margin: 0 0 10px; padding: 8px 12px; border-radius: 8px; background: rgba(255,84,112,0.10); border: 1px solid rgba(255,84,112,0.35); color: #ff8fa3; font-size: 12.5px; }
    .fr-meta { color: var(--muted); font-size: 12.5px; margin: 0 0 10px; line-height: 1.5; }
    .fr-note { color: var(--muted); font-size: 11.5px; margin: 10px 0 0; }
    .fr-name { color: #94a3b8; font-size: 12px; }
    .fr-sector { color: #94a3b8; font-size: 12px; white-space: nowrap; }
    a.fr-th-link { color: #93c5fd; text-decoration: none; }
    a.fr-th-link:hover { text-decoration: underline; }
    .fr-tiles { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-top: 0; }
    .fr-tiles strong { font-size: 18px; }
    .fr-tiles small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; margin-top: 2px; }
    .fr-card { background: linear-gradient(180deg, #131a2a 0%, #111726 100%); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; min-width: 0; }
    .fr-card h3 { margin: 0 0 10px; font-size: 13px; color: var(--ink); font-weight: 650; }
    .fr-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
    .fr-chart-wrap { position: relative; }
    .fr-canvas { display: block; width: 100%; height: 240px; border-radius: 8px; border: 1px solid var(--line); }
    .fr-canvas.tall { height: 340px; }
    .fr-chart-wrap .chart-tooltip { position: absolute; display: none; pointer-events: none; padding: 7px 9px; border-radius: 8px; font-size: 12px; line-height: 1.5; color: var(--ink); z-index: 3; }
    .fr-scroll { overflow: auto; max-height: 340px; }
    .fr-hold .ticker-symbol { display: inline-block; margin: 0 6px 2px 0; font-size: 12px; }
    .fr-diag th.fr-sortable { cursor: pointer; }
    .fr-diag th.fr-sortable.on { color: #93c5fd; }
    .lib-engine { margin-top: 10px; padding: 12px 14px; border-radius: 10px; border: 1px dashed rgba(77,141,255,0.45); background: rgba(77,141,255,0.06); }
    .lib-engine p { margin: 0 0 8px !important; font-size: 13px !important; }
    .lib-engine-actions { display: flex; flex-wrap: wrap; gap: 8px; }
    .lib-badge.engine { color: #c4b5fd; border-color: rgba(196,181,253,0.4); background: rgba(139,92,246,0.10); }
    @media (max-width: 1000px) {
      .fr-layout { grid-template-columns: 1fr; }
      .fr-side { position: static; max-height: none; }
      .fr-grid2 { grid-template-columns: 1fr; }
      .fr-actions { justify-content: flex-start; }
    }
  
/* research report, optimizer and reproducibility additions */
.fr-subbox { margin-top: 10px; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 10px; }
.fr-subbox .fr-group-title { margin-top: 0; }
.fr-src { display: inline-block; padding: 1px 6px; border-radius: 999px; font-size: 10.5px; border: 1px solid var(--line); color: var(--muted); }
.fr-src.fund { color: #86efac; border-color: rgba(134,239,172,0.4); }
.fr-manifest { margin: 6px 0 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.fr-manifest code { color: var(--ink); font-size: 11px; }
.fr-manifest a { color: #93c5fd; }
.fr-attr-head { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.fr-attr-head strong { font-size: 14px; }
.fr-section { font-size: 14px; margin: 4px 0 8px; color: var(--ink); }

/* universe selector, alerts, out-of-sample and report view */
button.fr-alert-badge { width: auto; height: auto; margin: 0; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; background: rgba(251,191,36,0.14); color: #fbbf24; border: 1px solid rgba(251,191,36,0.45); box-shadow: none; cursor: pointer; }
.frr-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.frr-alert { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; margin: 0 0 8px; font-size: 12.5px; }
.frr-alert.new { border-color: rgba(251,191,36,0.55); background: rgba(251,191,36,0.06); }
.frr-alert ul { margin: 6px 0 0; padding-left: 18px; color: var(--ink); }
.frr-alert-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.frr-title { margin: 0 0 4px; font-size: 18px; }
.frr-summary { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.6; color: var(--ink); }
.frr-summary li { margin: 0 0 4px; }
.frr-svg { display: block; width: 100%; height: auto; max-height: 420px; }
.frr-svg text { font-family: inherit; }
.frr-t { fill: #8a93a8; font-size: 11px; }
.frr-t.small, .frr-ink.small { font-size: 10.5px; }
.frr-ink { fill: var(--ink); font-size: 12px; }
.frr-ink.bold, .frr-t.bold { font-weight: 650; }
.frr-axis { stroke: #5b6478; stroke-width: 1; }
.frr-grid { stroke: #232b3d; stroke-width: 1; }
.frr-ref { stroke: #8a93a8; stroke-width: 1; stroke-dasharray: 4 4; fill: none; }
.frr-band { fill: rgba(148,163,184,0.08); }
.frr-quad { fill: rgba(77,141,255,0.06); }
.frr-dot.muted { fill: #64748b; }
.frr-dot.accent { fill: #4d8dff; fill-opacity: 0.9; }
.frr-line { fill: none; stroke: #4d8dff; stroke-width: 2; }
@media print {
  header, .top-nav, nav, .fr-side, .fr-tabs, .fr-status, .frr-actions, .pulse-toolbar, .fr-stale { display: none !important; }
  body { background: #fff !important; color: #111 !important; }
  .fr-layout { display: block !important; }
  .fr-card { background: #fff !important; border-color: #bbb !important; break-inside: avoid; }
  .fr-card h3, .frr-title, .frr-summary, .fr-meta, .fr-hint, .factor-table td, .factor-table th { color: #111 !important; }
  .frr-t { fill: #444; } .frr-ink { fill: #111; } .frr-grid { stroke: #ddd; } .frr-axis { stroke: #888; }
  .frr-dot.muted { fill: #9ca3af; } .frr-dot.accent { fill: #1d4ed8; } .frr-line { stroke: #1d4ed8; }
  .fr-scroll { max-height: none !important; overflow: visible !important; }
}
