.auth-shell {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(400px, 1fr);
  align-items: center;
  max-width: 1200px;
  margin: auto;
  padding: 48px;
  gap: 70px;
}
.auth-story {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 30px;
  position: relative;
}
.auth-story .brand {
  margin-bottom: 90px;
  letter-spacing: 3px;
}
.auth-story .brand > .icon {
  width: 48px;
  height: 48px;
}
.auth-story .brand > span {
  display: block;
}
.auth-story h1 {
  font-size: 42px;
  line-height: 1.5;
  margin: 15px 0 24px;
}
.auth-story p {
  color: var(--muted);
}
.auth-stitches {
  display: flex;
  gap: 12px;
  margin-top: 50px;
  transform: rotate(-7deg);
}
.auth-stitches span {
  width: 38px;
  height: 54px;
  border: 9px double #b87e5d;
  border-radius: 45% 45% 55% 55%;
  transform: rotate(25deg);
}
.auth-stitches span:nth-child(even) {
  border-color: #b9c3a7;
  transform: rotate(-20deg);
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 38px;
  box-shadow: 0 18px 80px #274d4108;
  max-width: 480px;
  width: 100%;
  margin: auto;
}
.auth-card h1,
.auth-card h2 {
  font-size: 29px;
  margin: 12px 0;
}
.auth-card > .muted {
  font-size: 14px;
  line-height: 1.8;
}
.auth-form {
  display: grid;
  gap: 17px;
  margin-top: 24px;
}
.auth-form .field {
  margin: 0;
}
.auth-form input,
.account-dialog input {
  min-height: 46px;
  min-width: 0;
  width: 100%;
}
.auth-form .hint {
  margin: 0;
  font-size: 12px;
}
.auth-form .form-error:empty {
  display: none;
}
.auth-form > .button {
  min-height: 48px;
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
  margin-top: 24px;
  gap: 20px;
}
.auth-tabs button {
  padding: 12px;
  border-bottom: 2px solid transparent;
  font-size: 14px;
}
.auth-tabs button[aria-pressed="true"] {
  border-bottom-color: var(--green);
  color: var(--green);
  font-weight: 600;
}
.auth-footnote {
  font-size: 12px;
  color: var(--muted);
  margin-top: 22px;
  line-height: 1.7;
}
.auth-text-button {
  display: block;
  color: var(--green);
  margin: 14px auto 0;
  padding: 10px;
  font-size: 13px;
}
.password-field {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
}
.password-field input {
  padding-right: 62px;
}
.password-field button {
  position: absolute;
  right: 4px;
  top: 4px;
  bottom: 4px;
  min-width: 50px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--green);
  border-radius: 6px;
}
.password-field button:hover {
  background: var(--green-light);
}
.account-button {
  max-width: 180px;
  min-width: 44px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.account-button .avatar {
  width: 25px;
  height: 25px;
  font-size: 13px;
}
.account-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.sidebar-bottom > div {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-dialog {
  max-width: 560px;
}
.account-dialog h2 {
  margin-bottom: 8px;
}
.account-section {
  padding: 22px 0;
  border-top: 1px solid var(--line);
  margin-top: 20px;
}
.account-section .field {
  margin-bottom: 12px;
}
.account-section [role="status"] {
  font-size: 13px;
  color: var(--green);
  margin-top: 10px;
}
.account-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 12px;
}
.account-section summary {
  cursor: pointer;
  min-height: 30px;
  font-weight: 600;
}
.account-section > .hint {
  margin-bottom: 14px;
}
.invitation-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}
.invitation-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.invite-result {
  padding: 16px;
  background: var(--green-light);
  border-radius: 10px;
  margin: 16px 0;
}
.invite-result .hint {
  margin-top: 10px;
}
.auth-compact {
  display: block;
  min-height: 0;
  padding: 0;
}
.auth-compact .auth-story {
  display: none;
}
.auth-compact .auth-card {
  padding: 0;
  border: 0;
  box-shadow: none;
}
.reauth-dialog {
  max-width: 480px;
}
.reauth-dialog .auth-card {
  background: transparent;
}
@media (max-width: 800px) {
  .auth-shell {
    grid-template-columns: 1fr;
    max-width: 510px;
    gap: 28px;
    padding: 30px 20px;
  }
  .auth-story {
    padding: 0;
  }
  .auth-story .brand {
    margin-bottom: 0;
    font-size: 26px;
  }
  .auth-story > .eyebrow,
  .auth-story h1,
  .auth-story p,
  .auth-stitches {
    display: none;
  }
  .auth-card {
    padding: 28px;
  }
  .auth-compact {
    padding: 0;
  }
  .account-name {
    max-width: 80px;
  }
}
@media (max-width: 600px) {
  .auth-shell {
    padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
    min-height: 100svh;
    align-content: center;
  }
  .auth-card {
    padding: 24px 20px;
    border-radius: 18px;
  }
  .auth-form input,
  .account-dialog input {
    font-size: 16px;
  }
  .auth-card h1,
  .auth-card h2 {
    font-size: 25px;
  }
  .account-button {
    min-height: 44px;
    padding: 5px 7px;
  }
  .account-button .account-name {
    display: none;
  }
  .account-section-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .account-section .button {
    min-height: 44px;
  }
  .auth-compact {
    padding: 0;
    min-height: 0;
  }
}
.yarn-stage,
.comparison-stage {
  position: relative;
  touch-action: auto;
}
.preview-touch-toggle {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 2;
  padding: 10px 14px;
  min-height: 44px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 2px 10px #274d4114;
  font-size: 13px;
  touch-action: manipulation;
}
.preview-touch-toggle[hidden] {
  display: none;
}
.preview-touch-toggle[aria-pressed="true"] {
  background: var(--green);
  color: white;
}
