/* Page optimization measurements; scoped to this module. */
.msp-opt-intro{max-width:780px;margin:0 0 22px;font-size:13px;color:var(--muted);line-height:1.75}
.msp-opt-list{display:grid;gap:18px;margin-bottom:24px}
.msp-opt-item.card{padding:0;overflow:hidden}
.msp-opt-summary{display:flex;align-items:center;gap:18px;padding:22px;list-style:none;cursor:pointer;border-radius:var(--radius)}
.msp-opt-summary::-webkit-details-marker{display:none}
.msp-opt-summary:hover{background:#fafbfd}
.msp-opt-summary:focus-visible{outline-offset:-4px}
.msp-opt-summary-main{display:flex;flex-direction:column;gap:5px;min-width:0;flex:1}
.msp-opt-kind{font-size:10px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);font-weight:600}
.msp-opt-title{font-size:16px;font-weight:600;line-height:1.45;overflow-wrap:anywhere}
.msp-opt-url{font-size:12px;color:var(--muted);overflow-wrap:anywhere;word-break:break-word}
.msp-opt-date{font-size:12px;color:var(--muted);margin-top:2px}
.msp-opt-summary-side{display:flex;align-items:flex-end;flex-direction:column;gap:9px;max-width:260px;text-align:right}
.msp-opt-summary-result{font-size:13px;font-weight:600;line-height:1.5;color:var(--text)}
.msp-opt-status{display:inline-block;background:var(--soft);color:var(--accent);padding:5px 9px;border-radius:6px;font-size:11px;line-height:1.5}
.msp-opt-open-label{font-size:11px;color:var(--muted)}
.msp-opt-chevron{width:18px;height:18px;flex:none;color:var(--muted);transition:transform .15s}
.msp-opt-item[open]>.msp-opt-summary{border-radius:var(--radius) var(--radius) 0 0;background:#fafbfd}
.msp-opt-item[open]>.msp-opt-summary .msp-opt-chevron{transform:rotate(90deg)}
.msp-opt-item[open]>.msp-opt-summary .msp-opt-open-label{display:none}
.msp-opt-body{padding:24px 22px 22px;border-top:1px solid var(--line);min-width:0}
.msp-opt-explanation{max-width:85ch;margin-bottom:22px}
.msp-opt-explanation h2{font-size:18px;margin-bottom:12px}
.msp-opt-description,.msp-opt-goal{white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:1.8;color:var(--text)}
.msp-opt-goal{margin-top:9px}
.msp-opt-description strong,.msp-opt-goal strong{font-weight:600}
.msp-opt-notice{padding:13px 16px;margin-bottom:20px;background:var(--soft);border-radius:9px;font-size:12px;line-height:1.7}
.msp-opt-notice p+p{margin-top:7px}
.msp-opt-notice progress{display:block;max-width:330px;width:100%;height:6px;margin-top:11px;border:0;border-radius:10px;overflow:hidden;accent-color:var(--accent)}
.msp-opt-notice progress::-webkit-progress-bar{background:#d9e1ec;border-radius:10px}
.msp-opt-notice progress::-webkit-progress-value{background:var(--accent);border-radius:10px}
.msp-opt-notice progress::-moz-progress-bar{background:var(--accent);border-radius:10px}
.msp-opt-measurement h3{font-size:14px;margin-bottom:14px}
.msp-opt-periods{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;margin-bottom:15px;padding:15px 0;border-top:1px solid var(--line);border-bottom:1px solid var(--line)}
.msp-opt-periods-single{grid-template-columns:1fr}
.msp-opt-period{display:flex;flex-direction:column;gap:4px;min-width:0;font-size:12px;line-height:1.6;color:var(--muted)}
.msp-opt-period strong{font-size:12px;font-weight:600;color:var(--text)}
.msp-opt-period small{font-size:10px}
.msp-opt-metrics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:15px}
.msp-opt-metric{min-width:0;padding:20px;border:1px solid var(--line);border-radius:10px;background:var(--panel)}
.msp-opt-metric h4{font-size:13px;font-weight:600;line-height:1.6;margin:0 0 17px;color:var(--text)}
.msp-opt-values{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin:0}
.msp-opt-values-single{grid-template-columns:1fr}
.msp-opt-values>div{min-width:0}
.msp-opt-values dt{font-size:11px;line-height:1.5;color:var(--muted);margin-bottom:5px}
.msp-opt-values dd{font-size:29px;font-weight:600;line-height:1.2;letter-spacing:-.04em;font-variant-numeric:tabular-nums;margin:0;color:var(--text);overflow-wrap:anywhere}
.msp-opt-value-after dd,.msp-opt-values-single dd{color:var(--accent)}
.msp-opt-change{display:flex;flex-direction:column;gap:2px;padding-top:15px;margin-top:16px;border-top:1px solid var(--line);font-size:12px;line-height:1.6}
.msp-opt-change strong{font-weight:600}
.msp-opt-change-positive strong{color:#237044}
.msp-opt-change-negative strong{color:#9c463b}
.msp-opt-change-neutral strong{color:var(--muted)}
.msp-opt-metric-extra{padding:15px 18px;background:#fafbfd;border-color:#eef1f5}
.msp-opt-metric-extra h4{font-size:12px;margin-bottom:12px;font-weight:500}
.msp-opt-metric-extra .msp-opt-values dd{font-size:22px}
.msp-opt-muted{font-size:12px;color:var(--muted);line-height:1.7}
.msp-opt-year{display:flex;align-items:center;gap:8px;width:max-content;max-width:100%;font-size:12px;margin:21px 0 16px;cursor:pointer;color:var(--muted)}
.msp-opt-year input{width:16px;height:16px;margin:0;accent-color:var(--accent);flex:none}
.msp-opt-year input:focus-visible{outline:3px solid #547bad;outline-offset:3px}
.msp-opt-prior{border-left:3px solid #bbc7d7;padding:17px;margin:0 0 22px;background:#fafbfd;border-radius:0 6px 6px 0}
.msp-opt-prior .msp-opt-periods{padding-top:0;border-top:0}
.msp-opt-prior .msp-opt-metric{padding:16px}
.msp-opt-prior .msp-opt-values dd{font-size:24px}
.msp-opt-chart-section{margin-top:24px;padding-top:22px;border-top:1px solid var(--line)}
.msp-opt-chart-head{display:flex;justify-content:space-between;align-items:flex-start;gap:18px;margin-bottom:12px}
.msp-opt-chart-head h3{font-size:14px;margin-bottom:4px}
.msp-opt-segmented{display:flex;gap:3px;background:var(--bg);padding:3px;border-radius:7px;flex-shrink:0}
.msp-opt-segmented button{padding:7px 11px;border:0;background:transparent;border-radius:5px;color:var(--muted);font-size:11px;min-height:32px}
.msp-opt-segmented button[aria-pressed=true]{background:var(--panel);color:var(--accent);box-shadow:0 1px 3px #263d6210;font-weight:600}
.msp-opt-chart{min-width:0;width:100%}
.msp-opt-chart svg{width:100%;height:auto;display:block;overflow:visible}
.msp-opt-chart text{font:10px Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;fill:var(--muted)}
.msp-opt-grid{stroke:var(--line);stroke-width:1}
.msp-opt-series{fill:none;stroke-width:2.3;stroke-linecap:round;stroke-linejoin:round}
.msp-opt-series-current{stroke:var(--accent)}
.msp-opt-series-prior{stroke:#98a7bb;stroke-width:2;stroke-dasharray:3 5}
.msp-opt-marker{stroke:#7e8b9e;stroke-width:1;stroke-dasharray:4 4}
.msp-opt-chart text.msp-opt-marker-label{font-weight:500;fill:var(--accent)}
.msp-opt-point-current{fill:var(--accent)}
.msp-opt-point-prior{fill:#98a7bb}
.msp-opt-point{stroke:var(--panel);stroke-width:.5;cursor:help}
.msp-opt-point:hover{r:5;stroke-width:1.5}
.msp-opt-empty-chart{font-size:11px!important}
.msp-opt-legend{display:flex;gap:15px;flex-wrap:wrap;margin-top:7px;color:var(--muted);font-size:10px;line-height:1.6}
.msp-opt-legend span{display:inline-flex;align-items:center;gap:7px}
.msp-opt-line-key{display:inline-block;width:22px;height:2px;background:var(--accent)}
.msp-opt-line-prior{background:repeating-linear-gradient(to right,#98a7bb 0,#98a7bb 4px,transparent 4px,transparent 7px)}
.msp-opt-line-marker{width:2px;height:11px;display:inline-block;background:repeating-linear-gradient(to bottom,#7e8b9e 0,#7e8b9e 3px,transparent 3px,transparent 5px);margin:0 10px}
.msp-opt-chart-note{font-size:10px;color:var(--muted);line-height:1.7;margin-top:12px}
.msp-opt-notes{margin-top:20px;padding:12px 15px;background:#f7f8fa;border-radius:7px;font-size:11px;color:var(--muted);line-height:1.8}
.msp-opt-notes p+p{margin-top:7px}
.msp-opt-source{border-top:1px solid var(--line);padding-top:14px;margin-top:19px;font-size:10px;color:var(--muted);line-height:1.8}
.msp-opt-empty h2{margin-bottom:9px}
.msp-opt-empty p{color:var(--muted);font-size:13px;line-height:1.8}
@media(max-width:640px){.msp-opt-summary{padding:17px;gap:12px;flex-wrap:wrap}.msp-opt-summary-main{flex-basis:calc(100% - 34px)}.msp-opt-chevron{order:1}.msp-opt-summary-side{order:2;flex-direction:row;align-items:center;text-align:left;max-width:none;flex-basis:100%;flex-wrap:wrap;gap:9px}.msp-opt-summary-result{flex-basis:100%}.msp-opt-title{font-size:15px}.msp-opt-body{padding:21px 16px 18px}.msp-opt-chart-head{flex-wrap:wrap;gap:12px}.msp-opt-prior{padding:13px}.msp-opt-notice{padding:13px 14px}.msp-opt-chart-section{margin-top:21px}.msp-opt-legend{gap:10px}.msp-opt-metrics{grid-template-columns:1fr;gap:12px}.msp-opt-metric{padding:18px}.msp-opt-periods{gap:14px}.msp-opt-period{font-size:11px}.msp-opt-period strong{font-size:11px}.msp-opt-explanation h2{font-size:17px}.msp-opt-values dd{font-size:28px}}
@media(max-width:360px){.msp-opt-periods{grid-template-columns:1fr;gap:13px}.msp-opt-values dd{font-size:25px}}
@media(prefers-reduced-motion:reduce){.msp-opt-chevron{transition:none}}

/* Mobile: optimization chart choices stay within the expanded result card. */
@media (max-width: 640px) {
  #panel-optimizations .msp-opt-chart-head { flex-direction: column; align-items: stretch; }
  #panel-optimizations .msp-opt-segmented {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%; min-width: 0; max-width: 100%; flex-shrink: 1;
  }
  #panel-optimizations .msp-opt-segmented button { min-width: 0; padding: 9px 4px; white-space: normal; }
}
