.derived-lab{
  position:relative;
  padding:32px;
  overflow:hidden;
  background:
    radial-gradient(circle at 88% 0,rgba(76,194,255,.09),transparent 29%),
    linear-gradient(145deg,rgba(240,180,41,.055),var(--surface) 38%,rgba(76,194,255,.035));
}
.derived-lab::before{
  content:"";
  position:absolute;
  inset:0 0 auto;
  height:2px;
  background:linear-gradient(90deg,var(--blue),rgba(76,194,255,.12) 42%,rgba(240,180,41,.16),var(--amber));
}
.derived-head,.derived-toolbar,.derived-hero,.derived-foot,.derived-panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
}
.derived-head>div:first-child{max-width:760px}
.derived-head-actions{display:flex;align-items:center;justify-content:flex-end;gap:7px;flex:none}
.derived-head-actions a,.derived-foot button{
  display:inline-flex;
  min-height:34px;
  align-items:center;
  justify-content:center;
  padding:0 10px;
  border:1px solid var(--border);
  border-radius:9px;
  background:var(--surface2);
  color:var(--text2);
  font-size:10px;
  font-weight:750;
  line-height:14px;
  letter-spacing:.06em;
  text-decoration:none;
  cursor:pointer;
  transition:border-color 140ms ease,color 140ms ease,transform 140ms ease;
}
.derived-head-actions a:hover,.derived-foot button:hover{border-color:var(--amber);color:var(--text);transform:translateY(-1px)}
.derived-status{
  display:inline-flex;
  min-height:34px;
  align-items:center;
  justify-content:center;
  padding:0 11px;
  border:1px solid rgba(240,180,41,.28);
  border-radius:999px;
  background:rgba(240,180,41,.06);
  color:var(--amber);
  font-size:10px;
  font-weight:740;
  line-height:14px;
  white-space:nowrap;
}
.derived-status[data-state="ready"]{border-color:rgba(22,199,132,.3);background:rgba(22,199,132,.07);color:var(--green)}
.derived-status[data-state="error"]{border-color:rgba(234,57,67,.28);background:rgba(234,57,67,.06);color:var(--red)}
.derived-toolbar{
  align-items:flex-end;
  margin-top:24px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:13px;
  background:rgba(255,255,255,.018);
}
.derived-toolbar>div{min-width:0}
.derived-lens-wrap{margin-left:auto}
.derived-control-label{display:block;margin:0 0 7px 3px;color:var(--text2);font-size:10px;font-weight:690;line-height:14px;letter-spacing:.06em;text-transform:uppercase}
.derived-lens-toggle{overflow-x:auto;max-width:100%;scrollbar-width:none}
.derived-lens-toggle::-webkit-scrollbar{display:none}
.derived-lens-toggle button{flex:none}
.derived-hero{
  align-items:stretch;
  margin-top:14px;
  padding:18px 20px;
  border:1px solid rgba(76,194,255,.18);
  border-radius:14px;
  background:linear-gradient(105deg,rgba(76,194,255,.065),rgba(255,255,255,.01) 48%,rgba(240,180,41,.04));
}
.derived-hero-copy{min-width:0;flex:1}
.derived-hero-copy>span,.derived-comparative>span{display:block;color:var(--text2);font-size:10px;font-weight:720;line-height:15px;letter-spacing:.08em;text-transform:uppercase}
.derived-hero-copy>strong{display:block;margin-top:5px;font-family:var(--font-numeric);font-size:30px;font-weight:760;line-height:35px;letter-spacing:-.035em}
.derived-hero-copy>p{max-width:680px;margin:6px 0 0;color:var(--text2);font-size:11px;line-height:18px}
.derived-comparative{
  width:min(290px,34%);
  min-width:220px;
  padding:3px 0 3px 22px;
  border-left:1px solid var(--border);
}
.derived-comparative strong{display:block;margin-top:5px;font-family:var(--font-numeric);font-size:17px;font-weight:720;line-height:23px}
.derived-comparative small{display:block;margin-top:4px;color:var(--text2);font-size:10px;line-height:16px}
.derived-metric-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:12px}
.derived-metric-grid article{min-width:0;padding:15px 16px;border:1px solid var(--border);border-radius:12px;background:var(--surface2)}
.derived-metric-grid span,.derived-metric-grid small{display:block;color:var(--text2);font-size:10px;line-height:15px}
.derived-metric-grid strong{display:block;margin:7px 0 3px;font-family:var(--font-numeric);font-size:19px;font-weight:740;line-height:25px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.derived-body{display:grid;grid-template-columns:minmax(0,1.18fr) minmax(320px,.82fr);gap:12px;margin-top:12px}
.derived-distribution,.derived-inspector{min-width:0;padding:18px;border:1px solid var(--border);border-radius:14px;background:rgba(255,255,255,.015)}
.derived-panel-head{align-items:flex-start}
.derived-panel-head span{display:block;color:var(--amber);font-size:9px;font-weight:760;line-height:13px;letter-spacing:.1em;text-transform:uppercase}
.derived-panel-head h3{margin:4px 0 0;font-family:var(--font-display);font-size:15px;font-weight:700;line-height:21px}
.derived-panel-head>small{color:var(--text2);font-size:10px;line-height:15px;text-align:right}
.derived-bars{display:flex;flex-direction:column;gap:10px;margin-top:16px}
.derived-bar-row{display:grid;grid-template-columns:minmax(118px,.72fr) minmax(130px,1.28fr) auto;align-items:center;gap:10px;min-width:0}
.derived-bar-label{min-width:0}
.derived-bar-label strong{display:block;overflow:hidden;color:var(--text);font-size:11px;font-weight:680;line-height:16px;text-overflow:ellipsis;white-space:nowrap}
.derived-bar-label span{display:block;margin-top:1px;color:var(--text2);font-size:9px;line-height:13px}
.derived-bar-track{height:6px;overflow:hidden;border-radius:999px;background:var(--border)}
.derived-bar-fill{display:block;width:var(--bar,0%);height:100%;border-radius:inherit;background:linear-gradient(90deg,var(--blue),var(--amber));transform-origin:left;animation:derived-grow 440ms cubic-bezier(.16,1,.3,1) both}
.derived-bar-track[data-empty="true"] .derived-bar-fill{display:none}
.derived-bar-row[data-tone="negative"] .derived-bar-fill{background:linear-gradient(90deg,rgba(234,57,67,.62),var(--red))}
.derived-bar-row[data-tone="positive"] .derived-bar-fill{background:linear-gradient(90deg,rgba(22,199,132,.58),var(--green))}
@keyframes derived-grow{from{transform:scaleX(0)}}
.derived-bar-value{font-family:var(--font-numeric);font-size:11px;font-weight:720;line-height:16px;text-align:right;white-space:nowrap}
.derived-loading{margin:8px 0 0;color:var(--text2);font-size:10px;line-height:17px}
.derived-insight{margin:14px 0 0;color:var(--text2);font-size:11px;line-height:18px}
.derived-rank-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:16px}
.derived-rank-grid>div{min-width:0;padding:11px;border:1px solid var(--border);border-radius:11px;background:var(--surface2)}
.derived-rank-grid>div>strong{display:block;color:var(--text2);font-size:10px;font-weight:700;line-height:15px}
.derived-rank-grid ol{display:flex;flex-direction:column;gap:7px;margin:9px 0 0;padding:0;list-style:none}
.derived-rank-grid li{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;min-width:0;color:var(--text);font-size:10px;line-height:15px}
.derived-rank-grid li span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.derived-rank-grid li strong{font-family:var(--font-numeric);font-size:10px;font-weight:720;white-space:nowrap}
.derived-rank-grid>div:first-child li strong{color:var(--green)}
.derived-rank-grid>div:last-child li strong{color:var(--red)}
.derived-foot{align-items:flex-start;margin-top:12px;padding-top:12px;border-top:1px solid var(--border)}
.derived-foot p{max-width:900px;margin:0;color:var(--text2);font-size:10px;line-height:16px}
.derived-foot button{flex:none}

@media (max-width:900px){
  .derived-lab{padding:26px}
  .derived-head{align-items:flex-start}
  .derived-toolbar{display:block}
  .derived-lens-wrap{margin:14px 0 0}
  .derived-metric-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .derived-body{grid-template-columns:1fr}
  .derived-comparative{width:36%}
}
@media (max-width:620px){
  .derived-lab{padding:20px 16px}
  .derived-head{display:block}
  .derived-head .section-heading{max-width:100%;overflow-wrap:anywhere;text-wrap:balance}
  .derived-head .section-subtitle{font-size:12px;line-height:19px;text-wrap:pretty}
  .derived-head-actions{justify-content:flex-start;margin-top:14px;overflow-x:auto}
  .derived-head-actions a,.derived-status{min-height:44px}
  .derived-toolbar{padding:10px}
  .derived-toolbar .segmented button{height:44px}
  .derived-lens-toggle{display:flex;width:100%;padding:2px}
  .derived-hero{display:block;padding:16px}
  .derived-hero-copy>strong{font-size:26px;line-height:31px}
  .derived-comparative{width:auto;min-width:0;margin-top:14px;padding:13px 0 0;border-top:1px solid var(--border);border-left:0}
  .derived-metric-grid{gap:8px}
  .derived-metric-grid article{padding:13px}
  .derived-body{gap:8px}
  .derived-distribution,.derived-inspector{padding:15px}
  .derived-bar-row{grid-template-columns:minmax(92px,.7fr) minmax(80px,1.3fr) auto;gap:7px}
  .derived-rank-grid{grid-template-columns:1fr}
  .derived-foot{display:block}
  .derived-foot button{min-height:44px;margin-top:10px}
  .derived-control-label,
  .derived-hero-copy>span,
  .derived-comparative>span,
  .derived-comparative small,
  .derived-metric-grid span,
  .derived-metric-grid small,
  .derived-panel-head>small,
  .derived-loading,
  .derived-bar-label span,
  .derived-rank-grid>div>strong,
  .derived-rank-grid li,
  .derived-rank-grid li strong,
  .derived-foot p{font-size:11px}
  .derived-insight{font-size:12px;line-height:19px}
}
@media (max-width:480px){
  .derived-lens-toggle{
    display:grid;
    grid-template-columns:repeat(6,minmax(0,1fr));
    gap:4px;
    width:100%;
    padding:4px;
    overflow:visible;
  }
  .derived-lens-toggle button{
    grid-column:span 2;
    width:100%;
    min-width:0;
    height:44px;
    padding:0 5px;
    font-size:11px;
  }
  .derived-lens-toggle button:nth-child(n+4){grid-column:span 3}
}
@media (prefers-reduced-motion:reduce){
  .derived-bar-fill{animation:none}
  .derived-head-actions a,.derived-foot button{transition:none}
  .derived-head-actions a:hover,.derived-foot button:hover{transform:none}
}
