.garmentModelingView {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #f3f4f6;
}

.garmentModelingView[hidden],
.garmentModelingView [hidden] {
  display: none !important;
}

.gmWorkspace {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
}

.gmControls {
  min-width: 0;
  min-height: 0;
  padding: 25px 24px 22px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  background: #fff;
}

.gmHeading {
  margin-bottom: 25px;
}

.gmBackButton {
  height: 34px;
  margin-bottom: 21px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #696c73;
  background: #fff;
}

.gmBackButton:hover { color: var(--ink); background: #f6f6f7; }
.gmBackButton svg { width: 16px; height: 16px; }
.gmHeading p,
.gmStageHeader p { margin: 0 0 5px; color: var(--brand); font-size: 9px; font-weight: 800; letter-spacing: 0; }
.gmHeading h1 { margin: 0; color: var(--ink); font-size: 25px; letter-spacing: 0; }
.gmHeading small { display: block; margin-top: 7px; color: #8d9097; font-size: 11px; }

.gmControlSection {
  padding: 20px 0;
  border-top: 1px solid #ececef;
}

.gmControlTitle {
  margin-bottom: 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.gmControlTitle h2 { margin: 0; color: var(--ink); font-size: 14px; letter-spacing: 0; }
.gmControlTitle span { color: #9a9da4; font-size: 10px; text-align: right; }

.gmUpload {
  position: relative;
  height: 218px;
  border: 1px dashed #cfd1d6;
  border-radius: 8px;
  overflow: hidden;
  background: #fafafa;
  transition: border-color .16s ease, background .16s ease;
}

.gmUpload:hover,
.gmUpload.is-dragging { border-color: var(--brand); background: #fff7f7; }
.gmUploadTarget { width: 100%; height: 100%; padding: 0; border: 0; display: block; background: transparent; }
.gmUploadEmpty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #8d9097; }
.gmUploadEmpty svg { width: 34px; height: 34px; margin-bottom: 13px; color: #a9acb2; }
.gmUploadEmpty strong { color: #55585f; font-size: 13px; }
.gmUploadEmpty small { margin-top: 7px; color: #a2a5ab; font-size: 10px; }
.gmUploadTarget>img { width: 100%; height: 100%; display: block; object-fit: contain; background: #ececee; }
.gmUploadMeta { position: absolute; right: 9px; bottom: 9px; left: 9px; min-height: 28px; padding: 6px 9px; border-radius: 5px; overflow: hidden; color: #fff; background: rgba(28,29,32,.74); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; backdrop-filter: blur(6px); pointer-events: none; }
.gmUploadRemove { position: absolute; top: 9px; right: 9px; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px; color: #fff; background: rgba(27,28,31,.72); }
.gmUploadRemove svg { width: 15px; height: 15px; }

.gmModeSegments {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.gmModeSegments>button {
  min-width: 0;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #777a81;
  background: #fff;
  text-align: left;
}

.gmModeSegments>button:hover { border-color: #babdc3; }
.gmModeSegments>button.active { color: var(--brand); border-color: var(--brand); background: #fff6f6; box-shadow: 0 0 0 2px rgba(255,90,99,.08); }
.gmModeSegments>button>svg { width: 24px; height: 24px; flex: 0 0 auto; }
.gmModeSegments>button>span { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.gmModeSegments strong { color: var(--ink); font-size: 12px; }
.gmModeSegments small { color: #989ba1; font-size: 9px; }

.gmPartGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.gmPartGrid label { min-width: 0; }
.gmPartGrid input { position: absolute; opacity: 0; pointer-events: none; }
.gmPartGrid span { height: 39px; border: 1px solid var(--line); border-radius: 6px; display: flex; align-items: center; justify-content: center; color: #686b72; background: #fff; font-size: 11px; cursor: pointer; }
.gmPartGrid input:focus-visible+span { outline: 2px solid var(--brand); outline-offset: 2px; }
.gmPartGrid input:checked+span { color: #fff; border-color: var(--ink); background: var(--ink); }
.gmPartGrid input:disabled+span { cursor: not-allowed; opacity: .65; }

.gmOtherField {
  margin-top: 10px;
  display: grid;
  gap: 7px;
}

.gmOtherField[hidden] { display: none; }
.gmOtherField>span { color: #6f7279; font-size: 10px; font-weight: 700; }
.gmOtherField>input {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 11px;
  outline: none;
}
.gmOtherField>input:focus { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(31,32,36,.08); }
.gmOtherField>input[aria-invalid="true"] { border-color: var(--brand); background: #fffafa; }
.gmOtherField>input:disabled { color: #9da0a6; background: #f2f3f4; cursor: not-allowed; }

.gmControlActions {
  position: sticky;
  bottom: -22px;
  margin: 4px -24px -22px;
  padding: 15px 24px 22px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 9px;
  background: #fff;
}

.gmSecondaryButton,
.gmGenerateButton { height: 46px; border-radius: 7px; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; }
.gmSecondaryButton { border: 1px solid var(--line); color: #65686f; background: #fff; }
.gmGenerateButton { border: 1px solid var(--brand); color: #fff; background: var(--brand); }
.gmGenerateButton:hover:not(:disabled) { background: var(--brand-dark); }
.gmGenerateButton.is-cancel { border-color: #a9333c; background: #a9333c; }
.gmGenerateButton:disabled { border-color: #dadce0; color: #a5a8ae; background: #ececef; cursor: not-allowed; }
.gmSecondaryButton svg,
.gmGenerateButton svg { width: 17px; height: 17px; }

.gmStage {
  min-width: 0;
  min-height: 0;
  padding: 28px 30px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.gmStageHeader { min-width: 0; margin-bottom: 16px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.gmStageHeader h2 { margin: 0; color: var(--ink); font-size: 19px; letter-spacing: 0; }
.gmStageHeader>span { min-width: 0; overflow: hidden; color: #85888f; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.gmResultSurface { min-width: 0; min-height: 0; overflow: auto; border: 1px solid #e3e4e7; border-radius: 8px; background: #fff; }
.gmEmptyResult { width: 100%; height: 100%; min-height: 440px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #94979e; }
.gmFormula { display: flex; align-items: center; gap: 15px; }
.gmFormula span { width: 62px; height: 62px; border: 1px solid #dedfe3; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #777a81; background: #f7f7f8; }
.gmFormula span:last-child { color: #fff; border-color: var(--brand); background: var(--brand); }
.gmFormula svg { width: 27px; height: 27px; }
.gmFormula b { color: #b3b6bc; font-size: 18px; }
.gmEmptyResult h2 { margin: 21px 0 6px; color: var(--ink); font-size: 17px; letter-spacing: 0; }
.gmEmptyResult p { margin: 0; font-size: 11px; }
.gmResultGrid { padding: 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); align-content: start; gap: 14px; }

.gmResultCard { min-width: 0; overflow: hidden; border: 1px solid #e1e2e5; border-radius: 8px; background: #fff; }
.gmResultCard>header { height: 48px; padding: 0 13px; border-bottom: 1px solid #ededf0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gmResultCard>header>div { min-width: 0; display: flex; align-items: center; gap: 8px; }
.gmResultCard>header i { width: 7px; height: 7px; border-radius: 50%; background: #a8abb1; }
.gmResultCard.is-running>header i { background: #d99315; box-shadow: 0 0 0 4px rgba(217,147,21,.12); }
.gmResultCard.is-completed>header i { background: #16865a; box-shadow: 0 0 0 4px rgba(22,134,90,.12); }
.gmResultCard.is-failed>header i { background: #b9323c; box-shadow: 0 0 0 4px rgba(185,50,60,.12); }
.gmResultCard>header strong { overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.gmResultCard>header small { color: #8e9197; font-size: 9px; }
.gmResultVisual { position: relative; aspect-ratio: 1/1; overflow: hidden; background: #f3f3f4; }
.gmResultVisual>img { width: 100%; height: 100%; display: block; object-fit: contain; }
.gmCardPlaceholder,
.gmCardProgress { position: absolute; inset: 0; padding: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #8f9298; text-align: center; }
.gmCardPlaceholder svg { width: 30px; height: 30px; margin-bottom: 11px; }
.gmCardPlaceholder strong,
.gmCardProgress strong { max-width: 100%; color: #777a81; font-size: 10px; font-weight: 500; line-height: 1.5; }
.gmSpinner { width: 28px; height: 28px; margin-bottom: 13px; border: 3px solid #dedfe3; border-top-color: var(--brand); border-radius: 50%; animation: gmSpin .8s linear infinite; }
.gmCardProgress>div { width: min(170px, 80%); height: 4px; margin-top: 13px; border-radius: 4px; overflow: hidden; background: #dedfe3; }
.gmCardProgress>div i { height: 100%; display: block; border-radius: inherit; background: var(--brand); transition: width .2s ease; }
.gmResultCard>footer { min-height: 52px; padding: 8px 10px 8px 13px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gmResultCard>footer>span { color: #95989e; font-size: 9px; }
.gmResultCard>footer>div { display: flex; gap: 6px; }
.gmResultCard>footer button { height: 32px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; display: flex; align-items: center; gap: 5px; color: #63666d; background: #fff; font-size: 10px; }
.gmResultCard>footer button:hover:not(:disabled) { color: var(--ink); border-color: #b8bbc1; background: #f7f7f8; }
.gmResultCard>footer button:disabled { color: #b3b5ba; background: #f3f3f4; }
.gmResultCard>footer button svg { width: 14px; height: 14px; }

@keyframes gmSpin { to { transform: rotate(360deg); } }

@media (max-width: 1120px) {
  .gmWorkspace { grid-template-columns: 350px minmax(0, 1fr); }
  .gmControls { padding-right: 19px; padding-left: 19px; }
  .gmControlActions { margin-right: -19px; margin-left: -19px; padding-right: 19px; padding-left: 19px; }
  .gmStage { padding-right: 20px; padding-left: 20px; }
  .gmPartGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body:has(.garmentModelingView:not([hidden])) .noticeBar { bottom: 88px; }
  .garmentModelingView { overflow-y: auto; }
  .gmWorkspace { height: auto; min-height: 100%; grid-template-columns: 1fr; }
  .gmControls { overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); }
  .gmControlActions { bottom: 0; }
  .gmStage { min-height: 660px; padding: 21px 14px 90px; overflow: visible; }
  .gmResultSurface { min-height: 520px; overflow: visible; }
  .gmResultGrid { padding: 12px; grid-template-columns: 1fr; }
  .gmEmptyResult { min-height: 520px; }
}
