:root {
  color-scheme: light;
  --bg: #f4f5f6;
  --surface: #ffffff;
  --surface-muted: #f8f9fa;
  --ink: #172027;
  --muted: #66717a;
  --line: #dfe3e6;
  --line-strong: #c8cfd4;
  --accent: #d94b3d;
  --accent-dark: #ad3329;
  --warning: #a65f08;
  --warning-bg: #fff4dd;
  --ok: #176d54;
  --ok-bg: #e7f5ef;
  --neutral-bg: #edf0f2;
  --focus: #2f6db3;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible + .toggle-track {
  outline: 3px solid color-mix(in srgb, var(--focus) 30%, transparent);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 8px max(20px, calc((100vw - 1440px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.brand-lockup,
.topbar-actions,
.brand-lockup > div {
  display: flex;
  align-items: center;
}

.brand-lockup {
  min-width: 0;
  gap: 10px;
}

.brand-lockup > div {
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.brand-lockup strong {
  font-size: 15px;
}

.brand-lockup span:not(.brand-mark) {
  color: var(--muted);
  font-size: 11px;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 6px;
  background: var(--ink);
  color: #ffffff;
  font-weight: 800;
}

.topbar-actions {
  flex: 0 0 auto;
  gap: 14px;
}

.text-link {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.text-link:hover {
  color: var(--accent-dark);
}

.app-shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  min-height: 112px;
  padding-bottom: 22px;
}

.eyebrow,
.panel-kicker,
.control-label,
.metric-label {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 34px;
  line-height: 1.12;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.25;
}

.lede {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
}

.release-state {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.state-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.metric {
  min-width: 0;
  padding: 15px 18px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  line-height: 1.2;
}

.metric-alert {
  background: var(--warning-bg);
}

.metric-alert strong {
  color: #7f490a;
}

.control-band {
  display: flex;
  align-items: end;
  gap: 24px;
  margin-top: 16px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.segmented {
  display: grid;
  grid-auto-columns: minmax(110px, auto);
  grid-auto-flow: column;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
}

.segment {
  min-height: 32px;
  padding: 5px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.segment:hover {
  color: var(--ink);
}

.segment.is-active {
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(23, 32, 39, 0.18);
}

.toggle-control {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  margin-left: auto;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.toggle-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toggle-track {
  display: flex;
  width: 34px;
  height: 20px;
  align-items: center;
  padding: 2px;
  border-radius: 10px;
  background: var(--line-strong);
  transition: background 160ms ease;
}

.toggle-track span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: transform 160ms ease;
}

.toggle-control input:checked + .toggle-track {
  background: var(--ok);
}

.toggle-control input:checked + .toggle-track span {
  transform: translateX(14px);
}

.dashboard-grid,
.lower-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.dashboard-grid {
  grid-template-columns: minmax(560px, 1.08fr) minmax(480px, 0.92fr);
}

.lower-grid {
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.5fr);
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.panel-header {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-kicker {
  margin-bottom: 3px;
}

.status-badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  justify-content: center;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.status-warning {
  background: var(--warning-bg);
  color: #7f490a;
}

.status-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.status-neutral {
  background: var(--neutral-bg);
  color: #4c5962;
}

.distribution-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(300px, 1.2fr);
  min-height: 478px;
}

.donut-wrap {
  position: relative;
  display: grid;
  min-height: 390px;
  place-items: center;
  border-right: 1px solid var(--line);
  background: var(--surface-muted);
}

#environment-chart {
  width: min(82%, 320px);
  height: auto;
  overflow: visible;
  transform: rotate(-90deg);
}

.donut-track {
  fill: none;
  stroke: #e8ebed;
  stroke-width: 30;
}

.donut-slice {
  cursor: pointer;
  fill: none;
  stroke-width: 30;
  transition: stroke-width 140ms ease, opacity 140ms ease;
}

.donut-slice:hover,
.donut-slice:focus,
.donut-slice.is-selected {
  stroke-width: 37;
  opacity: 1;
  outline: none;
}

.donut-center {
  position: absolute;
  display: flex;
  width: 124px;
  height: 124px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
  pointer-events: none;
}

.donut-center strong {
  max-width: 110px;
  font-size: 19px;
  line-height: 1.1;
  text-align: center;
}

.donut-center span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.environment-list {
  display: flex;
  flex-direction: column;
}

.environment-row {
  display: grid;
  grid-template-columns: minmax(115px, 1fr) minmax(92px, 0.65fr) minmax(70px, 0.5fr);
  min-height: 62px;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.environment-row:last-child {
  border-bottom: 0;
}

.environment-row:hover,
.environment-row:focus-visible,
.environment-row.is-selected {
  background: var(--surface-muted);
}

.environment-row.is-selected {
  box-shadow: inset 3px 0 0 var(--row-color);
}

.environment-name {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-width: 0;
}

.environment-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--row-color);
}

.environment-name strong,
.environment-value strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.environment-name span,
.environment-value span {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.environment-ratio {
  justify-self: end;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.media-panel {
  display: flex;
  flex-direction: column;
}

.media-stage {
  position: relative;
  min-height: 360px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #11171c;
}

.media-stage img,
.media-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-stage img {
  animation: preview-drift 9s ease-in-out infinite alternate;
  transform-origin: center;
}

.media-stage.is-changing img,
.media-stage.is-changing video {
  animation: media-in 220ms ease both;
}

@keyframes preview-drift {
  from { transform: scale(1); }
  to { transform: scale(1.035); }
}

@keyframes media-in {
  from { opacity: 0.35; transform: scale(1.015); }
  to { opacity: 1; transform: scale(1); }
}

.pose-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.pose-overlay.is-hidden {
  opacity: 0;
}

.joint,
.bone,
.semantic-zone {
  position: absolute;
}

.joint {
  width: 12px;
  height: 12px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #e44e3f;
  box-shadow: 0 0 0 2px rgba(228, 78, 63, 0.35);
}

.joint-a { left: 36%; top: 42%; }
.joint-b { left: 43%; top: 53%; }
.joint-c { left: 58%; top: 41%; }
.joint-d { left: 64%; top: 54%; }

.bone {
  width: 12%;
  height: 2px;
  background: #ffdf6c;
  transform-origin: left center;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.35);
}

.bone-a { left: 37%; top: 44%; transform: rotate(38deg); }
.bone-b { left: 59%; top: 43%; transform: rotate(34deg); }

.semantic-zone {
  right: 5%;
  bottom: 18%;
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 4px;
  background: rgba(23, 32, 39, 0.72);
  color: #ffffff;
  font-size: 10px;
  font-weight: 750;
}

.media-caption {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 16px 14px;
  background: linear-gradient(transparent, rgba(8, 12, 15, 0.82));
  color: #ffffff;
}

.media-caption div {
  min-width: 0;
}

.media-caption span,
.media-caption strong {
  display: block;
}

.media-caption span {
  font-size: 10px;
  font-weight: 800;
}

.media-caption strong {
  margin-top: 2px;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-details {
  flex: 1;
  padding: 14px 16px 16px;
}

.media-details p {
  min-height: 45px;
  margin-bottom: 12px;
  color: var(--muted);
}

.capability-list {
  display: flex;
  min-height: 30px;
  flex-wrap: wrap;
  gap: 6px;
}

.capability {
  padding: 4px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface-muted);
  color: #46525a;
  font-size: 10px;
  font-weight: 750;
}

.scene-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.scene-line span {
  color: var(--muted);
}

.scene-line strong {
  min-width: 0;
  text-align: right;
}

.panel-note {
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
}

.task-table {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.task-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  min-height: 48px;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
}

.task-row:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.task-rank {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.task-name {
  min-width: 0;
}

.task-name strong,
.task-name span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-name strong {
  font-size: 12px;
}

.task-name span {
  color: var(--muted);
  font-size: 10px;
}

.task-row.is-pending {
  background: var(--surface-muted);
  color: #879098;
}

.task-status {
  color: var(--ok);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.task-row.is-pending .task-status {
  color: #879098;
}

.qa-list {
  margin: 0;
}

.qa-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

.qa-list dt {
  color: var(--muted);
}

.qa-list dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: right;
}

.qa-list .qa-problem {
  background: var(--warning-bg);
  color: #7f490a;
}

.qa-list .qa-problem dt {
  color: #7f490a;
}

.qa-callout {
  margin: 14px;
  padding: 12px;
  border-left: 3px solid var(--warning);
  background: var(--warning-bg);
}

.qa-callout strong {
  color: #7f490a;
  font-size: 12px;
}

.qa-callout p {
  margin: 5px 0 0;
  color: #7f5a2d;
  font-size: 11px;
}

.sku-showcase {
  display: block;
  width: calc(100% - 28px);
  margin: 0 14px 14px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 18px max(20px, calc((100vw - 1440px) / 2));
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 1180px) {
  .dashboard-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .media-stage {
    min-height: 0;
  }

  .qa-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.75fr);
  }

  .qa-panel .panel-header {
    grid-column: 1 / -1;
  }

  .sku-showcase {
    grid-column: 2;
    grid-row: 2 / span 2;
    align-self: center;
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 24px, 1440px);
    padding-top: 18px;
  }

  .title-row {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 28px;
  }

  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    border-bottom: 1px solid var(--line);
  }

  .metric:nth-child(even) {
    border-right: 0;
  }

  .metric:last-child {
    grid-column: 1 / -1;
    border-bottom: 0;
  }

  .control-band {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .segmented {
    grid-auto-columns: 1fr;
  }

  .toggle-control {
    margin-left: 0;
  }

  .distribution-layout {
    grid-template-columns: 1fr;
  }

  .donut-wrap {
    min-height: 320px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .task-table {
    grid-template-columns: 1fr;
  }

  .task-row:nth-child(odd) {
    border-right: 0;
  }

  .qa-panel {
    display: block;
  }

  .sku-showcase {
    width: calc(100% - 28px);
  }
}

@media (max-width: 560px) {
  .topbar {
    padding-inline: 12px;
  }

  .topbar-actions .status-badge {
    display: none;
  }

  .brand-lockup span:not(.brand-mark) {
    display: none;
  }

  .app-shell {
    width: calc(100% - 16px);
  }

  h1 {
    font-size: 25px;
  }

  .lede {
    font-size: 13px;
  }

  .metric {
    padding: 12px;
  }

  .metric strong {
    font-size: 19px;
  }

  .control-band,
  .panel-header {
    padding-inline: 12px;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .media-header {
    min-height: 88px;
  }

  .environment-row {
    grid-template-columns: minmax(118px, 1fr) minmax(78px, 0.65fr) 62px;
    padding-inline: 10px;
  }

  .scene-line {
    grid-template-columns: 1fr;
  }

  .scene-line strong {
    text-align: left;
  }

  .footer {
    flex-direction: column;
    padding-inline: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
