.hero-lab {
  --accent: #5a32cb;
  --accent-soft: #cbb8ee;
  --lab-base: #eee6fa;
  --lab-grid: #8d65b81a;
  position: relative;
  min-width: 0;
  isolation: isolate;
  overflow: clip;
  border: 1px solid #ddd0e9;
  border-radius: clamp(20px, 2.5vw, 34px);
  background: radial-gradient(ellipse at 70% 44%, #ffffffaa, transparent 65%), var(--lab-base);
  box-shadow: 0 18px 45px -36px #43327456;
  transition: background-color .4s var(--ease), border-color .4s var(--ease);
}
.hero-lab[data-active-view="split"] {
  --accent: #6040a9;
  --accent-soft: #ae97d9;
  --lab-base: #efe8f8;
}
.hero-lab[data-active-view="goals"] {
  --accent: #2c7554;
  --accent-soft: #b9d2c0;
  --lab-base: #e7f2e7;
  --lab-grid: #58856f1c;
  border-color: #d3e4d7;
}
.hero-lab::before {
  content: "";
  position: absolute;
  inset: 0 0 13%;
  z-index: -1;
  border-radius: inherit;
  background-image: linear-gradient(to right, var(--lab-grid) 1px, transparent 1px), linear-gradient(to bottom, var(--lab-grid) 1px, transparent 1px);
  background-size: 29px 29px;
  mask-image: linear-gradient(154deg, transparent 3%, black 40%, #0007 73%, transparent 100%);
  pointer-events: none;
}
.lab-toolbar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 10px clamp(15px, 2.4vw, 31px);
  border-bottom: 1px solid #6f51821f;
  border-radius: inherit;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  background: #fff8;
}
.lab-toolbar > p { color: #4e4160; font-size: .875rem; font-weight: 720; }
.lab-views { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border: 1px solid #a38cb335; border-radius: 40px; background: #fff7; }
.lab-views > button { 
  min-height: 38px;
  border: 0;
  border-radius: inherit;
  padding: 6px 13px;
  background: transparent;
  color: #594e63;
  font-size: .875rem;
  font-weight: 680;
  transition: color .18s, background .18s, box-shadow .18s;
}
.lab-views > button[aria-pressed="true"] { color: var(--purple-deep); background: white; box-shadow: 0 1px 3px #55397d28; }
.lab-views > button:hover { color: var(--purple-deep); }
.lab-views > button:focus-visible { outline-offset: 2px; }
.lab-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .93fr);
  justify-items: center;
  align-items: center;
  gap: clamp(18px, 3.7vw, 52px);
  min-height: clamp(440px, 36vw, 538px);
  padding: 22px clamp(20px, 3.2vw, 42px) 43px;
}
.lab-panel::before {
  content: "";
  position: absolute;
  inset: 47% 26% auto 37%;
  border-top: 1px dashed color-mix(in srgb, var(--accent) 39%, transparent);
  transform-origin: right;
  pointer-events: none;
}
.lab-panel::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: auto 8% 6% 44%;
  height: 68%;
  border-radius: 50%;
  border: 1px solid #fff;
  transform: rotate(-25deg);
  pointer-events: none;
}

.lab-card {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  padding: clamp(14px, 1.9vw, 25px);
  border: 1px solid #fff;
  border-radius: 23px;
  background: #fffdffeb;
  box-shadow: 0 24px 43px -26px #59437745, 0 1px 4px #721e6910;
}
.lab-label { font-size: .875rem; font-weight: 710; color: #4e4359; }
.lab-metric {
  margin-top: 5px;
  color: var(--ink);
  font-size: clamp(1.6rem, 2.8vw, 2.8rem);
  font-weight: 740;
  line-height: 1.06;
  letter-spacing: -.065em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.lab-period { margin-top: 4px; color: var(--muted); font-size: .8125rem; line-height: 1.35; }
.lab-history { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 7px; height: 122px; margin-top: 21px; margin-bottom: 30px; }
.lab-axis { display: flex; flex-direction: column; justify-content: space-between; color: #6d6178; font-size: .75rem; line-height: 1; font-variant-numeric: tabular-nums; }
.lab-bars {
  height: 100%;
  display: grid;
  grid-template-columns: repeat(6,minmax(0,1fr));
  justify-items: center;
  gap: 3px;
  border-block: 1px solid #cdbddd65;
  background: linear-gradient(transparent 50%, #cdbddd65 50% calc(50% + 1px), transparent calc(50% + 1px));
}
.lab-bars > div { position: relative; height: 100%; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.lab-bars i { width: min(73%, 27px); height: var(--height); border-radius: 4px 4px 0 0; background: var(--accent-soft); transform-origin: bottom; transition: background .22s var(--ease); }
.lab-bars span { position: absolute; bottom: -1.25rem; color: #62566d; font-size: .75rem; }
.lab-bars [data-highlighted] i { background: var(--accent); }
.lab-bars [data-highlighted] span { color: var(--purple-deep); font-weight: 780; }
.lab-picker { position: relative; }
.lab-picker select {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 6px 28px 6px 10px;
  border: 1px solid #dcd2e9;
  border-radius: 8px;
  color: #473662;
  background: #f7f2fb;
  font: inherit;
  font-size: .8125rem;
  font-weight: 680;
  appearance: none;
  cursor: pointer;
}
.lab-picker > span { position: absolute; right: 12px; top: calc(50% - 5px); width: 7px; height: 7px; border-bottom: 1.5px solid #493473; border-right: 1.5px solid #493473; transform: rotate(45deg); pointer-events: none; }
.lab-picker select:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
.lab-allocation { margin-top: 22px; display: grid; gap: 3px; height: 14px; grid-template-columns: repeat(3,1fr); overflow: hidden; border-radius: 4px; }
.lab-allocation i { display: block; background: var(--accent-soft); transform-origin: left; }
.lab-allocation i:first-child { background: var(--accent); }
.lab-split-list { display: grid; gap: 12px; margin: 18px 0 0; padding: 0; list-style: none; }
.lab-split-list li { display: grid; align-items: center; gap: 5px 7px; grid-template-columns: auto minmax(0,1fr) auto; color: #564960; font-size: .875rem; line-height: 1.25; }
.lab-split-list li strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.lab-split-list i { width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }
.lab-split-list i.lab-split-friends { background: var(--accent-soft); }
@property --cashli-progress {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 70%;
}
.lab-goal-ring {
  --cashli-progress: 70%;
  width: min(100%,138px);
  aspect-ratio: 1;
  margin: 16px auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--accent) 0 var(--cashli-progress), #deeadf var(--cashli-progress) 100%);
  position: relative;
  isolation: isolate;
}
.lab-goal-ring::after { content: ""; position: absolute; z-index: -1; inset: 10%; border-radius: inherit; background: #fffdff; }
.lab-goal-ring strong { color: #204e39; font-size: clamp(1.4rem,2.6vw,2.25rem); letter-spacing: -.05em; }
.lab-goal-value { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 3px 6px; font-variant-numeric: tabular-nums; }
.lab-goal-value strong { color: #254e3d; font-size: 1.2rem; line-height: 1.2; }
.lab-goal-value span { color: #52645a; font-size: .8rem; }

.lab-device { z-index: 1; align-self: center; width: min(100%, clamp(178px, 16vw, 228px)); --device-radius: 32px; }
.lab-note { position: absolute; bottom: 12px; inset-inline: clamp(14px, 2.4vw, 32px); text-align: right; color: #5f506e; font-size: .75rem; line-height: 1.35; }
.hero-lab[data-hero-ready] .lab-bars i { animation: lab-bars-in .56s var(--delay) var(--ease) both; }
.hero-lab[data-hero-ready] .lab-panel .lab-allocation i { animation: lab-allocation-in .43s var(--ease) both; }
.hero-lab[data-hero-ready] .lab-panel .lab-allocation i:nth-child(2) { animation-delay: .06s; }
.hero-lab[data-hero-ready] .lab-panel .lab-allocation i:nth-child(3) { animation-delay: .12s; }
.hero-lab[data-hero-ready] .lab-goal-ring { animation: lab-goal-in .68s var(--ease) both; }
.hero-lab[data-hero-ready] .lab-device { animation: lab-device-in .46s var(--ease) both; }
@keyframes lab-bars-in { from { transform: scaleY(.055); opacity: .5; } to { transform: scaleY(1); opacity: 1; } }
@keyframes lab-allocation-in { from { transform: scaleX(.12); opacity: .35; } to { transform: scaleX(1); opacity: 1; } }
@keyframes lab-goal-in { from { --cashli-progress: 0%; } to { --cashli-progress: 70%; } }
@keyframes lab-device-in { from { transform: translateY(11px); opacity: .52; } to { transform: translateY(0); opacity: 1; } }
@media (max-width: 1010px) and (min-width: 791px) {
  .hero { grid-template-columns: minmax(0,.75fr) minmax(0,1.25fr); gap: 24px; }
  .lab-panel { gap: 14px; padding-inline: 12px; }
  .lab-card { padding: 13px; }
  .lab-axis { display: none; }
  .lab-history { grid-template-columns: 1fr; }
  .lab-views > button { padding-inline: 8px; }
}
@media (max-width: 550px) {
  .hero-lab { border-radius: 20px; }
  .lab-toolbar { padding: 8px 10px; min-height: 50px; justify-content: center; }
  .lab-toolbar > p { display: none; }
  .lab-views { flex-wrap: nowrap; }
  .lab-views > button { padding: 4px 10px; min-height: 38px; font-size: .8125rem; }
  .lab-panel { padding: 18px 11px 36px; gap: 12px; min-height: 310px; grid-template-columns: minmax(0,1.05fr) minmax(0,.95fr); }
  .lab-panel::before { display: none; }
  .lab-card { padding: 12px 9px; border-radius: 13px; }
  .lab-device { width: min(100%,154px); --device-radius: 25px; --bezel: 3px; }
  .lab-label, .lab-split-list li { font-size: .82rem; }
  .lab-metric { font-size: clamp(1.21rem, 6vw, 1.7rem); }
  .lab-period, .lab-goal-value span { font-size: .75rem; }
  .lab-history { grid-template-columns: 1fr; height: 77px; margin-block: 15px 27px; }
  .lab-axis { display: none; }
  .lab-bars { gap: 1px; }
  .lab-bars span { font-size: .75rem; }
  .lab-picker select { min-height: 37px; padding-inline: 6px 18px; font-size: .74rem; }
  .lab-picker > span { right: 7px; }
  .lab-note { bottom: 9px; }
  .lab-allocation { margin-top: 17px; height: 10px; }
  .lab-split-list { margin-top: 14px; gap: 8px; }
  .lab-split-list li { gap: 4px; }
  .lab-goal-ring { width: min(100%,79px); margin: 13px auto; }
  .lab-goal-value { justify-content: flex-start; }
}
@media (max-width: 365px) {
  .lab-panel { padding-inline: 9px; gap: 9px; }
  .lab-card { padding-inline: 7px; }
  .lab-bars > div:not(:first-child):not(:last-child) span { display: none; }
  .lab-split-list li { grid-template-columns: minmax(0,1fr) auto; }
  .lab-split-list i { display: none; }
}

.hero-lab[data-hero-ready] .lab-card { animation: lab-card-in .44s .08s var(--ease) both; }
.hero-lab[data-hero-ready] .lab-panel::before { animation: lab-connection-in .39s .06s var(--ease) both; }
@keyframes lab-card-in { from { opacity: .50; transform: translateX(13px) scale(.982); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes lab-connection-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }
