/* Shared rating components; colors carry text labels as well as numeric meaning. */
.fpr-summary, .fpr-compact, .fpr-overall, .fpr-history {
  --fpr-ink: #142342; --fpr-muted: #53637b; --fpr-line: #dce5f1; --fpr-track: #e7edf5;
  --fpr-good: #096c48; --fpr-good-fill: #eaf8f1; --fpr-watch: #855300; --fpr-watch-fill: #fff5df;
  --fpr-low: #b82b41; --fpr-low-fill: #fff0f2; --fpr-neutral: #52627a; --fpr-neutral-fill: #eef2f7;
  color: var(--fpr-ink); min-width: 0; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere;
}
.fpr-summary *, .fpr-compact *, .fpr-overall * { box-sizing: border-box; }
.fpr-good { --fpr-tone: var(--fpr-good); --fpr-fill: var(--fpr-good-fill); }
.fpr-watch { --fpr-tone: var(--fpr-watch); --fpr-fill: var(--fpr-watch-fill); }
.fpr-low { --fpr-tone: var(--fpr-low); --fpr-fill: var(--fpr-low-fill); }
.fpr-neutral { --fpr-tone: var(--fpr-neutral); --fpr-fill: var(--fpr-neutral-fill); }
.fpr-pair, .fpr-overall { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fpr-rating { min-width: 0; padding: 14px 12px; border-radius: 13px; background: var(--fpr-fill); }
.fpr-rating-label { font-size: 12px; font-weight: 600; color: var(--fpr-ink); }
.fpr-value { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px; margin: 4px 0; color: var(--fpr-tone); font-variant-numeric: tabular-nums; }
.fpr-value strong { font-size: 32px; font-weight: 750; letter-spacing: -1px; color: inherit; line-height: 1.2; }
.fpr-value > span { font-size: 12px; color: var(--fpr-muted); }
.fpr-rating-status { color: var(--fpr-tone); font-size: 12px; font-weight: 600; }
.fpr-rating-source { color: var(--fpr-muted); font-size: 11px; margin-top: 8px; }
.fpr-trend { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 12px 0; font-size: 12px; color: var(--fpr-muted); }
.fpr-trend strong { color: var(--fpr-tone); font-weight: 650; }
.fpr-warning { color: var(--fpr-watch); background: var(--fpr-watch-fill); padding: 10px 12px; border-radius: 8px; margin: 0 0 12px; font-size: 12px; }
.fpr-distribution { border-top: 1px solid var(--fpr-line); padding-top: 12px; }
.fpr-distribution-title { color: var(--fpr-muted); font-size: 12px; margin-bottom: 10px; }
.fpr-bar-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) minmax(20px, auto); gap: 10px; align-items: center; margin: 8px 0; font-size: 12px; font-variant-numeric: tabular-nums; }
.fpr-track { height: 7px; border-radius: 4px; background: var(--fpr-track); overflow: hidden; }
.fpr-track i { display: block; height: 100%; background: #1765ed; border-radius: 4px; }
.fpr-negative .fpr-track i { background: var(--fpr-low); }
.fpr-count { text-align: right; }
.fpr-negative-summary { color: var(--fpr-muted); font-size: 12px; margin-top: 12px; }
.fpr-negative-summary strong { color: var(--fpr-tone); }
.fpr-compact { display: grid; gap: 9px; margin: 0; width:100%; text-align:left; }
.fpr-mini-row { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px; min-width:0; }
.fpr-mini-platform { grid-column:1/-1; font-size:11px; font-weight:650; }
.fpr-month-badge { display:flex; flex-wrap:wrap; align-items:baseline; gap:3px; min-width:0; padding:4px 6px; border-radius:7px; background:var(--fpr-fill); font-size:10px; }
.fpr-month-badge strong { font-size:13px; color:var(--fpr-tone); font-variant-numeric:tabular-nums; }
.fpr-month-badge small { font-size:10px; color:var(--fpr-muted); }
.fpr-overall-paired { grid-template-columns:1fr; gap:18px; }
.fpr-history-link { display:inline-flex; align-items:center; min-height:44px; margin-top:8px; padding:8px 0; border:0; background:none; color:#1765ed; font:inherit; font-size:13px; font-weight:600; cursor:pointer; text-align:left; }
.fpr-history-link:focus-visible { outline:2px solid #1765ed; outline-offset:4px; border-radius:4px; }
.fpr-badge { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 3px; min-width: 0; padding: 4px 6px; border-radius: 7px; background: var(--fpr-fill); font-size: 11px; line-height: 1.4; }
.fpr-badge > strong { color: var(--fpr-tone); font-size: 13px; font-variant-numeric: tabular-nums; }
.fpr-badge-source { color: var(--fpr-muted); font-size: 10px; white-space: nowrap; }
.fpr-platform { min-width: 0; }
.fpr-platform h4 { color: var(--fpr-ink); margin: 0 0 10px; font-size: 15px; }
.fpr-platform h4 .fpr-history-link { margin:0; font-size:15px; padding-top:0; padding-bottom:0; }
.fpr-provenance { margin: 8px 0 0; color: var(--fpr-muted); font-size: 11px; }
.fpr-history { --history-surface:#fff; --history-bg:#f5f7fb; box-sizing:border-box; width:min(720px,calc(100% - 32px)); max-height:calc(100dvh - 40px); padding:0; border:1px solid var(--fpr-line); border-radius:22px; background:var(--history-bg); color:var(--fpr-ink); font:14px/1.5 system-ui,sans-serif; overflow:auto; overscroll-behavior:contain; }
.fpr-history::backdrop { background:rgb(10 22 45 / 55%); }
.fpr-history * { box-sizing:border-box; }
.fpr-history-top { position:sticky; top:0; z-index:2; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:18px 20px; background:var(--history-surface); border-bottom:1px solid var(--fpr-line); }
.fpr-history-top h2 { font-size:19px; line-height:1.25; margin:5px 0 0; }
.fpr-history-top span { font-size:11px; text-transform:uppercase; letter-spacing:.08em; color:var(--fpr-muted); }
.fpr-history-top button { flex:none; width:44px; height:44px; border:1px solid var(--fpr-line); border-radius:50%; background:var(--history-bg); color:inherit; cursor:pointer; font:inherit; }
.fpr-history-body { padding:18px 20px 28px; }
.fpr-history-tabs { display:grid; grid-template-columns:1fr 1fr; padding:4px; gap:4px; background:var(--fpr-track); border-radius:13px; }
.fpr-history-tabs button { min-height:44px; border:0; border-radius:10px; background:none; color:var(--fpr-ink); cursor:pointer; font:600 14px system-ui,sans-serif; }
.fpr-history-tabs [aria-selected=true] { background:var(--history-surface); box-shadow:0 2px 7px #0001; color:#1765ed; }
.fpr-history-caption,.fpr-history-gap { color:var(--fpr-muted); font-size:12px; margin:14px 0; }
.fpr-history-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:25px; }
.fpr-history-heading h3 { font-size:18px; margin:0; }
.fpr-history-heading select { min-height:44px; border:1px solid var(--fpr-line); border-radius:9px; background:var(--history-surface); color:var(--fpr-ink); font:inherit; padding:5px; }
.fpr-history-months { display:grid; gap:16px; }
.fpr-history-month { padding:16px; border:1px solid var(--fpr-line); border-radius:16px; background:var(--history-surface); min-width:0; }
.fpr-history-month>header { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:6px; margin-bottom:13px; }
.fpr-history-month h4 { margin:0; font-size:16px; }
.fpr-history-month>header span { font-size:11px; color:var(--fpr-muted); }
.fpr-history-month summary { cursor:pointer; padding:12px 0; min-height:44px; font-weight:600; }
.fpr-history-month details { border-top:1px solid var(--fpr-line); }
.fpr-history-comment { white-space:pre-wrap; overflow-wrap:anywhere; }
@media (max-width:600px) {
  .fpr-history { width:100%; height:100dvh; max-height:100dvh; max-width:100%; margin:0; border:0; border-radius:0; }
  .fpr-history-top { padding:calc(12px + env(safe-area-inset-top)) 14px 12px; }
  .fpr-history-body { padding:16px 12px calc(28px + env(safe-area-inset-bottom)); }
  .fpr-history-month { padding:12px; }
}
@media (max-width: 350px) {
  .fpr-rating { padding: 12px 10px; }
  .fpr-value strong { font-size: 28px; }
  .fpr-rating-label { min-height: 35px; }
}
@media (prefers-color-scheme: dark) {
  /* The main manager wizard remains a light surface; MiniApp follows system theme. */
  .app .fpr-summary, .app .fpr-compact, .app .fpr-overall,
  .fpr-history[data-miniapp=true], .fpr-history[data-miniapp=true] .fpr-summary, .fpr-history[data-miniapp=true] .fpr-overall {
    --fpr-ink: #ecf1ff; --fpr-muted: #b0bed5; --fpr-line: #344159; --fpr-track: #2b3850;
    --fpr-good: #8ce4bc; --fpr-good-fill: #173b31; --fpr-watch: #ffd080; --fpr-watch-fill: #433620;
    --fpr-low: #ffabb6; --fpr-low-fill: #442731; --fpr-neutral: #b9c7de; --fpr-neutral-fill: #273349;
  }
  .fpr-history[data-miniapp=true] { --history-surface:#172339; --history-bg:#101a2b; }
  .fpr-history[data-miniapp=true] .fpr-history-link,.app .fpr-history-link,.fpr-history[data-miniapp=true] .fpr-history-tabs [aria-selected=true] { color:#93b9ff; }
}
