/* Station comparison: the canvas retains its interaction area beside the instrument panel. */
.retrofit-entry {
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  width:100%; margin-bottom:8px; padding:10px 2px 12px; border:0; border-bottom:1px solid #d2dee3;
  background:transparent; text-align:start; color:#155787; font:inherit; font-size:14px; font-weight:680;
}
.energy-mode .retrofit-entry {display:none}
body.rf-active {--rf-width:clamp(390px,35vw,550px)}
body.rf-active #experience #viewport {left:0; right:var(--rf-width)}
body.rf-active #experience>.station-summary, body.rf-active #experience>#energy-stage,
body.rf-active #experience>#scenario-panel, body.rf-active #experience>.scene-footer,
body.rf-active #experience>#flow-strip, body.rf-active #notification {display:none!important}

body.rf-active #experience>.scene-toolbar {
  display:flex; position:absolute; z-index:5; inset:auto auto 20px calc((100% - var(--rf-width)) / 2);
  transform:translateX(-50%); align-items:center; justify-content:center; gap:2px;
  width:max-content; max-width:calc(100% - var(--rf-width) - 20px); overflow:auto;
  padding:4px; border:1px solid #d7e2e7; border-radius:9px;
  background:#fffffff5; box-shadow:0 3px 14px #102b3b20;
}
.rf-active .scene-toolbar button {display:none}
.rf-active .scene-toolbar :is([data-camera=overview],[data-camera=charging],[data-camera=storage]) {
  display:block; flex:0 0 auto; padding:8px 12px; min-height:36px;
  border-radius:5px; color:#355465; font-size:13px; font-weight:650;
}
.rf-active .scene-toolbar button.active {background:#18485c; color:white}
body.rf-active #experience:has(#loading:not([hidden]))>.scene-toolbar {visibility:hidden}

#retrofit-dialog {
  --rf-ink:#153947; --rf-muted:#526971; --rf-line:#d6e0e1;
  --rf-paper:#fafcfb; --rf-deep:#153f4e; --rf-teal:#156b66;
  --rf-gutter:clamp(20px,2vw,36px);
  position:absolute; inset:0 0 0 auto; z-index:9; width:var(--rf-width); height:100%;
  max-height:none; max-width:100%; margin:0; padding:0; overflow:auto;
  scrollbar-gutter:stable; overscroll-behavior:contain;
  border:0; border-inline-start:1px solid #cfdbde; border-radius:0;
  color:var(--rf-ink); background:var(--rf-paper);
  box-shadow:-5px 0 22px #1934430a; font-family:Manrope,'Microsoft YaHei',sans-serif;
}
#retrofit-dialog[open] {display:block}
.rf-head,.rf-content {padding-inline:var(--rf-gutter)}
.rf-head {display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding-top:clamp(20px,2.2vh,32px)}
.rf-head small {color:var(--rf-teal); font-size:12px; font-weight:690}
#retrofit-dialog h2 {margin:6px 0 0; font-size:clamp(28px,2.25vw,37px); font-weight:745; line-height:1.16; letter-spacing:-.034em; color:var(--rf-ink)}
.rf-head button {
  display:grid; flex:none; place-content:center; width:38px; height:38px; padding:0;
  border:1px solid #d2dfe0; border-radius:50%; background:#fff; color:#46616a; font:400 24px/1 sans-serif;
}
.rf-content {padding-bottom:24px}
.rf-content p {font-size:14px; line-height:1.65; color:var(--rf-muted)}
.rf-brief {margin:10px 0 16px}
.rf-presets {
  position:relative; isolation:isolate; display:grid; grid-template-columns:repeat(2,minmax(0,1fr));
  gap:2px; padding:4px; border:1px solid #d3dfe0; background:#e9efee; border-radius:11px;
}
.rf-presets::before {
  content:''; position:absolute; z-index:-1; inset:4px auto 4px 4px; width:calc((100% - 10px)/2);
  border-radius:7px; background:#fff; box-shadow:0 1px 4px #1d39451a; opacity:0;
}
.rf-presets:has([aria-pressed=true])::before {opacity:1}
.rf-presets:has(:last-child[aria-pressed=true])::before {transform:translateX(calc(100% + 2px))}
.rf-presets button {
  display:grid; min-width:0; grid-template-columns:auto auto; align-items:center; justify-content:center; column-gap:9px;
  padding:6px; min-height:44px; border:0; border-radius:7px; background:transparent;
  color:#526970; font:inherit; font-size:14px; font-weight:630; line-height:1.35;
}
.rf-presets button[aria-pressed=true] {color:#154f56}
.rf-presets svg {grid-row:span 2; width:23px; height:23px}
.rf-presets button:first-child[aria-pressed=true] svg {color:#986416}
.rf-presets small {text-align:start; color:inherit; font-size:11px; font-variant-numeric:tabular-nums}

/* A single instrument surface gives all three configurations one common scale. */
.rf-chart {
  margin:18px 0 0; padding:5px clamp(15px,1.25vw,23px) 10px;
  color:#f1f7f8; background:var(--rf-deep); border-radius:12px;
}
.rf-chart-tabs {display:flex; gap:16px; border-bottom:1px solid #4b6b74; margin-bottom:5px}
.rf-chart-tabs button {
  flex:0 1 auto; min-width:0; padding:10px 0 8px;
  border:0; border-bottom:2px solid transparent; border-radius:0;
  background:none; color:#bccecf; font:inherit; font-size:13px; font-weight:580;
}
.rf-chart-tabs button[aria-pressed=true] {border-color:#9ce1d3; color:#fff; font-weight:720}
.rf-result {padding:5px 0 4px}
.rf-result>div:first-child {display:flex; justify-content:space-between; align-items:baseline; gap:8px}
.rf-result>div:first-child>span {color:#e9f1f2; font-size:13px; font-weight:615}
.rf-result strong {white-space:nowrap; font:660 clamp(21px,1.65vw,26px)/1.15 Manrope,'Segoe UI',sans-serif; font-variant-numeric:tabular-nums; letter-spacing:-.035em}
.rf-result strong b {font-weight:inherit}
.rf-result strong small {font-size:11px; font-weight:560; color:#bfd2d4; letter-spacing:0}
.rf-track {position:relative; display:flex; height:7px; margin-top:4px; background:#365d69; border-radius:2px; overflow:hidden}
.rf-track>i {display:block; flex:0 0 auto; height:100%}
.rf-result .rf-s0,#rf-bars[data-mode=ev] .rf-result:nth-child(1) .rf-track>i:first-child {background:#b6cad0}
.rf-result .rf-s1,#rf-bars[data-mode=ev] .rf-result:nth-child(3) .rf-track>i:first-child {background:#79d0b7}
.rf-result .rf-s2 {background:#f0bc69}
#rf-bars[data-mode=ev] .rf-result:nth-child(2) .rf-track>i:first-child {background:#86bde1}
#rf-bars[data-mode=ev] .rf-track::after {
  content:''; position:absolute; inset:0; pointer-events:none;
  background:repeating-linear-gradient(90deg,transparent 0 calc(16.6667% - 1px), #153f4e80 calc(16.6667% - 1px) 16.6667%);
}
.rf-key,.rf-caption {min-height:15px; margin-top:3px; color:#c8dadb; font-size:11px; line-height:1.4}
.rf-key {display:flex; flex-wrap:wrap; align-items:center; gap:2px 12px}
.rf-key span {display:inline-flex; gap:4px; align-items:center}
.rf-key i {width:6px; height:6px; border-radius:1px}
#retrofit-dialog .rf-finding {
  margin:13px 0 15px; padding-inline-start:12px; border-inline-start:2px solid #3c8c81;
  color:#344f58; font-size:13px; line-height:1.65;
}
.rf-content details {border-top:1px solid var(--rf-line); font-size:13px}
.rf-content details:last-of-type {border-bottom:1px solid var(--rf-line)}
.rf-content summary {
  display:flex; align-items:center; justify-content:space-between; gap:8px; min-height:40px;
  padding:8px 1px; color:#36505c; font-size:13px; font-weight:650; cursor:pointer; list-style:none;
}
.rf-content summary::-webkit-details-marker {display:none}
.rf-content summary::after {
  content:''; width:7px; height:7px; margin:0 4px 4px 0; flex:none;
  border:solid #63808a; border-width:0 1.5px 1.5px 0; transform:rotate(45deg);
}
.rf-content details[open]>summary {color:var(--rf-teal)}
.rf-content details[open]>summary::after {transform:rotate(225deg); margin-bottom:0}
.rf-content details p {margin:0 0 14px; font-size:13px}
.rf-controls {display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:13px 16px; padding:4px 1px 13px}
.rf-controls label {display:grid; gap:4px; min-width:0; color:#405c64; font-size:12px}
.rf-controls label span {display:grid; gap:1px}
.rf-controls output {color:var(--rf-teal); font-size:14px; font-weight:700}
.rf-controls input {width:100%; height:23px; margin:0; accent-color:var(--rf-teal); cursor:pointer}
.rf-table {width:100%; margin:2px 0 12px; border-collapse:collapse; table-layout:fixed; font-size:12px; font-variant-numeric:tabular-nums}
.rf-table th,.rf-table td {text-align:end; padding:8px 4px; border-bottom:1px solid #e3e9e9; overflow-wrap:break-word}
.rf-table th:first-child {text-align:start; width:33%}
.rf-table thead {background:#edf3f2; color:#3d5f67}
.rf-table th {font-weight:610}
.rf-actions {display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px; padding-top:16px}
.rf-actions a {color:#285a72; font-size:13px; font-weight:630; text-decoration:underline; text-decoration-color:#9eb8bf; text-underline-offset:3px}
.rf-actions .primary {background:#14545f; color:#fff; min-height:40px; border-radius:6px; font-weight:675}
#retrofit-dialog :focus-visible {outline:2px solid #187cac; outline-offset:2px}
#retrofit-dialog .rf-chart :focus-visible {outline-color:#bfebe5; outline-offset:1px}
.retrofit-finance-note {width:min(1510px,100%); max-width:100%; padding:0 var(--report-outer,20px); font-size:14px; line-height:1.55; margin:0 auto 14px; color:#3f5d64}

@media (hover:hover) {
  .rf-content summary:hover,.rf-head button:hover,.rf-presets button:hover {color:#114f57}
  .rf-chart-tabs button:hover {color:white}
  body.rf-active #experience>.scene-toolbar button:hover:not(.active) {background:#edf3f5}
}
@media (prefers-reduced-motion:no-preference) {
  #retrofit-dialog[open] {animation:rf-panel-arrive .24s ease-out both}
  .rf-presets::before {transition:transform .24s cubic-bezier(.2,.7,.2,1),opacity .2s}
  .rf-track>i {transition:width .26s cubic-bezier(.22,.75,.24,1),background-color .16s}
  .rf-content summary::after {transition:transform .16s}
  .rf-chart-tabs button,.rf-presets button {transition:color .16s,border-color .16s}
}
@keyframes rf-panel-arrive {from {opacity:.5; transform:translateX(9px)} to {opacity:1; transform:translateX(0)}}

@media(max-width:760px) {
  body.rf-active {--rf-stage-height:clamp(165px,29dvh,270px)}
  body.rf-active #experience {display:block; padding:0; min-height:0; height:auto}
  body.rf-active #experience #viewport {position:relative; inset:auto; width:100%; height:var(--rf-stage-height); min-height:0}
  body.rf-active #experience>.scene-toolbar {
    inset:calc(var(--rf-stage-height) - 48px) auto auto 50%; max-width:calc(100vw - 24px);
    padding:3px; gap:0; border-radius:7px;
  }
  body.rf-active .scene-toolbar :is([data-camera=overview],[data-camera=charging],[data-camera=storage]) {padding:5px 9px; min-height:32px; font-size:12px}
  #retrofit-dialog {
    --rf-gutter:clamp(16px,5vw,26px);
    position:relative; inset:auto; width:100%; height:auto; overflow:visible; scrollbar-gutter:auto;
    border:0; border-top:1px solid #cedbda; box-shadow:none;
  }
  .rf-head {padding-top:17px}
  .rf-content {padding-bottom:max(22px,env(safe-area-inset-bottom))}
  .rf-head button {width:40px; height:40px}
  .rf-chart {margin-top:15px}
  .rf-content summary,.rf-actions .primary {min-height:44px}
}

/* The heading receives programmatic focus when the panel opens; controls keep their own focus rings. */
#retrofit-dialog #retrofit-title:focus {outline:none}
@supports (interpolate-size:allow-keywords) {
  @media(prefers-reduced-motion:no-preference) {
    .rf-content details {interpolate-size:allow-keywords}
    .rf-content details::details-content {
      block-size:0;
      overflow:clip;
      transition:block-size .18s ease,content-visibility .18s allow-discrete;
    }
    .rf-content details[open]::details-content {block-size:auto}
  }
}
@media(max-width:760px) {
  .rf-chart-tabs button {min-height:42px}
}
.rf-controls input[type=range] {appearance:none; background:transparent}
.rf-controls input[type=range]::-webkit-slider-runnable-track {
  height:4px; border-radius:4px;
  background:linear-gradient(to right,#26766d 0 var(--rf-fill,0%),#d9e5e2 var(--rf-fill,0%) 100%);
}
.rf-controls input[type=range]::-webkit-slider-thumb {
  appearance:none; width:16px; height:16px; margin-top:-6px;
  border:2px solid #246d65; border-radius:50%; background:#fff;
}
.rf-controls input[type=range]::-moz-range-track {height:4px; border-radius:4px; background:#d9e5e2}
.rf-controls input[type=range]::-moz-range-progress {height:4px; background:#26766d}
.rf-controls input[type=range]::-moz-range-thumb {width:13px; height:13px; border:2px solid #246d65; border-radius:50%; background:#fff}
.rf-circuit-select{display:flex;justify-content:space-between;align-items:center;gap:10px;color:#34555b;margin:6px 0}.rf-circuit-select select{max-width:70%;font:inherit;color:inherit;padding:5px;border:1px solid #c6d8d6;border-radius:5px;background:white}
#rf-circuit-graph svg{display:block;width:100%;background:#eff5f4;border-radius:7px;margin:10px 0}
#rf-circuit-graph path{fill:none;stroke:#327469;stroke-width:2}
#rf-circuit-graph rect{fill:white;stroke:#afc9c4}
#rf-circuit-graph text{font:11px system-ui,sans-serif;fill:#234a50;text-anchor:middle}
#rf-circuit-graph .rf-reading-value{font-weight:650}
.rf-tech-actions{display:grid;gap:4px;padding-bottom:10px}.rf-tech-actions button{text-align:start;padding:9px;color:#19565f;background:#eef4f4;border-radius:5px}
